tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: upreempt_pri



On 01/07/2012 12:55 PM, David Laight wrote:
On Thu, Jan 05, 2012 at 11:19:54PM +0100, Lars Heidieker wrote:
Hi,

I would like to change upreempt_pri to default to 0 as this makes
wakeups where the interrupted cpu schedules a thread on another cpu
behave like as if it where scheduled on the interrupted cpu.

Are you talking about the case where the process being woken is bound
to another cpu, or just the case where is is runnable on any cpu?


About the case that the woken LWP runs on another cpu either bound or or not.

When a condvar is signalled you don't actually want anything to
happen until the associated mutex is released, and then you need
the woken process to run on the same cpu.


Is this about kernel condvars? It makes sense to have the mutex released first. It's not about kernel preemption, the only thing changing with setting upreempt_pri to 0 is that the targeted cpu gets an IPI which in case that the targeted cpu runs kernel code is "just an IPI" and in the case of running user code it ensures that the cpu checkes the reschedule flag on returning to user space, just like the interrupted cpu would do.

This reduces the number of context switches and bouncing of data
between caches.

The count of context switches, in the sense of switching between lwp should increase only a very little bit if at all measurable, we get one ipi more for each "cross cpu wakeup" that's true. That's the trade of (as far as I see) but the system gets a lot more responsive.

Lars


Home | Main Index | Thread Index | Old Index