lkml.org 
[lkml]   [2014]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] mm: page_alloc: Fix setting of ZONE_FAIR_DEPLETED on UP
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@leon.nu


\
 
 \ /
  Last update: 2014-09-07 09:01    [W:0.187 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site