Re: [ZVC 4/4] Inline counters for single processor configurations

From: Christoph Lameter
Date: Tue Jun 27 2006 - 14:04:42 EST


Hmmm.. i386/x86_64 do not convert the adds to incs like ia64. Therefore
one can decrease memory usage even further by using atomic_inc/dec
explicitly.

Index: linux-2.6.17-mm3/include/linux/vmstat.h
===================================================================
--- linux-2.6.17-mm3.orig/include/linux/vmstat.h 2006-06-27 03:53:05.000000000 -0700
+++ linux-2.6.17-mm3/include/linux/vmstat.h 2006-06-27 03:54:16.000000000 -0700
@@ -186,12 +186,14 @@

static inline void __inc_zone_page_state(struct page *page, enum zone_stat_item item)
{
- zone_page_state_add(1, page_zone(page), item);
+ atomic_long_inc(&page_zone(page)->vm_stat[item]);
+ atomic_long_inc(&vm_stat[item]);
}

static inline void __dec_zone_page_state(struct page *page, enum zone_stat_item item)
{
- zone_page_state_add(-1, page_zone(page), item);
+ atomic_long_dec(&page_zone(page)->vm_stat[item]);
+ atomic_long_dec(&vm_stat[item]);
}

/*
-
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/