boolzone_reclaimable(struct zone *zone)
{
return zone_page_state_snapshot(zone, NR_PAGES_SCANNED) <
zone_reclaimable_pages(zone)* 6;
}
static inlineunsigned long zone_page_state_snapshot(structzone *zone,
enumzone_stat_item item)
{
long x =atomic_long_read(&zone->vm_stat[item]);
#ifdef CONFIG_SMP
int cpu;
for_each_online_cpu(cpu)
x += per_cpu_ptr(zone->pageset,cpu)->vm_stat_diff[item];
if (x < 0)
x = 0;
#endif
return x;
}
unsigned long zone_reclaimable_pages(struct zone *zone)
{
unsigned long nr;
nr = zone_page_state_snapshot(zone, NR_ACTIVE_FILE) +
zone_page_state_snapshot(zone, NR_INACTIVE_FILE) +
zone_page_state_snapshot(zone, NR_ISOLATED_FILE);
if (get_nr_swap_pages() > 0)
nr +=zone_page_state_snapshot(zone, NR_ACTIVE_ANON) +
zone_page_state_snapshot(zone, NR_INACTIVE_ANON) +
zone_page_state_snapshot(zone, NR_ISOLATED_ANON);
return nr;
}