Re: SRCU question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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! 



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux