linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
From: Christoph Lameter <clameter@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, Hugh Dickins <hugh@veritas.com>,
	Con Kolivas <kernel@kolivas.org>,
	Marcelo Tosatti <marcelo@kvack.org>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	linux-mm@kvack.org, Andi Kleen <ak@suse.de>,
	Dave Chinner <dgc@sgi.com>, Christoph Lameter <clameter@sgi.com>
Subject: [PATCH 07/21] Split NR_ANON off from NR_MAPPED
Subject: zoned VM stats: Add NR_ANON
Date: Mon, 12 Jun 2006 14:13:21 -0700 (PDT)	[thread overview]
Message-ID: <20060612211321.20862.85253.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20060612211244.20862.41106.sendpatchset@schroedinger.engr.sgi.com>

The current NR_MAPPED is used by zone reclaim and the dirty load
calculation as the number of mapped pagecache pages.  However, that is not
true.  NR_MAPPED includes the mapped anonymous pages.  This patch
separates those and therefore allows an accurate tracking of the anonymous
pages per zone.

It then becomes possible to determine the number of unmapped pages
per zone and we can avoid scanning for unmapped pages if there
are none.

Also it may now be possible to determine the mapped/unmapped ratio in
get_dirty_limit.  Isnt the number of anonymous pages irrelevant in that
calculation?

Note that this will change the meaning of the number of mapped pages
reported in /proc/vmstat /proc/meminfo and in the per node statistics.
This may affect user space tools that monitor these counters!
NR_MAPPED works like NR_DIRTY.  It is only valid for pagecache pages.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>

Index: linux-2.6.17-rc6-cl/fs/proc/proc_misc.c
===================================================================
--- linux-2.6.17-rc6-cl.orig/fs/proc/proc_misc.c	2006-06-12 13:00:50.578578181 -0700
+++ linux-2.6.17-rc6-cl/fs/proc/proc_misc.c	2006-06-12 13:01:30.621020255 -0700
@@ -168,6 +168,7 @@ static int meminfo_read_proc(char *page,
 		"SwapFree:     %8lu kB\n"
 		"Dirty:        %8lu kB\n"
 		"Writeback:    %8lu kB\n"
+		"Anonymous:    %8lu kB\n"
 		"Mapped:       %8lu kB\n"
 		"Slab:         %8lu kB\n"
 		"CommitLimit:  %8lu kB\n"
@@ -191,6 +192,7 @@ static int meminfo_read_proc(char *page,
 		K(i.freeswap),
 		K(ps.nr_dirty),
 		K(ps.nr_writeback),
+		K(global_page_state(NR_ANON)),
 		K(global_page_state(NR_MAPPED)),
 		K(ps.nr_slab),
 		K(allowed),
Index: linux-2.6.17-rc6-cl/include/linux/mmzone.h
===================================================================
--- linux-2.6.17-rc6-cl.orig/include/linux/mmzone.h	2006-06-12 13:00:50.585413695 -0700
+++ linux-2.6.17-rc6-cl/include/linux/mmzone.h	2006-06-12 13:01:30.622973259 -0700
@@ -47,7 +47,8 @@ struct zone_padding {
 #endif
 
 enum zone_stat_item {
-	NR_MAPPED,	/* mapped into pagetables.
+	NR_ANON,	/* Mapped anonymous pages */
+	NR_MAPPED,	/* pagecache pages mapped into pagetables.
 			   only modified from process context */
 	NR_PAGECACHE,
 	NR_STAT_ITEMS };
Index: linux-2.6.17-rc6-cl/mm/rmap.c
===================================================================
--- linux-2.6.17-rc6-cl.orig/mm/rmap.c	2006-06-12 12:57:23.386331148 -0700
+++ linux-2.6.17-rc6-cl/mm/rmap.c	2006-06-12 13:01:30.623949761 -0700
@@ -455,7 +455,7 @@ static void __page_set_anon_rmap(struct 
 	 * nr_mapped state can be updated without turning off
 	 * interrupts because it is not modified via interrupt.
 	 */
-	__inc_zone_page_state(page, NR_MAPPED);
+	__inc_zone_page_state(page, NR_ANON);
 }
 
 /**
@@ -531,7 +531,8 @@ void page_remove_rmap(struct page *page)
 		 */
 		if (page_test_and_clear_dirty(page))
 			set_page_dirty(page);
-		__dec_zone_page_state(page, NR_MAPPED);
+		__dec_zone_page_state(page,
+				PageAnon(page) ? NR_ANON : NR_MAPPED);
 	}
 }
 
Index: linux-2.6.17-rc6-cl/mm/vmscan.c
===================================================================
--- linux-2.6.17-rc6-cl.orig/mm/vmscan.c	2006-06-12 13:01:27.580192947 -0700
+++ linux-2.6.17-rc6-cl/mm/vmscan.c	2006-06-12 13:01:30.624926263 -0700
@@ -747,7 +747,8 @@ static void shrink_active_list(unsigned 
 		 * how much memory
 		 * is mapped.
 		 */
-		mapped_ratio = (global_page_state(NR_MAPPED) * 100) /
+		mapped_ratio = ((global_page_state(NR_MAPPED) +
+				global_page_state(NR_ANON)) * 100) /
 					vm_total_pages;
 
 		/*
Index: linux-2.6.17-rc6-cl/drivers/base/node.c
===================================================================
--- linux-2.6.17-rc6-cl.orig/drivers/base/node.c	2006-06-12 13:00:50.587366699 -0700
+++ linux-2.6.17-rc6-cl/drivers/base/node.c	2006-06-12 13:01:30.625902765 -0700
@@ -71,6 +71,7 @@ static ssize_t node_read_meminfo(struct 
 		       "Node %d Writeback:    %8lu kB\n"
 		       "Node %d PageCache:    %8lu kB\n"
 		       "Node %d Mapped:       %8lu kB\n"
+		       "Node %d Anonymous:    %8lu kB\n"
 		       "Node %d Slab:         %8lu kB\n",
 		       nid, K(i.totalram),
 		       nid, K(i.freeram),
@@ -85,6 +86,7 @@ static ssize_t node_read_meminfo(struct 
 		       nid, K(ps.nr_writeback),
 		       nid, K(node_page_state(nid, NR_PAGECACHE)),
 		       nid, K(node_page_state(nid, NR_MAPPED)),
+		       nid, K(node_page_state(nid, NR_ANON)),
 		       nid, K(ps.nr_slab));
 	n += hugetlb_report_node_meminfo(nid, buf + n);
 	return n;
Index: linux-2.6.17-rc6-cl/mm/page-writeback.c
===================================================================
--- linux-2.6.17-rc6-cl.orig/mm/page-writeback.c	2006-06-12 12:57:23.386331148 -0700
+++ linux-2.6.17-rc6-cl/mm/page-writeback.c	2006-06-12 13:01:30.625902765 -0700
@@ -111,7 +111,8 @@ static void get_writeback_state(struct w
 {
 	wbs->nr_dirty = read_page_state(nr_dirty);
 	wbs->nr_unstable = read_page_state(nr_unstable);
-	wbs->nr_mapped = global_page_state(NR_MAPPED);
+	wbs->nr_mapped = global_page_state(NR_MAPPED) +
+				global_page_state(NR_ANON);
 	wbs->nr_writeback = read_page_state(nr_writeback);
 }
 
Index: linux-2.6.17-rc6-cl/mm/vmstat.c
===================================================================
--- linux-2.6.17-rc6-cl.orig/mm/vmstat.c	2006-06-12 13:01:24.304028650 -0700
+++ linux-2.6.17-rc6-cl/mm/vmstat.c	2006-06-12 13:02:08.289585892 -0700
@@ -465,6 +465,7 @@ static char *vmstat_text[] = {
 	/* Zoned VM counters */
 	"nr_mapped",
 	"nr_pagecache",
+	"nr_anon",
 
 	/* Page state */
 	"nr_dirty",

--
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:[~2006-06-12 21:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-12 21:12 [PATCH 00/21] Zoned VM counters V3 Christoph Lameter
2006-06-12 21:12 ` [PATCH 01/21] Create vmstat.c/.h from page_alloc.c/.h Christoph Lameter
2006-06-12 21:12 ` [PATCH 02/21] Basic ZVC (zoned vm counter) implementation, zoned vm counters: per zone counter functionality Christoph Lameter, Christoph Lameter
2006-06-13  5:37   ` Nick Piggin
2006-06-13 15:55     ` Christoph Lameter
2006-06-14  1:21       ` Nick Piggin
2006-06-14  5:37         ` Hugh Dickins
2006-06-14  5:53           ` Andi Kleen
2006-06-14 16:14         ` Christoph Lameter
2006-06-12 21:13 ` [PATCH 03/21] Convert nr_mapped to per zone counter, zoned vm counters: conversion of nr_mapped to per zone counter Christoph Lameter, Christoph Lameter
2006-06-12 21:13 ` [PATCH 04/21] swap_prefetch: Convert nr_mapped to ZVC Christoph Lameter
2006-06-12 23:36   ` Con Kolivas
2006-06-12 21:13 ` [PATCH 05/21] Conversion of nr_pagecache to per zone counter, zoned vm counters: conversion of nr_pagecache to per zone counter Christoph Lameter, Christoph Lameter
2006-06-12 21:13 ` [PATCH 06/21] Remove nr_mapped from scan controls structure, zoned VM stats: Remove nr_mapped from scan control Christoph Lameter, Christoph Lameter
2006-06-12 21:13 ` Christoph Lameter, Christoph Lameter [this message]
2006-06-12 21:13 ` [PATCH 08/21] swap_prefetch: Split NR_ANON off NR_MAPPED Christoph Lameter
2006-06-12 23:36   ` Con Kolivas
2006-06-12 21:13 ` [PATCH 09/21] zone_reclaim: remove /proc/sys/vm/zone_reclaim_interval, zoned vm counters: use per zone counters to remove zone_reclaim_interval Christoph Lameter, Christoph Lameter
2006-06-12 21:13 ` [PATCH 10/21] Conversion of nr_slab to per zone counter, zoned vm counters: conversion of nr_slab to per zone counter Christoph Lameter, Christoph Lameter
2006-06-12 21:13 ` [PATCH 11/21] swap_prefetch: Conversion of nr_slab to ZVC Christoph Lameter
2006-06-12 21:13 ` [PATCH 12/21] Conversion of nr_pagetables to per zone counter, zoned vm counters: conversion of nr_pagetable to per zone counter Christoph Lameter, Christoph Lameter
2006-06-12 21:13 ` [PATCH 13/21] Conversion of nr_dirty to per zone counter, zoned vm counters: conversion of nr_dirty " Christoph Lameter, Christoph Lameter
2006-06-12 21:13 ` [PATCH 14/21] swap_prefetch: Conversion of nr_dirty to ZVC Christoph Lameter
2006-06-12 23:38   ` Con Kolivas
2006-06-12 21:14 ` [PATCH 15/21] reiser4: Conversiion of nr_dirty to ZVC, reiser4: conversion of nr_dirty to per zone counter Christoph Lameter, Christoph Lameter
2006-06-12 21:14 ` [PATCH 16/21] Conversion of nr_writeback to per zone counter, zoned vm counters: conversion of nr_writeback " Christoph Lameter, Christoph Lameter
2006-06-12 21:14 ` [PATCH 17/21] swap_prefetch: Conversion of nr_writeback to ZVC, swap_prefetch: " Christoph Lameter, Christoph Lameter
2006-06-12 23:38   ` [PATCH 17/21] swap_prefetch: Conversion of nr_writeback to ZVC Con Kolivas
2006-06-12 21:14 ` [PATCH 18/21] Conversion of nr_unstable to per zone counter, zoned vm counters: conversion of nr_unstable to per zone counter Christoph Lameter, Christoph Lameter
2006-06-12 21:14 ` [PATCH 19/21] swap_prefetch: Conversion of nr_unstable to ZVC, swap_prefetch: " Christoph Lameter, Christoph Lameter
2006-06-12 23:40   ` [PATCH 19/21] swap_prefetch: Conversion of nr_unstable to ZVC Con Kolivas
2006-06-12 23:48     ` Christoph Lameter
2006-06-12 23:57       ` Con Kolivas
2006-06-12 23:59         ` Con Kolivas
2006-06-13  0:08           ` Christoph Lameter
2006-06-13  0:19             ` Con Kolivas
2006-06-12 21:14 ` [PATCH 20/21] Conversion of nr_bounce to per zone counter, zoned vm counters: conversion of nr_bounce to per zone counter Christoph Lameter, Christoph Lameter
2006-06-12 21:14 ` [PATCH 21/21] Remove useless struct wbs, zoned vm counters: remove useless writeback structure Christoph Lameter, 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=20060612211321.20862.85253.sendpatchset@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=dgc@sgi.com \
    --cc=hugh@veritas.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcelo@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox