lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090611192600.6D50.A69D9226@jp.fujitsu.com>
Date:	Thu, 11 Jun 2009 19:26:48 +0900 (JST)
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	linux-mm <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>
Cc:	kosaki.motohiro@...fujitsu.com, Mel Gorman <mel@....ul.ie>,
	Wu Fengguang <fengguang.wu@...el.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH for mmotm 2/5] 

Changes since Wu's original patch
  - adding vmstat
  - rename NR_TMPFS_MAPPED to NR_SWAP_BACKED_FILE_MAPPED


----------------------
Subject: [PATCH] introduce NR_SWAP_BACKED_FILE_MAPPED zone stat

Desirable zone reclaim implementaion want to know the number of
file-backed and unmapped pages.

Thus, we need to know number of swap-backed mapped pages for
calculate above number.


Cc: Mel Gorman <mel@....ul.ie>
Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
---
 include/linux/mmzone.h |    2 ++
 mm/rmap.c              |    7 +++++++
 mm/vmstat.c            |    1 +
 3 files changed, 10 insertions(+)

Index: b/include/linux/mmzone.h
===================================================================
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -88,6 +88,8 @@ enum zone_stat_item {
 	NR_ANON_PAGES,	/* Mapped anonymous pages */
 	NR_FILE_MAPPED,	/* pagecache pages mapped into pagetables.
 			   only modified from process context */
+	NR_SWAP_BACKED_FILE_MAPPED, /* Similar to NR_FILE_MAPPED. but
+				       only account swap-backed pages */
 	NR_FILE_PAGES,
 	NR_FILE_DIRTY,
 	NR_WRITEBACK,
Index: b/mm/rmap.c
===================================================================
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -829,6 +829,10 @@ void page_add_file_rmap(struct page *pag
 {
 	if (atomic_inc_and_test(&page->_mapcount)) {
 		__inc_zone_page_state(page, NR_FILE_MAPPED);
+		if (PageSwapBacked(page))
+			__inc_zone_page_state(page,
+					      NR_SWAP_BACKED_FILE_MAPPED);
+
 		mem_cgroup_update_mapped_file_stat(page, 1);
 	}
 }
@@ -884,6 +888,9 @@ void page_remove_rmap(struct page *page)
 		__dec_zone_page_state(page, NR_ANON_PAGES);
 	} else {
 		__dec_zone_page_state(page, NR_FILE_MAPPED);
+		if (PageSwapBacked(page))
+			__dec_zone_page_state(page,
+					NR_SWAP_BACKED_FILE_MAPPED);
 	}
 	mem_cgroup_update_mapped_file_stat(page, -1);
 	/*
Index: b/mm/vmstat.c
===================================================================
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -633,6 +633,7 @@ static const char * const vmstat_text[] 
 	"nr_mlock",
 	"nr_anon_pages",
 	"nr_mapped",
+	"nr_swap_backed_file_mapped",
 	"nr_file_pages",
 	"nr_dirty",
 	"nr_writeback",


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ