From: Dave Chinner <dchinner@redhat.com>
To: Dan Carpenter <error27@gmail.com>
Cc: "open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>
Subject: Re: vmscan: shrinker->nr updates race and go wrong
Date: Wed, 20 Jul 2011 13:53:32 +1000 [thread overview]
Message-ID: <20110720035332.GC24009@devil.redhat.com> (raw)
In-Reply-To: <20110719200826.GC6445@shale.localdomain>
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>
prev parent reply other threads:[~2011-07-20 3:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-19 20:08 vmscan: shrinker->nr updates race and go wrong Dan Carpenter
2011-07-20 3:53 ` Dave Chinner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110720035332.GC24009@devil.redhat.com \
--to=dchinner@redhat.com \
--cc=error27@gmail.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.