lkml.org 
[lkml]   [2007]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[07/17] vmstat.c: Support accounting for compound pages
Compound pages must increment the counters in terms of base pages.
If we detect a compound page then add the number of base pages that
a compound page has to the counter.

This will avoid numerous changes in the VM to fix up page accounting
as we add more support for compound pages.

Also fix up the accounting for active / inactive pages.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
include/linux/mm_inline.h | 12 ++++++------
include/linux/vmstat.h | 5 ++---
mm/vmstat.c | 8 +++-----
3 files changed, 11 insertions(+), 14 deletions(-)
Index: linux-2.6.21-rc7/mm/vmstat.c
===================================================================
--- linux-2.6.21-rc7.orig/mm/vmstat.c 2007-04-23 20:31:54.000000000 -0700
+++ linux-2.6.21-rc7/mm/vmstat.c 2007-04-23 20:31:59.000000000 -0700
@@ -223,7 +223,7 @@ void __inc_zone_state(struct zone *zone,

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));
}
EXPORT_SYMBOL(__inc_zone_page_state);

@@ -244,7 +244,7 @@ void __dec_zone_state(struct zone *zone,

void __dec_zone_page_state(struct page *page, enum zone_stat_item item)
{
- __dec_zone_state(page_zone(page), item);
+ __mod_zone_page_state(page_zone(page), item, -compound_pages(page));
}
EXPORT_SYMBOL(__dec_zone_page_state);

@@ -260,11 +260,9 @@ void inc_zone_state(struct zone *zone, e
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);
Index: linux-2.6.21-rc7/include/linux/mm_inline.h
===================================================================
--- linux-2.6.21-rc7.orig/include/linux/mm_inline.h 2007-04-23 20:31:54.000000000 -0700
+++ linux-2.6.21-rc7/include/linux/mm_inline.h 2007-04-23 20:47:16.000000000 -0700
@@ -2,28 +2,28 @@ static inline void
add_page_to_active_list(struct zone *zone, struct page *page)
{
list_add(&page->lru, &zone->active_list);
- __inc_zone_state(zone, NR_ACTIVE);
+ __inc_zone_page_state(page, NR_ACTIVE);
}

static inline void
add_page_to_inactive_list(struct zone *zone, struct page *page)
{
list_add(&page->lru, &zone->inactive_list);
- __inc_zone_state(zone, NR_INACTIVE);
+ __inc_zone_page_state(page, NR_INACTIVE);
}

static inline void
del_page_from_active_list(struct zone *zone, struct page *page)
{
list_del(&page->lru);
- __dec_zone_state(zone, NR_ACTIVE);
+ __dec_zone_page_state(page, NR_ACTIVE);
}

static inline void
del_page_from_inactive_list(struct zone *zone, struct page *page)
{
list_del(&page->lru);
- __dec_zone_state(zone, NR_INACTIVE);
+ __dec_zone_page_state(page, NR_INACTIVE);
}

static inline void
@@ -32,9 +32,9 @@ del_page_from_lru(struct zone *zone, str
list_del(&page->lru);
if (PageActive(page)) {
__ClearPageActive(page);
- __dec_zone_state(zone, NR_ACTIVE);
+ __dec_zone_page_state(page, NR_ACTIVE);
} else {
- __dec_zone_state(zone, NR_INACTIVE);
+ __dec_zone_page_state(page, NR_INACTIVE);
}
}

Index: linux-2.6.21-rc7/include/linux/vmstat.h
===================================================================
--- linux-2.6.21-rc7.orig/include/linux/vmstat.h 2007-04-23 20:33:02.000000000 -0700
+++ linux-2.6.21-rc7/include/linux/vmstat.h 2007-04-23 20:49:06.000000000 -0700
@@ -235,7 +235,7 @@ static inline void __inc_zone_state(stru
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)
@@ -247,8 +247,7 @@ static inline void __dec_zone_state(stru
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));
}

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

\
 
 \ /
  Last update: 2007-04-25 00:27    [W:1.630 / U:0.240 seconds]
©2003-2014 Jasper Spaans. Advertise on this site