diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2015-11-06 19:29:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-06 20:50:42 -0500 |
commit | f1e61557f0230d51a3df8d825f2c156e75563bff (patch) | |
tree | a62bd2c7d3df2b5632b667a46b55cd928dce8002 /mm/page_alloc.c | |
parent | 32e7ba1ea1f8d1f0ea4983e768f8b566770a55b3 (diff) |
mm: pack compound_dtor and compound_order into one word in struct page
The patch halves space occupied by compound_dtor and compound_order in
struct page.
For compound_order, it's trivial long -> short conversion.
For get_compound_page_dtor(), we now use hardcoded table for destructor
lookup and store its index in the struct page instead of direct pointer
to destructor. It shouldn't be a big trouble to maintain the table: we
have only two destructor and NULL currently.
This patch free up one word in tail pages for reuse. This is preparation
for the next patch.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b8d560afe266..fae1bd6f9f37 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -229,6 +229,15 @@ static char * const zone_names[MAX_NR_ZONES] = { | |||
229 | #endif | 229 | #endif |
230 | }; | 230 | }; |
231 | 231 | ||
232 | static void free_compound_page(struct page *page); | ||
233 | compound_page_dtor * const compound_page_dtors[] = { | ||
234 | NULL, | ||
235 | free_compound_page, | ||
236 | #ifdef CONFIG_HUGETLB_PAGE | ||
237 | free_huge_page, | ||
238 | #endif | ||
239 | }; | ||
240 | |||
232 | int min_free_kbytes = 1024; | 241 | int min_free_kbytes = 1024; |
233 | int user_min_free_kbytes = -1; | 242 | int user_min_free_kbytes = -1; |
234 | 243 | ||
@@ -458,7 +467,7 @@ void prep_compound_page(struct page *page, unsigned long order) | |||
458 | int i; | 467 | int i; |
459 | int nr_pages = 1 << order; | 468 | int nr_pages = 1 << order; |
460 | 469 | ||
461 | set_compound_page_dtor(page, free_compound_page); | 470 | set_compound_page_dtor(page, COMPOUND_PAGE_DTOR); |
462 | set_compound_order(page, order); | 471 | set_compound_order(page, order); |
463 | __SetPageHead(page); | 472 | __SetPageHead(page); |
464 | for (i = 1; i < nr_pages; i++) { | 473 | for (i = 1; i < nr_pages; i++) { |