From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Mel Gorman <mel@csn.ul.ie>
Cc: kosaki.motohiro@jp.fujitsu.com,
Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>,
Christoph Lameter <cl@linux-foundation.org>,
Wu Fengguang <fengguang.wu@intel.com>,
linuxram@us.ibm.com, linux-mm <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] vmscan: Fix use of delta in zone_pagecache_reclaimable()
Date: Tue, 16 Jun 2009 18:41:00 +0900 (JST) [thread overview]
Message-ID: <20090616184030.99A9.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <1245064482-19245-2-git-send-email-mel@csn.ul.ie>
> zone_pagecache_reclaimable() works out how many pages are in a state
> that zone_reclaim() can reclaim based on the current zone_reclaim_mode.
> As part of this, it calculates a delta to the number of unmapped pages.
> The code was meant to check delta would not cause underflows and then apply
> it but it got accidentally removed.
>
> This patch properly uses delta. It's excessively paranoid at the moment
> because it's impossible to underflow but the current form will make future
> patches to zone_pagecache_reclaimable() fixing any other scan-heuristic
> breakage easier to read and acts as self-documentation reminding authors
> of future patches to consider underflow.
>
> This is a fix to patch
> vmscan-properly-account-for-the-number-of-page-cache-pages-zone_reclaim-can-reclaim.patch
> and they should be merged together.
>
> Signed-off-by: Mel Gorman <mel@csn.ul.ie>
> ---
> mm/vmscan.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 026f452..bd8e3ed 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2398,7 +2398,11 @@ static long zone_pagecache_reclaimable(struct zone *zone)
> if (!(zone_reclaim_mode & RECLAIM_WRITE))
> delta += zone_page_state(zone, NR_FILE_DIRTY);
>
> - return nr_pagecache_reclaimable;
> + /* Watch for any possible underflows due to delta */
> + if (unlikely(delta > nr_pagecache_reclaimable))
> + delta = nr_pagecache_reclaimable;
> +
> + return nr_pagecache_reclaimable - delta;
> }
looks good. thanks.
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2009-06-16 9:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-15 11:14 [PATCH 0/2] Two fixes for patch vmscan-properly-account-for-the-number-of-page-cache-pages-zone_reclaim-can-reclaim.patch Mel Gorman
2009-06-15 11:14 ` [PATCH 1/2] vmscan: Fix use of delta in zone_pagecache_reclaimable() Mel Gorman
2009-06-16 9:41 ` KOSAKI Motohiro [this message]
2009-06-15 11:14 ` [PATCH 2/2] mm: Fix documentation of min_unmapped_ratio Mel Gorman
2009-06-16 9:41 ` KOSAKI Motohiro
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=20090616184030.99A9.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxram@us.ibm.com \
--cc=mel@csn.ul.ie \
--cc=riel@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox