Originally posted by oiaohm
View Post
But yes you're right, you start in user space, switch to kernel space and back, that makes for two context switches.
Or actually, I'm not sure if a syscall on Linux necessarily means a full context switch happens in all cases. It doesn't seem to be a hard requirement. There is still some cost to switching from user to kernel space of course and the relative increase in cost due to mitigations is quite similar to the cost of a full context switch as far as I know so this is just nitpicking. And I'm not even sure how Linux handles it.
Comment