]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
mm: add hmm_data to struct page
authorMatthew Wilcox <mawilcox@microsoft.com>
Fri, 8 Jun 2018 00:09:01 +0000 (17:09 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Jun 2018 00:34:37 +0000 (17:34 -0700)
Make hmm_data an explicit member of the struct page union.

Link: http://lkml.kernel.org/r/20180518194519.3820-14-willy@infradead.org
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/hmm.h
include/linux/mm_types.h

index 2f1327c37a63d68335baa06441c3e9505ff7719c..4c92e3ba3e1684db0f23f71f949f941eb89ba56f 100644 (file)
@@ -522,9 +522,7 @@ void hmm_devmem_remove(struct hmm_devmem *devmem);
 static inline void hmm_devmem_page_set_drvdata(struct page *page,
                                               unsigned long data)
 {
-       unsigned long *drvdata = (unsigned long *)&page->pgmap;
-
-       drvdata[1] = data;
+       page->hmm_data = data;
 }
 
 /*
@@ -535,9 +533,7 @@ static inline void hmm_devmem_page_set_drvdata(struct page *page,
  */
 static inline unsigned long hmm_devmem_page_get_drvdata(const struct page *page)
 {
-       const unsigned long *drvdata = (const unsigned long *)&page->pgmap;
-
-       return drvdata[1];
+       return page->hmm_data;
 }
 
 
index 811aa0c71e1a0894cf301a63ee2ba60fa33bb2c3..99ce070e7dcb4fb14af6897d2804b671eb0ff4e2 100644 (file)
@@ -146,15 +146,15 @@ struct page {
                        spinlock_t ptl;
 #endif
                };
+               struct {        /* ZONE_DEVICE pages */
+                       /** @pgmap: Points to the hosting device page map. */
+                       struct dev_pagemap *pgmap;
+                       unsigned long hmm_data;
+                       unsigned long _zd_pad_1;        /* uses mapping */
+               };
 
                /** @rcu_head: You can use this to free a page by RCU. */
                struct rcu_head rcu_head;
-
-               /**
-                * @pgmap: For ZONE_DEVICE pages, this points to the hosting
-                * device page map.
-                */
-               struct dev_pagemap *pgmap;
        };
 
        union {         /* This union is 4 bytes in size. */