Add support for compound pages so that inc_xxxx_state() and dec_xxx_state() will increment the ZVCs by the number of base pages of the compound page. Signed-off-by: Christoph Lameter --- include/linux/vmstat.h | 5 ++--- mm/vmstat.c | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 75370ec..6d03a5a 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -234,7 +234,7 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) static inline void __inc_zone_page_state(struct page *page, enum zone_stat_item item) { - __inc_zone_state(page_zone(page), item); + __mod_zone_page_state(page_zone(page), item, compound_pages(page)); } static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item) @@ -246,8 +246,7 @@ static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item) static inline void __dec_zone_page_state(struct page *page, enum zone_stat_item item) { - atomic_long_dec(&page_zone(page)->vm_stat[item]); - atomic_long_dec(&vm_stat[item]); + __mod_zone_page_state(page_zone(page), item, -compound_pages(page)); } /* diff --git a/mm/vmstat.c b/mm/vmstat.c index c64d169..3e07215 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -225,7 +225,12 @@ void __inc_zone_state(struct zone *zone, enum zone_stat_item item) void __inc_zone_page_state(struct page *page, enum zone_stat_item item) { - __inc_zone_state(page_zone(page), item); + struct zone *z = page_zone(page); + + if (likely(!PageHead(page))) + __inc_zone_state(z, item); + else + __mod_zone_page_state(z, item, compound_pages(page)); } EXPORT_SYMBOL(__inc_zone_page_state); @@ -246,7 +251,12 @@ void __dec_zone_state(struct zone *zone, enum zone_stat_item item) void __dec_zone_page_state(struct page *page, enum zone_stat_item item) { - __dec_zone_state(page_zone(page), item); + struct zone *z = page_zone(page); + + if (likely(!PageHead(page))) + __dec_zone_state(z, item); + else + __mod_zone_page_state(z, item, -compound_pages(page)); } EXPORT_SYMBOL(__dec_zone_page_state); @@ -262,11 +272,9 @@ void inc_zone_state(struct zone *zone, enum zone_stat_item item) void inc_zone_page_state(struct page *page, enum zone_stat_item item) { unsigned long flags; - struct zone *zone; - zone = page_zone(page); local_irq_save(flags); - __inc_zone_state(zone, item); + __inc_zone_page_state(page, item); local_irq_restore(flags); } EXPORT_SYMBOL(inc_zone_page_state); -- 1.5.2.5 -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/