Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Cox
Subject:
Date: Tuesday, April 6, 2010 - 9:44 am

> Do you feel some of these situations would also benefit from some kernel 

There are cases its the best option - you are assuming for example that
the owner can get scheduled out. Eg nailing one thread per CPU in some
specialist high performance situations means they can't.


I am unsure about the approach. As Avi says knowing that the lock owner is
scheduled out allows for far better behaviour. It doesn't need complex
per lock stuff or per lock notifier entries on pre-empt either.

A given task is either pre-empted or not and in the normal case of things
you need this within a process so you've got shared pages anyway. So you
only need one instance of the 'is thread X pre-empted' bit somewhere in a
non swappable page.

That gives you something along the lines of

	runaddr = find_run_flag(lock);
	do {
		while(*runaddr == RUNNING) {
			if (trylock(lock))
				return WHOOPEE;
			cpu relax
		}
		yield (_on(thread));
	} while(*runaddr != DEAD);


which unlike blindly spinning can avoid the worst of any hit on the CPU
power and would be a bit more guided ?

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/6] futex: add futex_q static initializer, Darren Hart, (Mon Apr 5, 1:23 pm)
[PATCH 3/6] futex: refactor futex_lock_pi_atomic, Darren Hart, (Mon Apr 5, 1:23 pm)
[No subject], Ulrich Drepper, (Tue Apr 6, 7:47 am)
[No subject], Peter Zijlstra, (Tue Apr 6, 7:51 am)
[No subject], Darren Hart, (Tue Apr 6, 8:28 am)
[No subject], Peter Zijlstra, (Tue Apr 6, 8:29 am)
[No subject], Darren Hart, (Tue Apr 6, 8:33 am)
[No subject], Peter Zijlstra, (Tue Apr 6, 8:37 am)
[No subject], Avi Kivity, (Tue Apr 6, 9:06 am)
[No subject], Avi Kivity, (Tue Apr 6, 9:10 am)
[No subject], Thomas Gleixner, (Tue Apr 6, 9:14 am)
[No subject], Avi Kivity, (Tue Apr 6, 9:20 am)
[No subject], Alan Cox, (Tue Apr 6, 9:44 am)
[No subject], Alan Cox, (Tue Apr 6, 9:53 am)
[No subject], Alan Cox, (Tue Apr 6, 9:54 am)
[No subject], Thomas Gleixner, (Tue Apr 6, 9:55 am)
[No subject], Ulrich Drepper, (Tue Apr 6, 10:34 am)