Re: [PATCH] syscall latency improvement #1

Paul Mackerras
2002-01-25T23:11:28Z

David Howells writes:

> The attached patch does the following to 2.5.3-pre5:
>
> * consolidates various status items that are found in the lower reaches of
> task_struct into one 32-bit word, thus allowing them to be tested
> atomically without the need to disable interrupts in entry.S.

I'm no expert on the x86 arch-specific code, but it looks to me like
you have misunderstood what is going on there. It seems to me that
you have opened up a race by testing the need_resched and sigpending
flags with interrupts enabled. The race is that you can test those
flags and find them false, and then get an interrupt that sets one or
other of those flags. You will then return to the usermode process
and not act on the need_resched or sigpending until the next
interrupt. So in fact you will reschedule / deliver the signal
eventually, but with extra latency.

In other words, the "atomic" in the comment is not about testing
need_resched and sigpending at the same time, but about making the
process of testing those flags and returning to usermode atomic.

Paul.