]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm: Add arch_make_folio_accessible()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 24 Apr 2021 18:50:36 +0000 (14:50 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 18 Oct 2021 11:49:39 +0000 (07:49 -0400)
As a default implementation, call arch_make_page_accessible n times.
If an architecture can do better, it can override this.

Also move the default implementation of arch_make_page_accessible()
from gfp.h to mm.h.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/gfp.h
include/linux/mm.h

index 55b2ec1f965a50c70d0ffd285325b25b8534a38c..dc5ff40608ce903e4485a725630805ca9b0a7f29 100644 (file)
@@ -520,12 +520,6 @@ static inline void arch_free_page(struct page *page, int order) { }
 #ifndef HAVE_ARCH_ALLOC_PAGE
 static inline void arch_alloc_page(struct page *page, int order) { }
 #endif
-#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE
-static inline int arch_make_page_accessible(struct page *page)
-{
-       return 0;
-}
-#endif
 
 struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid,
                nodemask_t *nodemask);
index 47143f3e7f0a4e9a42f680d1b0f112c5a940c9a6..c28cace6fe6b7b7306acf3bc5201d88232378407 100644 (file)
@@ -1734,6 +1734,29 @@ static inline size_t folio_size(struct folio *folio)
        return PAGE_SIZE << folio_order(folio);
 }
 
+#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE
+static inline int arch_make_page_accessible(struct page *page)
+{
+       return 0;
+}
+#endif
+
+#ifndef HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE
+static inline int arch_make_folio_accessible(struct folio *folio)
+{
+       int ret;
+       long i, nr = folio_nr_pages(folio);
+
+       for (i = 0; i < nr; i++) {
+               ret = arch_make_page_accessible(folio_page(folio, i));
+               if (ret)
+                       break;
+       }
+
+       return ret;
+}
+#endif
+
 /*
  * Some inline functions in vmstat.h depend on page_zone()
  */