public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] nameing reserved pages [1/3]
@ 2005-04-20 12:08 KAMEZAWA Hiroyuki
  2005-04-20 21:10 ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: KAMEZAWA Hiroyuki @ 2005-04-20 12:08 UTC (permalink / raw)
  To: linux-kernel, Dave Hansen, Hariprasad Nellitheertha [imap]

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

inline functions for naming pages.
-- Kame

[-- Attachment #2: name_reserved.patch --]
[-- Type: text/plain, Size: 1804 bytes --]


Adding page_type definitions and funcs for naming reserved pages.

Reserved page's information is stored into page->private.

This is a weak naming method and anyone can overwrite it. 

This information is used in /dev/memstate in following patch.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>


---

 linux-2.6.12-rc2-kamezawa/include/linux/mm.h |   31 +++++++++++++++++++++++++++
 1 files changed, 31 insertions(+)

diff -puN include/linux/mm.h~name_reserved include/linux/mm.h
--- linux-2.6.12-rc2/include/linux/mm.h~name_reserved	2005-04-20 09:37:48.000000000 +0900
+++ linux-2.6.12-rc2-kamezawa/include/linux/mm.h	2005-04-20 10:38:01.000000000 +0900
@@ -348,6 +348,37 @@ static inline void put_page(struct page 
 #endif		/* CONFIG_HUGETLB_PAGE */
 
 /*
+ * Type of Pages. This is used in /dev/memstate.
+ * value range is 0-255.
+ */
+enum page_type {
+	Page_Common = 0,
+	Min_Reserved_Types = 1,
+	Rserved_Unknwon = 1,
+	Reserved_At_Boot,
+	Max_Reserved_Types,
+	Page_Invalid = 0xff
+};
+/*
+ * Basically, page->private has no meaning without PG_private.
+ * Here, we use page->private for PG_reserved pages to record type of a page.
+ * Because a page is reserved, anyone will not modify page->private.
+ * When it is freed, page->private will be overwritten by some code.
+ */
+static inline void set_page_reserved(struct page *page, unsigned char type)
+{
+	SetPageReserved(page);
+	page->private = type;
+}
+
+static inline unsigned char reserved_page_type(struct page *page)
+{
+	if (!PageReserved(page))
+		return 0;
+	return (unsigned char)page->private;
+}
+
+/*
  * Multiple processes may "see" the same page. E.g. for untouched
  * mappings of /dev/null, all processes see the same page full of
  * zeroes, and text pages of executables and shared libraries have

_

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-20 23:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-20 12:08 [RFC][PATCH] nameing reserved pages [1/3] KAMEZAWA Hiroyuki
2005-04-20 21:10 ` Pavel Machek
2005-04-20 23:54   ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox