diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-04-24 14:50:36 -0400 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-10-18 07:49:39 -0400 |
commit | b424de33c42dbd03e39ca8f521126d39acb6c335 (patch) | |
tree | e97ba86596354fc1f8e88caad8ff103e3d647eea /include/linux/mm.h | |
parent | 53c36de0701f2fdda6b1d209dc89e2bad4a9c7b8 (diff) | |
download | lwn-b424de33c42dbd03e39ca8f521126d39acb6c335.tar.gz lwn-b424de33c42dbd03e39ca8f521126d39acb6c335.zip |
mm: Add arch_make_folio_accessible()
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>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 47143f3e7f0a..c28cace6fe6b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -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() */ |