rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: rcu@vger.kernel.org
Subject: Re: SRCU question
Date: Sun, 15 Nov 2020 20:25:25 -0500	[thread overview]
Message-ID: <20201116012525.GB3655723@moria.home.lan> (raw)
In-Reply-To: <20201115205339.GN3249@paulmck-ThinkPad-P72>

On Sun, Nov 15, 2020 at 12:53:39PM -0800, Paul E. McKenney wrote:
> On Sun, Nov 15, 2020 at 03:35:51PM -0500, Kent Overstreet wrote:
> > Yeah. My one quibble is, instead of having to call poll_state_synchronize_srcu()
> > on every cookie - would it be possible to get function that returns a cookie we
> > can compare against (i.e. with time_after())? I'm going to be use this in the
> > shrinker where we have to walk and check potentially tens of thousands of
> > objects.
> 
> If the cookies compare equal, poll_state_synchronize_srcu() will treat
> them the same.  If that does not help, could you please show me a code
> snippet illustrating what you would like to do?
> 
> (Yes, even if equality comparison works, I probably need to give you
> an API member just in case the nature of grace-period sequence numbers
> changes in the future.)

Having just looked at your code - I think it's fine as is. I wouldn't complain
if it was a static inline, though.

> 
> > > Oh, and due to historical inertia, Tiny SRCU's grace-period sequence
> > > number is only 16 bits.  I can change this easily, but I need to know
> > > that it is a real problem for you before I can do so.
> > > 
> > > The potential problem for you is that if you let a given cookie lie
> > > dormant for 16384 grace periods, it will take another 16385 grace
> > > periods for get_state_synchronize_srcu() to say that a grace period
> > > has elapsed.
> > > 
> > > In contrast, Tree SRCU's grace-period sequence number is either 32 bits
> > > or 64 bits, depending on the size of unsized long.
> > 
> > It's not something I'd lose sleep over, but I think it could be. If there isn't
> > memory pressure, then the shrinker won't be running and we won't be freeing the
> > objects with the oldest cookies, but freeing them internally will be creating
> > new grace periods - but if I make sure we're reusing objects in LIFO order would
> > also work against the shrinker actually being able to free any objects, so not
> > sure I want to do that...
> 
> OK, I will leave it, at least until you tell me otherwise.
> 
> I probably need to add a warning to the header comment, though...
> 
> 							Thanx, Paul

Thanks! 

  reply	other threads:[~2020-11-16  1:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 20:15 SRCU question Kent Overstreet
2020-11-15 20:11 ` Paul E. McKenney
2020-11-15 20:20   ` Paul E. McKenney
2020-11-15 20:35     ` Kent Overstreet
2020-11-15 20:53       ` Paul E. McKenney
2020-11-16  1:25         ` Kent Overstreet [this message]
2020-11-16  4:14           ` 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=20201116012525.GB3655723@moria.home.lan \
    --to=kent.overstreet@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    /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).