linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: rao.shoaib@oracle.com, linux-kernel@vger.kernel.org,
	brouer@redhat.com, linux-mm@kvack.org
Subject: Re: [PATCH] Move kfree_call_rcu() to slab_common.c
Date: Thu, 21 Dec 2017 09:06:28 -0800	[thread overview]
Message-ID: <20171221170628.GA25009@bombadil.infradead.org> (raw)
In-Reply-To: <20171221155434.GT7829@linux.vnet.ibm.com>

On Thu, Dec 21, 2017 at 07:54:34AM -0800, Paul E. McKenney wrote:
> > +/* Queue an RCU callback for lazy invocation after a grace period.
> > + * Currently there is no way of tagging the lazy RCU callbacks in the
> > + * list of pending callbacks. Until then, this function may only be
> > + * called from kfree_call_rcu().
> 
> But now we might have a way.
> 
> If the value in ->func is too small to be a valid function, RCU invokes
> a fixed function name.  This function can then look at ->func and do
> whatever it wants, for example, maintaining an array indexed by the
> ->func value that says what function to call and what else to pass it,
> including for example the slab pointer and offset.
> 
> Thoughts?

Thought 1 is that we can force functions to be quad-byte aligned on all
architectures (gcc option -falign-functions=...), so we can have more
than the 4096 different values we currently use.  We can get 63.5 bits of
information into that ->func argument if we align functions to at least
4 bytes, or 63 if we only force alignment to a 2-byte boundary.  I'm not
sure if we support any architecture other than x86 with byte-aligned
instructions.  (I'm assuming that function descriptors as used on POWER
and ia64 will also be sensibly aligned).

Thought 2 is that the slab is quite capable of getting the slab pointer
from the address of the object -- virt_to_head_page(p)->slab_cache
So sorting objects by address is as good as storing their slab caches
and offsets.

Thought 3 is that we probably don't want to overengineer this.
Just allocating a 14-entry buffer (along with an RCU head) is probably
enough to give us at least 90% of the wins that a more complex solution
would give.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-12-21 17:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21  8:19 rao.shoaib
2017-12-21 12:36 ` Matthew Wilcox
2017-12-21 17:31   ` Rao Shoaib
2017-12-22  1:39     ` Paul E. McKenney
2017-12-22  3:17       ` Rao Shoaib
2018-01-02 20:24         ` Paul E. McKenney
2017-12-21 15:54 ` Paul E. McKenney
2017-12-21 17:06   ` Matthew Wilcox [this message]
2017-12-22  1:27     ` Paul E. McKenney
2017-12-22  1:30       ` Paul E. McKenney

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=20171221170628.GA25009@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=brouer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rao.shoaib@oracle.com \
    /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