nameing reserved pages [1/3]
RFC PATCH 1/1 nameing reserved pages [1/3]
inline functions for naming pages.
-- Kame
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.
---
linux-2.6.12-rc2-kamezawa/include/linux/mm.h | 31 +++++++++++++++++++++++++++ 1 files changed, 31 insertions(+)
include/linux/mm.h renamed from include/linux/mm.h~name_reserved +31 -0
@@ -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
_
Hi!
Quoted 24 lines
inline functions for naming pages.
-- KameAdding
page_typedefinitions 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/memstatein following patch.Signed-off-by KAMEZAWA Hiroyuki <[email protected]>---
linux-2.6.12-rc2-kamezawa/include/linux/mm.h | 31 +++++++++++++++++++++++++++ 1 files changed, 31 insertions(+)diff -puN
include/linux/mm.h~name_reservedinclude/linux/mm.h
include/linux/mm.h static inline void put_page(struct page · line 357
Quoted 10 lines
include/linux/mm.h renamed from include/linux/mm.h~name_reserved +7
-0@@ -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 ,
~ missing e?
include/linux/mm.h static inline void put_page(struct page · line 361
Quoted 4 lines
include/linux/mm.h renamed from include/linux/mm.h~name_reserved +4
-0+ Reserved_At_Boot, + Max_Reserved_Types, + Page_Invalid = 0xff +};
You certainly use unusual naming convention here. Could we get reserved_at_boot instead? (I.e. all lowercase).
include/linux/mm.h static inline void put_page(struct page · line 369
Quoted 8 lines
include/linux/mm.h renamed from include/linux/mm.h~name_reserved +8
-0+/* +* 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) +{
Make it enum page_type type.
Pavel
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
Hi!
Quoted 2 lines · Pavel Machek
~ missing e?
Oh, it's typo :(. thanks!
Quoted 11 lines
include/linux/mm.h static inline void put_page(struct page · line 361
Quoted 6 lines
include/linux/mm.h renamed from include/linux/mm.h~name_reserved +4
-0+ Reserved_At_Boot, + Max_Reserved_Types, + Page_Invalid = 0xff +};You certainly use unusual naming convention here. Could we get
reserved_at_bootinstead? (I.e. all lowercase).
Okay.
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +2
-0+static inline void set_page_reserved(struct page *page, unsigned char type) +{Make it enum
page_typetype.
I'll do.
Thanks
-- Kame <[email protected]>