summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2021-04-12 23:45:17 +0300
committerMatthew Wilcox (Oracle) <willy@infradead.org>2021-09-27 16:27:31 +0300
commitdd10ab049beb479dc83bb14a7b5cd68c363983ce (patch)
tree954b257996e8d30144667ee4a15f97d1c0a34dad /include
parent6abbaa5b01730a1f0883d199cf5a90ae5c5dccea (diff)
downloadlinux-dd10ab049beb479dc83bb14a7b5cd68c363983ce.tar.xz
mm: Add folio_mapped()
This function is the equivalent of page_mapped(). It is slightly shorter as we do not need to handle the PageTail() case. Reimplement page_mapped() as a wrapper around folio_mapped(). folio_mapped() is 13 bytes smaller than page_mapped(), but the page_mapped() wrapper is 30 bytes, for a net increase of 17 bytes of text. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Acked-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: William Kucharski <william.kucharski@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Howells <dhowells@redhat.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mm.h1
-rw-r--r--include/linux/mm_types.h6
2 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index bc5c38e1f780..95e36d0475ac 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1769,6 +1769,7 @@ static inline pgoff_t page_index(struct page *page)
}
bool page_mapped(struct page *page);
+bool folio_mapped(struct folio *folio);
/*
* Return true only if the page has been allocated with
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 5ebcb86ac934..82dab23205c3 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -299,6 +299,12 @@ FOLIO_MATCH(memcg_data, memcg_data);
#endif
#undef FOLIO_MATCH
+static inline atomic_t *folio_mapcount_ptr(struct folio *folio)
+{
+ struct page *tail = &folio->page + 1;
+ return &tail->compound_mapcount;
+}
+
static inline atomic_t *compound_mapcount_ptr(struct page *page)
{
return &page[1].compound_mapcount;