lkml.org 
[lkml]   [2006]   [Apr]   [11]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 11 Apr 2006 01:54:40 -0600
FromAndreas Dilger <>
SubjectRe: [RFC][PATCH 1/3] per cpu counter fixes for unsigned long type counter overflow
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?

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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-04-11 07:57    [from the cache]
©2003-2008