rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: George Spelvin <lkml@SDF.ORG>
Cc: Uladzislau Rezki <urezki@gmail.com>,
	rcu@vger.kernel.org, josh@joshtriplett.org, rostedt@goodmis.org,
	mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com,
	joel@joelfernandes.org
Subject: Re: Is there a reason we don't have kvfree_rcu()?
Date: Fri, 13 Mar 2020 11:19:17 -0700	[thread overview]
Message-ID: <20200313181917.GY3199@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <20200313165219.GA1384@SDF.ORG>

On Fri, Mar 13, 2020 at 04:52:19PM +0000, George Spelvin wrote:
> On Fri, Mar 13, 2020 at 06:54:00AM -0700, Paul E. McKenney wrote:
> > I would guess that sorting them before the grace period might improve
> > cache locality and thus performance.  So it does seem like an excellent
> > thing to try, at the very least as an experiment.
> 
> That doesn't seem at all obvious.  Processing them in separate batches
> would improve I-cache locality, but you could sort them after the
> grace period just as well as before.  Especially if you have arrays of 
> 500 pointers to work with.
> 
> Indeed, one thing that seems worth trying is sorting by address, which 
> would improve D-cache locality, since you have a significant chance for 
> consecutive frees to be in the same slab or otherwise reference the same 
> overhead data structures.
> 
> Sorting by (address - VMALLOC_START) automatically groups the vallocated 
> poiners together at the front, too.  Since there's no vfree_bulk, you can 
> iterate over them until you run out, then kfree_bulk the rest.
> 
> (This idea came from a memory that bulk file operations can be 
> made faster by sorting by inode number.)
> 
> P.S. if you want to fit one extra pointer in the array, an array index
> identifying the first unused slot is distinguishable from a pointer,
> so if the last slot is a pointer, the page is full.  If it's an index,
> the page is not full.

Another approach would be to terminate with a NULL pointer, or with the
end of the array, as the case may be.

							Thanx, Paul

  reply	other threads:[~2020-03-13 18:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 16:27 Is there a reason we don't have kvfree_rcu()? George Spelvin
2020-03-12 18:11 ` Paul E. McKenney
2020-03-12 19:10   ` Uladzislau Rezki
2020-03-13  3:58     ` Joel Fernandes
2020-03-13 13:21       ` Uladzislau Rezki
2020-03-13 13:40         ` Joel Fernandes
2020-03-13  5:06     ` George Spelvin
2020-03-13 13:44       ` Uladzislau Rezki
2020-03-13 13:54       ` Paul E. McKenney
2020-03-13 16:52         ` George Spelvin
2020-03-13 18:19           ` Paul E. McKenney [this message]
2020-03-13 18:46             ` George Spelvin
2020-03-13 19:58               ` Paul E. McKenney
2020-03-12 22:24   ` George Spelvin

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=20200313181917.GY3199@paulmck-ThinkPad-P72 \
    --to=paulmck@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=lkml@SDF.ORG \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=urezki@gmail.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;
as well as URLs for NNTP newsgroup(s).