[PATCH 3/4] buddy: explicitly identify buddy field use in struct page

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andy Whitcroft
Date: Wednesday, October 1, 2008 - 5:31 am

Explicitly define the struct page fields which buddy uses when it owns
pages.  Defines a new anonymous struct to allow additional fields to
be defined in a later patch.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Reviewed-by: Christoph Lameter <cl@linux-foundation.org>
---
 include/linux/mm_types.h |    3 +++
 mm/internal.h            |    2 +-
 mm/page_alloc.c          |    4 ++--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 995c588..906d8e0 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -70,6 +70,9 @@ struct page {
 #endif
 	    struct kmem_cache *slab;	/* SLUB: Pointer to slab */
 	    struct page *first_page;	/* Compound tail pages */
+	    struct {
+		unsigned long buddy_order;     /* buddy: free page order */
+	    };
 	};
 	union {
 		pgoff_t index;		/* Our offset within mapping. */
diff --git a/mm/internal.h b/mm/internal.h
index c0e4859..fcedcd0 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -58,7 +58,7 @@ extern void __free_pages_bootmem(struct page *page, unsigned int order);
 static inline unsigned long page_order(struct page *page)
 {
 	VM_BUG_ON(!PageBuddy(page));
-	return page_private(page);
+	return page->buddy_order;
 }
 
 extern int mlock_vma_pages_range(struct vm_area_struct *vma,
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 921c435..3a646e3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -331,7 +331,7 @@ static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags)
 
 static inline void set_page_order(struct page *page, int order)
 {
-	set_page_private(page, order);
+	page->buddy_order = order;
 	__SetPageBuddy(page);
 #ifdef CONFIG_PAGE_OWNER
 		page->order = -1;
@@ -341,7 +341,7 @@ static inline void set_page_order(struct page *page, int order)
 static inline void rmv_page_order(struct page *page)
 {
 	__ClearPageBuddy(page);
-	set_page_private(page, 0);
+	page->buddy_order = 0;
 }
 
 /*
-- 
1.6.0.1.451.gc8d31

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/4] Reclaim page capture v4, Andy Whitcroft, (Wed Oct 1, 5:30 am)
[PATCH 3/4] buddy: explicitly identify buddy field use in ..., Andy Whitcroft, (Wed Oct 1, 5:31 am)
Re: [PATCH 4/4] capture pages freed during direct reclaim ..., Christoph Lameter, (Wed Oct 1, 8:01 am)
Re: [PATCH 0/4] Reclaim page capture v4, MinChan Kim, (Wed Oct 1, 7:46 pm)
Re: [PATCH 0/4] Reclaim page capture v4, KAMEZAWA Hiroyuki, (Wed Oct 1, 11:44 pm)
Re: [PATCH 1/4] pull out the page pre-release and sanity c ..., KAMEZAWA Hiroyuki, (Thu Oct 2, 12:05 am)
Re: [PATCH 2/4] pull out zone cpuset and watermark checks ..., KAMEZAWA Hiroyuki, (Thu Oct 2, 12:05 am)
Re: [PATCH 3/4] buddy: explicitly identify buddy field use ..., KAMEZAWA Hiroyuki, (Thu Oct 2, 12:06 am)
Re: [PATCH 4/4] capture pages freed during direct reclaim ..., KAMEZAWA Hiroyuki, (Thu Oct 2, 12:24 am)
Re: [PATCH 0/4] Reclaim page capture v4, Andy Whitcroft, (Thu Oct 2, 8:04 am)
Re: [PATCH 4/4] capture pages freed during direct reclaim ..., Christoph Lameter, (Thu Oct 2, 9:29 am)
Re: [PATCH 0/4] Reclaim page capture v4, KOSAKI Motohiro, (Thu Oct 2, 8:25 pm)
Re: [PATCH 0/4] Reclaim page capture v4, KOSAKI Motohiro, (Thu Oct 2, 11:48 pm)
Re: [PATCH 4/4] capture pages freed during direct reclaim ..., Christoph Lameter, (Fri Oct 3, 5:37 am)
Re: [PATCH 0/4] Reclaim page capture v4, MinChan Kim, (Mon Oct 6, 9:29 pm)