aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2015-02-11 18:24:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-11 20:06:00 -0500
commite4b294c2d8f73af4cd41ff30638ad0e4769dc56a (patch)
tree180172b74fb439e1c4bdde668f141426bb001515 /include/linux
parentaa7ed01f93ff7e149cad46f13f66b269d59c9bc0 (diff)
mm: add fields for compound destructor and order into struct page
Currently, we use lru.next/lru.prev plus cast to access or set destructor and order of compound page. Let's replace it with explicit fields in struct page. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Jerome Marchand <jmarchan@redhat.com> Acked-by: Christoph Lameter <cl@linux.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mm.h9
-rw-r--r--include/linux/mm_types.h8
2 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 65db4aee738a..8dd4fde9d2e5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -627,29 +627,28 @@ int split_free_page(struct page *page);
627 * prototype for that function and accessor functions. 627 * prototype for that function and accessor functions.
628 * These are _only_ valid on the head of a PG_compound page. 628 * These are _only_ valid on the head of a PG_compound page.
629 */ 629 */
630typedef void compound_page_dtor(struct page *);
631 630
632static inline void set_compound_page_dtor(struct page *page, 631static inline void set_compound_page_dtor(struct page *page,
633 compound_page_dtor *dtor) 632 compound_page_dtor *dtor)
634{ 633{
635 page[1].lru.next = (void *)dtor; 634 page[1].compound_dtor = dtor;
636} 635}
637 636
638static inline compound_page_dtor *get_compound_page_dtor(struct page *page) 637static inline compound_page_dtor *get_compound_page_dtor(struct page *page)
639{ 638{
640 return (compound_page_dtor *)page[1].lru.next; 639 return page[1].compound_dtor;
641} 640}
642 641
643static inline int compound_order(struct page *page) 642static inline int compound_order(struct page *page)
644{ 643{
645 if (!PageHead(page)) 644 if (!PageHead(page))
646 return 0; 645 return 0;
647 return (unsigned long)page[1].lru.prev; 646 return page[1].compound_order;
648} 647}
649 648
650static inline void set_compound_order(struct page *page, unsigned long order) 649static inline void set_compound_order(struct page *page, unsigned long order)
651{ 650{
652 page[1].lru.prev = (void *)order; 651 page[1].compound_order = order;
653} 652}
654 653
655#ifdef CONFIG_MMU 654#ifdef CONFIG_MMU
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 07c8bd3f7b48..20ff2105b564 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -28,6 +28,8 @@ struct mem_cgroup;
28 IS_ENABLED(CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK)) 28 IS_ENABLED(CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK))
29#define ALLOC_SPLIT_PTLOCKS (SPINLOCK_SIZE > BITS_PER_LONG/8) 29#define ALLOC_SPLIT_PTLOCKS (SPINLOCK_SIZE > BITS_PER_LONG/8)
30 30
31typedef void compound_page_dtor(struct page *);
32
31/* 33/*
32 * Each physical page in the system has a struct page associated with 34 * Each physical page in the system has a struct page associated with
33 * it to keep track of whatever it is we are using the page for at the 35 * it to keep track of whatever it is we are using the page for at the
@@ -142,6 +144,12 @@ struct page {
142 struct rcu_head rcu_head; /* Used by SLAB 144 struct rcu_head rcu_head; /* Used by SLAB
143 * when destroying via RCU 145 * when destroying via RCU
144 */ 146 */
147 /* First tail page of compound page */
148 struct {
149 compound_page_dtor *compound_dtor;
150 unsigned long compound_order;
151 };
152
145#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && USE_SPLIT_PMD_PTLOCKS 153#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && USE_SPLIT_PMD_PTLOCKS
146 pgtable_t pmd_huge_pte; /* protected by page->ptl */ 154 pgtable_t pmd_huge_pte; /* protected by page->ptl */
147#endif 155#endif