Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Breakout page_order() to internal.h to avoid special knowledge of the buddy allocator

The statistics patch later needs to know what order a free page is on the free
lists. Rather than having special knowledge of page_private() when
PageBuddy() is set, this patch places out page_order() in internal.h and adds
a VM_BUG_ON to catch using it on non-PageBuddy pages.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mel Gorman and committed by
Linus Torvalds
48f13bf3 ea3061d2

+10 -10
+10
mm/internal.h
··· 37 37 extern void fastcall __init __free_pages_bootmem(struct page *page, 38 38 unsigned int order); 39 39 40 + /* 41 + * function for dealing with page's order in buddy system. 42 + * zone->lock is already acquired when we use these. 43 + * So, we don't need atomic page->flags operations here. 44 + */ 45 + static inline unsigned long page_order(struct page *page) 46 + { 47 + VM_BUG_ON(!PageBuddy(page)); 48 + return page_private(page); 49 + } 40 50 #endif
-10
mm/page_alloc.c
··· 313 313 clear_highpage(page + i); 314 314 } 315 315 316 - /* 317 - * function for dealing with page's order in buddy system. 318 - * zone->lock is already acquired when we use these. 319 - * So, we don't need atomic page->flags operations here. 320 - */ 321 - static inline unsigned long page_order(struct page *page) 322 - { 323 - return page_private(page); 324 - } 325 - 326 316 static inline void set_page_order(struct page *page, int order) 327 317 { 328 318 set_page_private(page, order);