All of lore.kernel.org
 help / color / mirror / Atom feed
From: clameter@sgi.com
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Mel Gorman <mel@csn.ul.ie>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	William Lee Irwin III <wli@holomorphy.com>
Subject: [patch 3/6] compound pages: vmstat support
Date: Thu, 24 May 2007 22:17:19 -0700	[thread overview]
Message-ID: <20070525051947.298733925@sgi.com> (raw)
In-Reply-To: 20070525051716.030494061@sgi.com

[-- Attachment #1: compound_vmstat --]
[-- Type: text/plain, Size: 2842 bytes --]

Add support for compound pages so that

inc_xxxx and dec_xxx

will increment the ZVCs by the number of pages of the compound page.

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

---
 include/linux/vmstat.h |    5 ++---
 mm/vmstat.c            |   18 +++++++++++++-----
 2 files changed, 15 insertions(+), 8 deletions(-)

Index: slub/include/linux/vmstat.h
===================================================================
--- slub.orig/include/linux/vmstat.h	2007-05-24 20:37:44.000000000 -0700
+++ slub/include/linux/vmstat.h	2007-05-24 21:00:06.000000000 -0700
@@ -234,7 +234,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)
@@ -246,8 +246,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));
 }
 
 /*
Index: slub/mm/vmstat.c
===================================================================
--- slub.orig/mm/vmstat.c	2007-05-24 20:37:44.000000000 -0700
+++ slub/mm/vmstat.c	2007-05-24 21:00:06.000000000 -0700
@@ -224,7 +224,12 @@ 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);
+	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);
 
@@ -245,7 +250,12 @@ 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);
+	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);
 
@@ -261,11 +271,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);

-- 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2007-05-25  5:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-25  5:17 [patch 0/6] Compound Page Enhancements clameter
2007-05-25  5:17 ` [patch 1/6] Compound page handling enhancements clameter
2007-05-25  5:17 ` [patch 2/6] compound pages: Add new support functions clameter
2007-05-25  5:17 ` clameter [this message]
2007-05-25  5:17 ` [patch 4/6] compound pages: Use new compound vmstat functions in SLUB clameter
2007-05-25  5:17 ` [patch 5/6] compound pages: Allow use of get_page_unless_zero with compound pages clameter
2007-05-25  5:17 ` [patch 6/6] compound pages: Allow freeing of compound pages via pagevec clameter
2007-05-25  6:00 ` [patch 0/6] Compound Page Enhancements Andrew Morton
2007-05-25 13:54   ` Christoph Lameter
2007-05-25 14:03   ` Christoph Lameter
2007-05-25 17:14     ` Andrew Morton
2007-05-25 18:56       ` Christoph Lameter
2007-05-25  8:05 ` KAMEZAWA Hiroyuki
2007-05-25 13:42   ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070525051947.298733925@sgi.com \
    --to=clameter@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.