Messages in this thread | | | Date | Mon, 9 Apr 2012 11:45:39 -0700 | From | "Paul E. McKenney" <> | Subject | Re: semaphore and mutex in current Linux kernel (3.2.2) |
| |
On Fri, Apr 06, 2012 at 05:47:28PM +0000, Chen, Dennis (SRDC SW) wrote: > On Fri, Apr 6, 2012 at 6:10 PM, Clemens Ladisch <clemens@ladisch.de> wrote: > > Chen, Dennis (SRDC SW) wrote: > >> On Thu, Apr 5, 2012 at 10:15 PM, Clemens Ladisch <clemens@ladisch.de> wrote: > >> > >> I guess this is related with RCU component, but I don't found the right place where the code > >> Located yet. > > > > "On the internet, nobody can hear you being subtle." > > > > If some other process wants to run on the same CPU, needs_resched() is set. > > (This might happen to make the cursor blink, for keyboard input, or when > > somebody starts a rogue process like ps.) > > > > Hmm, I forget that in each timer interrupt, __rcu_pending() will be called, it will call > set_need_resched() to set the TIF_NEED_RESCHED in some condition... > The optimization of mutex work closely with rcu, so fantastic!
I must confess that you all lost me on this one.
There is a call to set_need_resched() in __rcu_pending(), which is invoked when the current CPU has not yet responded to a non-preemptible RCU grace period for some time. However, in the common case where the CPUs all respond in reasonable time, __rcu_pending() will never call set_need_resched().
However, we really do not want to call set_need_resched() on every call to __rcu_pending(). There is almost certainly a better solution to any problem that might be solved by a per-jiffy call to set_need_resched().
So, what are you really trying to do?
Thanx, Paul
| |