Re: [PATCH] mm: page_alloc: Fix setting of ZONE_FAIR_DEPLETED on UP

From: Leon Romanovsky
Date: Sun Sep 07 2014 - 02:33:01 EST


Hi Mel,
> __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order));
> - if (zone_page_state(zone, NR_ALLOC_BATCH) == 0 &&
> + if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0 &&
zone_page_state is declared to return unsigned long value [1], so it
should never be below 0.
So interesting question: what zone_page_state will return for negative
atomic_long_read(&zone->vm_stat[item]) ?

130 static inline unsigned long zone_page_state(struct zone *zone,
131 enum zone_stat_item item)
132 {
133 long x = atomic_long_read(&zone->vm_stat[item]);
134 #ifdef CONFIG_SMP
135 if (x < 0)
136 x = 0;
137 #endif
138 return x;
139 }

[1] https://git.kernel.org/cgit/linux/kernel/git/mhocko/mm.git/tree/include/linux/vmstat.h#n130

--
Leon Romanovsky | Independent Linux Consultant
www.leon.nu | leon@xxxxxxx
--
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/