From: Wu Fengguang <fengguang.wu@intel.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>,
Christoph Lameter <cl@linux-foundation.org>
Subject: Re: [PATCH 1/4] vmscan: change the number of the unmapped files in zone reclaim
Date: Mon, 18 May 2009 11:53:19 +0800 [thread overview]
Message-ID: <20090518035319.GA7940@localhost> (raw)
In-Reply-To: <2f11576a0905172035k3f26b8d6r84af555a94b1d70e@mail.gmail.com>
On Mon, May 18, 2009 at 11:35:31AM +0800, KOSAKI Motohiro wrote:
> >> --- a/mm/vmscan.c
> >> +++ b/mm/vmscan.c
> >> @@ -2397,6 +2397,7 @@ static int __zone_reclaim(struct zone *z
> >> .isolate_pages = isolate_pages_global,
> >> };
> >> unsigned long slab_reclaimable;
> >> + long nr_unmapped_file_pages;
> >>
> >> disable_swap_token();
> >> cond_resched();
> >> @@ -2409,9 +2410,11 @@ static int __zone_reclaim(struct zone *z
> >> reclaim_state.reclaimed_slab = 0;
> >> p->reclaim_state = &reclaim_state;
> >>
> >> - if (zone_page_state(zone, NR_FILE_PAGES) -
> >> - zone_page_state(zone, NR_FILE_MAPPED) >
> >> - zone->min_unmapped_pages) {
> >> + nr_unmapped_file_pages = zone_page_state(zone, NR_INACTIVE_FILE) +
> >> + zone_page_state(zone, NR_ACTIVE_FILE) -
> >> + zone_page_state(zone, NR_FILE_MAPPED);
> >
> > This can possibly go negative.
>
> Is this a problem?
> negative value mean almost pages are mapped. Thus
>
> (nr_unmapped_file_pages > zone->min_unmapped_pages) => 0
>
> is ok, I think.
I wonder why you didn't get a gcc warning, because zone->min_unmapped_pages
is a "unsigned long".
Anyway, add a simple note to the code if it works *implicitly*?
Thanks,
Fengguang
> >
> >> + if (nr_unmapped_file_pages > zone->min_unmapped_pages) {
> >> /*
> >> * Free memory by calling shrink zone with increasing
> >> * priorities until we have enough memory freed.
WARNING: multiple messages have this Message-ID (diff)
From: Wu Fengguang <fengguang.wu@intel.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>,
Christoph Lameter <cl@linux-foundation.org>
Subject: Re: [PATCH 1/4] vmscan: change the number of the unmapped files in zone reclaim
Date: Mon, 18 May 2009 11:53:19 +0800 [thread overview]
Message-ID: <20090518035319.GA7940@localhost> (raw)
In-Reply-To: <2f11576a0905172035k3f26b8d6r84af555a94b1d70e@mail.gmail.com>
On Mon, May 18, 2009 at 11:35:31AM +0800, KOSAKI Motohiro wrote:
> >> --- a/mm/vmscan.c
> >> +++ b/mm/vmscan.c
> >> @@ -2397,6 +2397,7 @@ static int __zone_reclaim(struct zone *z
> >> A A A A A A A .isolate_pages = isolate_pages_global,
> >> A A A };
> >> A A A unsigned long slab_reclaimable;
> >> + A A long nr_unmapped_file_pages;
> >>
> >> A A A disable_swap_token();
> >> A A A cond_resched();
> >> @@ -2409,9 +2410,11 @@ static int __zone_reclaim(struct zone *z
> >> A A A reclaim_state.reclaimed_slab = 0;
> >> A A A p->reclaim_state = &reclaim_state;
> >>
> >> - A A if (zone_page_state(zone, NR_FILE_PAGES) -
> >> - A A A A A A zone_page_state(zone, NR_FILE_MAPPED) >
> >> - A A A A A A zone->min_unmapped_pages) {
> >> + A A nr_unmapped_file_pages = zone_page_state(zone, NR_INACTIVE_FILE) +
> >> + A A A A A A A A A A A A A A A zone_page_state(zone, NR_ACTIVE_FILE) -
> >> + A A A A A A A A A A A A A A A zone_page_state(zone, NR_FILE_MAPPED);
> >
> > This can possibly go negative.
>
> Is this a problem?
> negative value mean almost pages are mapped. Thus
>
> (nr_unmapped_file_pages > zone->min_unmapped_pages) => 0
>
> is ok, I think.
I wonder why you didn't get a gcc warning, because zone->min_unmapped_pages
is a "unsigned long".
Anyway, add a simple note to the code if it works *implicitly*?
Thanks,
Fengguang
> >
> >> + A A if (nr_unmapped_file_pages > zone->min_unmapped_pages) {
> >> A A A A A A A /*
> >> A A A A A A A A * Free memory by calling shrink zone with increasing
> >> A A A A A A A A * priorities until we have enough memory freed.
--
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-05-18 3:53 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-13 3:06 [PATCH 0/4] various zone_reclaim cleanup KOSAKI Motohiro
2009-05-13 3:06 ` KOSAKI Motohiro
2009-05-13 3:06 ` [PATCH 1/4] vmscan: change the number of the unmapped files in zone reclaim KOSAKI Motohiro
2009-05-13 3:06 ` KOSAKI Motohiro
2009-05-13 13:31 ` Rik van Riel
2009-05-13 13:31 ` Rik van Riel
2009-05-14 19:52 ` Christoph Lameter
2009-05-14 19:52 ` Christoph Lameter
2009-05-18 3:15 ` Wu Fengguang
2009-05-18 3:15 ` Wu Fengguang
2009-05-18 3:35 ` KOSAKI Motohiro
2009-05-18 3:35 ` KOSAKI Motohiro
2009-05-18 3:53 ` Wu Fengguang [this message]
2009-05-18 3:53 ` Wu Fengguang
2009-05-19 1:11 ` KOSAKI Motohiro
2009-05-19 1:11 ` KOSAKI Motohiro
2009-05-13 3:06 ` [PATCH 2/4] vmscan: drop PF_SWAPWRITE from zone_reclaim KOSAKI Motohiro
2009-05-13 3:06 ` KOSAKI Motohiro
2009-05-13 13:35 ` Rik van Riel
2009-05-13 13:35 ` Rik van Riel
2009-05-14 19:57 ` Christoph Lameter
2009-05-14 19:57 ` Christoph Lameter
2009-05-18 3:33 ` Wu Fengguang
2009-05-18 3:33 ` Wu Fengguang
2009-05-13 3:07 ` [PATCH 3/4] vmscan: zone_reclaim use may_swap KOSAKI Motohiro
2009-05-13 3:07 ` KOSAKI Motohiro
2009-05-13 11:26 ` Johannes Weiner
2009-05-13 11:26 ` Johannes Weiner
2009-05-13 14:43 ` Rik van Riel
2009-05-13 14:43 ` Rik van Riel
2009-05-14 19:59 ` Christoph Lameter
2009-05-14 19:59 ` Christoph Lameter
2009-05-18 3:35 ` Wu Fengguang
2009-05-18 3:35 ` Wu Fengguang
2009-05-13 3:08 ` [PATCH 4/4] zone_reclaim_mode is always 0 by default KOSAKI Motohiro
2009-05-13 3:08 ` KOSAKI Motohiro
2009-05-13 14:47 ` Rik van Riel
2009-05-13 14:47 ` Rik van Riel
2009-05-14 8:20 ` KOSAKI Motohiro
2009-05-14 8:20 ` KOSAKI Motohiro
2009-05-14 11:48 ` Robin Holt
2009-05-14 11:48 ` Robin Holt
2009-05-14 12:02 ` KOSAKI Motohiro
2009-05-14 12:02 ` KOSAKI Motohiro
2009-05-13 15:22 ` Robin Holt
2009-05-13 15:22 ` Robin Holt
2009-05-14 20:05 ` Christoph Lameter
2009-05-14 20:05 ` Christoph Lameter
2009-05-14 20:23 ` Rik van Riel
2009-05-14 20:23 ` Rik van Riel
2009-05-14 20:31 ` Christoph Lameter
2009-05-14 20:31 ` Christoph Lameter
2009-05-15 1:02 ` KOSAKI Motohiro
2009-05-15 1:02 ` KOSAKI Motohiro
2009-05-15 10:51 ` Robin Holt
2009-05-15 10:51 ` Robin Holt
2009-05-19 2:53 ` KOSAKI Motohiro
2009-05-19 2:53 ` KOSAKI Motohiro
2009-05-20 14:00 ` Robin Holt
2009-05-20 14:00 ` Robin Holt
2009-05-21 2:44 ` KOSAKI Motohiro
2009-05-21 2:44 ` KOSAKI Motohiro
2009-05-21 13:31 ` Christoph Lameter
2009-05-21 13:31 ` Christoph Lameter
2009-05-21 13:57 ` Robin Holt
2009-05-21 13:57 ` Robin Holt
2009-05-24 13:44 ` KOSAKI Motohiro
2009-05-24 13:44 ` KOSAKI Motohiro
2009-05-15 18:01 ` Christoph Lameter
2009-05-15 18:01 ` Christoph Lameter
2009-05-18 3:49 ` Wu Fengguang
2009-05-18 3:49 ` Wu Fengguang
2009-05-19 1:16 ` Zhang, Yanmin
2009-05-19 1:16 ` Zhang, Yanmin
2009-05-19 2:53 ` KOSAKI Motohiro
2009-05-19 2:53 ` KOSAKI Motohiro
2009-05-19 2:57 ` KOSAKI Motohiro
2009-05-19 2:57 ` KOSAKI Motohiro
2009-05-19 3:38 ` Zhang, Yanmin
2009-05-19 3:38 ` Zhang, Yanmin
2009-05-19 4:30 ` KOSAKI Motohiro
2009-05-19 4:30 ` KOSAKI Motohiro
2009-05-19 5:06 ` Zhang, Yanmin
2009-05-19 5:06 ` Zhang, Yanmin
2009-05-19 7:09 ` KOSAKI Motohiro
2009-05-19 7:09 ` KOSAKI Motohiro
2009-05-19 7:15 ` Zhang, Yanmin
2009-05-19 7:15 ` Zhang, Yanmin
2009-05-18 9:09 ` Wu Fengguang
2009-05-18 9:09 ` Wu Fengguang
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=20090518035319.GA7940@localhost \
--to=fengguang.wu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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 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.