Re: vmscan: shrinker->nr updates race and go wrong

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

 



On Tue, Jul 19, 2011 at 11:08:26PM +0300, Dan Carpenter wrote:
> Hi Dave,
> 
> There is a sign error in e5b94d7463e0 "vmscan: shrinker->nr updates
> race and go wrong"
> 
> mm/vmscan.c +274 shrink_slab(41)
> 	warn: unsigned 'total_scan' is never less than zero.
> 
>    268                  total_scan = nr;
>    269                  max_pass = do_shrinker_shrink(shrinker, shrink, 0);
>    270                  delta = (4 * nr_pages_scanned) / shrinker->seeks;
>    271                  delta *= max_pass;
>    272                  do_div(delta, lru_pages + 1);
>    273                  total_scan += delta;
>    274                  if (total_scan < 0) {
>                             ^^^^^^^^^^^^^^
> total_scan is unsigned so it's never less than zero here.

Obviously. You'd think a kernel build would warn about that given
that it's almost always a bug, wouldn't you?

I'll send a patch to fix it up....

Cheers,

Dave.
-- 
Dave Chinner
dchinner@xxxxxxxxxx

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]