[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1324056787.18942.118.camel@twins>
Date: Fri, 16 Dec 2011 18:33:07 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Pierre Habouzit <pierre.habouzit@...ersec.com>
Cc: linux-kernel@...r.kernel.org, Avi Kivity <avi@...ranet.com>,
Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH] sched: allow preempt notifiers to self-unregister.
On Fri, 2011-12-16 at 18:25 +0100, Pierre Habouzit wrote:
> On Fri, Dec 16, 2011 at 06:09:45PM +0100, Peter Zijlstra wrote:
> > On Fri, 2011-12-16 at 17:15 +0100, Pierre Habouzit wrote:
> >
> > > As a background, this need is because I have some kind of module code
> > > that uses this facility to evaluate how many of a group of threads are
> > > concurrently running (to regulate a pool of threads).
> >
> > Typically such stuff is only merged along with whomever uses it.
>
> Well for now I'm just toying with it, it's nowhere nead to be ready to
> be even shown without me having to bury my head from shame ;)
:-) no worries just keep something like this along until you're ready..
> > > Hence I install those callbacks for the thread registering themselves
> > > and want to keep them until the thread dies. Sadly I have no way to
> > > unregister those callbacks right now, but for horrible hacks (involving
> > > private delayed queues processed regularly walked to kfree() the
> > > structures referencing pids that are dead, urgh).
> >
> > kfree_rcu() is the 'normal' way to cheat your way out of this.
>
> Hmm, if when I'm scheduled "out" with the TASK_DEAD bit set, am I sure
> the _in/_out callback will never ever be called again?
Yep.
> It experimentally seems that the answer is yes, but I'm not familiar
> enough with the scheduler to be a 100% sure. If yes then kfree_rcu is
> just fine indeed and I don't need the patch, at all.
>
> If it's not "sure" then I assume I can probably use call_rcu() but that
kfree_rcu() is a convenient macro wrapped around call_rcu().
> looks like a total overkill for something that can be fully avoided with
> my patch, which incidentally, doesn't slow the typical sched path (there
> should be no callbacks and the _safe iterator exits as fast as the non
> safe iterator).
Ah, you're right, I thought it frobbed the extra variable too, but
looking at it it only does that when there's anything on the list.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists