* re: vmscan: shrinker->nr updates race and go wrong
@ 2011-07-19 20:08 Dan Carpenter
2011-07-20 3:53 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-07-19 20:08 UTC (permalink / raw)
To: dchinner; +Cc: open list:MEMORY MANAGEMENT
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.
275 printk(KERN_ERR "shrink_slab: %pF negative objects to "
276 "delete nr=%ld\n",
277 shrinker->shrink, total_scan);
278 total_scan = max_pass;
279 }
regards,
dan carpenter
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. 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@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: vmscan: shrinker->nr updates race and go wrong
2011-07-19 20:08 vmscan: shrinker->nr updates race and go wrong Dan Carpenter
@ 2011-07-20 3:53 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2011-07-20 3:53 UTC (permalink / raw)
To: Dan Carpenter; +Cc: open list:MEMORY MANAGEMENT
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@redhat.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. 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@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-20 3:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-19 20:08 vmscan: shrinker->nr updates race and go wrong Dan Carpenter
2011-07-20 3:53 ` Dave Chinner
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).