Re: [RFC][PATCH 1/3] per cpu counter fixes for unsigned long type counter overflow

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

 



On Tue, 2006-04-11 at 01:54 -0600, Andreas Dilger wrote:
> On Apr 10, 2006  18:09 -0700, Mingming Cao wrote:
> > +static void __percpu_counter_mod(struct percpu_counter *fbc, long amount,
> > +				int ul_overflow_check)
> >  {
> > +		 *  Before updating the global counter, if we detect the
> > +		 *  updated new value will cause overflow, then we should not
> > +		 *  do the update from this local counter at this moment. (i.e.
> > +		 *  the local counter will not be cleared right now). The update
> > +		 *  will be deferred at some point until either other local
> > +		 *  counter updated the global counter first, or the local
> > +		 *  counter's value will not cause global counter overflow.
> 
> Wouldn't it be better to update the counter by the maximum amount possible
> to avoid overflow/underflow?
> 

Yep. Thanks for pointing this out.:)

Mingming
> Cheers, Andreas
> --
> Andreas Dilger
> Principal Software Engineer
> Cluster File Systems, Inc.
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux