From: Mel Gorman <mel@csn.ul.ie>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] introduce for_each_populated_zone() macro
Date: Tue, 10 Feb 2009 14:21:39 +0000 [thread overview]
Message-ID: <20090210142138.GD4023@csn.ul.ie> (raw)
In-Reply-To: <2f11576a0902100613g311f8387sb23f866c94bd48bf@mail.gmail.com>
On Tue, Feb 10, 2009 at 11:13:12PM +0900, KOSAKI Motohiro wrote:
> Hi
>
> >> +#define for_each_populated_zone(zone) \
> >> + for (zone = (first_online_pgdat())->node_zones; \
> >> + zone; \
> >> + zone = next_zone(zone)) \
> >> + if (!populated_zone(zone)) \
> >> + ; /* do nothing */ \
> >> + else
> >> +
> >> +
> >> +
> >> +
> >
> > There is tabs vs whitespace damage in there.
>
> ??
> I'm look at it again. but I don't found whitespace damage.
>
Maybe there is some oddity in my mailer, but the second part of the for
loop with "zone;" looks like a tab followed by spaces to me. Not a big
deal, probably looks better with the spaces in this case.
> > Multiple empty lines are introduced for no apparent reason.
>
> Will fix. thanks.
>
> > It's not clear why you did not use if (populated_zone(zone))
> > instead of an if/else.
>
> Good question.
> if we make following macro,
>
> #define for_each_populated_zone(zone) \
> for (zone = (first_online_pgdat())->node_zones; \
> zone; \
> zone = next_zone(zone)) \
> if (populated_zone(zone))
>
> and, writing following caller code.
>
> if (always_true_assumption)
> for_each_populated_zone(){
> /* some code */
> }
> else
> panic();
>
> expand to
>
> if (always_true_assumption)
> for()
> if (populated_zone() {
> /* some code */
> }
> else
> panic();
>
> then, memoryless node cause panic().
>
Oof, that's tricky but you're correct. The macro has to work as you suggest
or weird things can happen.
> >
> > Otherwise, I did not spot anything out of the ordinary. Nice cleanup.
>
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mel@csn.ul.ie>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] introduce for_each_populated_zone() macro
Date: Tue, 10 Feb 2009 14:21:39 +0000 [thread overview]
Message-ID: <20090210142138.GD4023@csn.ul.ie> (raw)
In-Reply-To: <2f11576a0902100613g311f8387sb23f866c94bd48bf@mail.gmail.com>
On Tue, Feb 10, 2009 at 11:13:12PM +0900, KOSAKI Motohiro wrote:
> Hi
>
> >> +#define for_each_populated_zone(zone) \
> >> + for (zone = (first_online_pgdat())->node_zones; \
> >> + zone; \
> >> + zone = next_zone(zone)) \
> >> + if (!populated_zone(zone)) \
> >> + ; /* do nothing */ \
> >> + else
> >> +
> >> +
> >> +
> >> +
> >
> > There is tabs vs whitespace damage in there.
>
> ??
> I'm look at it again. but I don't found whitespace damage.
>
Maybe there is some oddity in my mailer, but the second part of the for
loop with "zone;" looks like a tab followed by spaces to me. Not a big
deal, probably looks better with the spaces in this case.
> > Multiple empty lines are introduced for no apparent reason.
>
> Will fix. thanks.
>
> > It's not clear why you did not use if (populated_zone(zone))
> > instead of an if/else.
>
> Good question.
> if we make following macro,
>
> #define for_each_populated_zone(zone) \
> for (zone = (first_online_pgdat())->node_zones; \
> zone; \
> zone = next_zone(zone)) \
> if (populated_zone(zone))
>
> and, writing following caller code.
>
> if (always_true_assumption)
> for_each_populated_zone(){
> /* some code */
> }
> else
> panic();
>
> expand to
>
> if (always_true_assumption)
> for()
> if (populated_zone() {
> /* some code */
> }
> else
> panic();
>
> then, memoryless node cause panic().
>
Oof, that's tricky but you're correct. The macro has to work as you suggest
or weird things can happen.
> >
> > Otherwise, I did not spot anything out of the ordinary. Nice cleanup.
>
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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-02-10 14:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-10 7:39 [PATCH] introduce for_each_populated_zone() macro KOSAKI Motohiro
2009-02-10 7:39 ` KOSAKI Motohiro
2009-02-10 10:37 ` Johannes Weiner
2009-02-10 10:37 ` Johannes Weiner
2009-02-10 13:50 ` Mel Gorman
2009-02-10 13:50 ` Mel Gorman
2009-02-10 14:13 ` KOSAKI Motohiro
2009-02-10 14:13 ` KOSAKI Motohiro
2009-02-10 14:21 ` Mel Gorman [this message]
2009-02-10 14:21 ` Mel Gorman
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=20090210142138.GD4023@csn.ul.ie \
--to=mel@csn.ul.ie \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--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.