public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Kernel RCU: shrink the size of the struct rcu_head
Date: Tue, 20 Oct 2009 15:07:28 -0700	[thread overview]
Message-ID: <20091020220728.GA6174@linux.vnet.ibm.com> (raw)
In-Reply-To: <20091018232918.GA7385@Krystal>

On Sun, Oct 18, 2009 at 07:29:18PM -0400, Mathieu Desnoyers wrote:
> Hi Paul,
> 
> I noticed that you already discussed the possibility of shrinking the
> struct rcu_head by removing the function pointer.
> (http://kernel.org/pub/linux/kernel/people/paulmck/rcutodo.html)
> 
> The ideas brought in so far require having per-callback lists, which
> involves a bit of management overhead and don't permit keeping the
> call_rcu() in cpu order.

But please note that this is on the "Possibly Dubious Changes" list.  ;-)

> You might want to look into the Userspace RCU urcu-defer.c
> implementation, where I perform pointer encoding to compact the usual
> case, expected to be the same callback passed as parameter multiple
> times in a row to call_rcu(). This is very typical with multiple free()
> calls for different data structures next to each other.
> 
> This typically keeps the size of the information to encode per callback
> down to a minimum: the size of a single pointer. It would be good to
> trace the kernel usage of call_rcu() to see if my assumption holds.
> 
> I just thought I should tell you before you start looking at this
> issue further.

So the idea is to maintain a per-CPU queue of function pointers, but
with the pointers on this queue encoded to save space, correct?  If I
understand correctly, the user-level rcu-defer implementation relies on
the following:

1.	It is illegal to call _rcu_defer_queue() within an RCU read-side
	critical section (due to the call to rcu_defer_barrier_thread()
	which in turn calls synchronize_rcu().  This is necessary to
	handle queue overflow.  (Which appears to be why you introduce
	a new API, as it is legal to invoke call_rcu() from within an
	RCU read-side critical section.)

2.	It is OK to wait for a grace period when a thread calls
	rcu_defer_unregister_thread() while exiting.  In the kernel,
	this is roughly equivalent to the CPU_DYING notifier, which
	cannot block, thus cannot wait for a grace period.

	I could imagine copying the per-CPU buffer somewhere, though
	my experience with the RCU/CPU-hotplug interface does not
	encourage me in this direction.  ;-)

							Thanx, Paul

  reply	other threads:[~2009-10-20 22:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-18 23:29 Kernel RCU: shrink the size of the struct rcu_head Mathieu Desnoyers
2009-10-20 22:07 ` Paul E. McKenney [this message]
2009-10-21 14:53   ` Mathieu Desnoyers
2009-10-23  0:40     ` Paul E. McKenney
2009-10-23 12:29       ` Mathieu Desnoyers
2009-10-23 16:22         ` Paul E. McKenney
2009-10-23 17:41           ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091020220728.GA6174@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox