summaryrefslogtreecommitdiff
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2021-11-25 20:15:37 +0300
committerVlastimil Babka <vbabka@suse.cz>2021-12-20 03:02:27 +0300
commit7d4203c13435c0bdae61bf16bbd0408d5b958ade (patch)
tree7ae59ad086d9903213fc6a87cbe76887a5570ada /include/linux/mm.h
parenta7904a538933c525096ca2ccde1e60d0ee62c08e (diff)
downloadlinux-7d4203c13435c0bdae61bf16bbd0408d5b958ade.tar.xz
mm: add virt_to_folio() and folio_address()
These two wrappers around their respective struct page variants will be useful in the following patches. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Roman Gushchin <guro@fb.com>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a7e4a9e7d807..4a6cf22483da 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -863,6 +863,13 @@ static inline struct page *virt_to_head_page(const void *x)
return compound_head(page);
}
+static inline struct folio *virt_to_folio(const void *x)
+{
+ struct page *page = virt_to_page(x);
+
+ return page_folio(page);
+}
+
void __put_page(struct page *page);
void put_pages_list(struct list_head *pages);
@@ -1753,6 +1760,11 @@ void page_address_init(void);
#define page_address_init() do { } while(0)
#endif
+static inline void *folio_address(const struct folio *folio)
+{
+ return page_address(&folio->page);
+}
+
extern void *page_rmapping(struct page *page);
extern struct anon_vma *page_anon_vma(struct page *page);
extern pgoff_t __page_file_index(struct page *page);