Fast path context switch - microoptimize FPU reload
Quoted 6 lines · Andi
We don't need the lock prefix to test our local thread flags state. Unfortunately
test_thread_flagcurrently always usestest_bitwhich has a LOCK on SMP, but that's unnecessary. LOCK is costly on P4, so it's a good idea to avoid it.
No, LOCK is required: the TIF_ flags word is also used for signal delivery - writing without lock could corrupt state.
What about moving TIF_USEDFPU from the thread_info into task_struct->flags? This flag word is only accessed by "current", no special atomicity requirements.
--
Manfred
Quoted 3 lines · Manfred Spraul
What about moving
TIF_USEDFPUfrom thethread_infointotask_struct->flags? This flag word is only accessed by "current", no special atomicity requirements.
There is still a PF_USEDFPU defined there that can be used. I'll change it to using that.
But it would be a good idea to completely split the flags that are changed externally like signals from only process local bits.
Then we could avoid the wasteful LOCK prefixes for everything local.
-Andi