Re: [PATCH] introduce for_each_populated_zone() macro

From: KOSAKI Motohiro
Date: Tue Feb 10 2009 - 09:13:24 EST


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.

> 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().


>
> Otherwise, I did not spot anything out of the ordinary. Nice cleanup.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/