[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 2 Feb 2012 08:34:35 -0800
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Josh Triplett <josh@...htriplett.org>
Cc: linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com,
dipankar@...ibm.com, akpm@...ux-foundation.org,
mathieu.desnoyers@...ymtl.ca, niv@...ibm.com, tglx@...utronix.de,
peterz@...radead.org, rostedt@...dmis.org, Valdis.Kletnieks@...edu,
dhowells@...hat.com, eric.dumazet@...il.com, darren@...art.com,
fweisbec@...il.com, patches@...aro.org,
"Paul E. McKenney" <paul.mckenney@...aro.org>
Subject: Re: [PATCH RFC tip/core/rcu 05/41] rcu: Avoid waking up CPUs having
only kfree_rcu() callbacks
On Wed, Feb 01, 2012 at 05:15:52PM -0800, Josh Triplett wrote:
> On Wed, Feb 01, 2012 at 11:41:23AM -0800, Paul E. McKenney wrote:
> > From: "Paul E. McKenney" <paul.mckenney@...aro.org>
> >
> > When CONFIG_RCU_FAST_NO_HZ is enabled, RCU will allow a given CPU to
> > enter dyntick-idle mode even if it still has RCU callbacks queued.
> > RCU avoids system hangs in this case by scheduling a timer for several
> > jiffies in the future. However, if all of the callbacks on that CPU
> > are from kfree_rcu(), there is no reason to wake the CPU up, as it is
> > not a problem to defer freeing of memory.
> >
> > This commit therefore tracks the number of callbacks on a given CPU
> > that are from kfree_rcu(), and avoids scheduling the timer if all of
> > a given CPU's callbacks are from kfree_rcu().
>
> Minor nit: I think it would make much more sense to track the number of
> "strict" callbacks *not* from kfree_rcu, and check for that number != 0,
> rather than tracking the number of "lazy" callbacks from kfree_rcu and
> checking for all != lazy. You can always compute one number from the
> other, but since you only ever need to know the strict count, not the
> lazy count, why not directly track the thing you care about?
I will think about this. My guess is that when I add call_rcu_lazy(),
the naming will outweigh the slowpath subtraction, but will see.
> Also, any way this could hide the new kfree_call_rcu internally rather
> than adding it as a new export? In particular, why introduce a new
> exported API only suitable for internal use or foot-shooting?
It is called from __kfree_rcu, which is a static inline in
include/linux/rcupdate.h, so needs to be exported so that modules can
use kfree_rcu().
Of course, if I take the earlier patch that removes the first
BUILD_BUG_ON() from __kfree_rcu(), then I could move __kfree_rcu()
to rcupdate.c, and then I could move the export from kfree_call_rcu()
to __kfree_rcu(). But either way I would be exporting a function that
should not be invoked directly.
My concern with the earlier patch is that someone might have something
silly like a structure with an array with an rcu_head in each element.
Calling kfree_rcu() on such a beast would be ill-advised. This might
just be me being overly paranoid, though, hence my lack of additional
response to that patch.
Thanx, Paul
--
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