Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torvalds/linux.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-01-07 21:45:25 +0300
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-03-21 19:56:35 +0300
commit4c65422901154766e5cee17875ed680366a4a141 (patch)
treedbca9698daccdecf9a37dda282750cb3be3aef8a /include/linux/mm.h
parentc228afb11ac6938532703ac712992524497aff29 (diff)
mm/gup: Remove an assumption of a contiguous memmap
This assumption needs the inverse of nth_page(), which is temporarily named page_nth() until it's renamed later in this series. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 0201d258c646..e3f8755f65ed 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -212,8 +212,10 @@ int overcommit_policy_handler(struct ctl_table *, int, void *, size_t *,
#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
+#define page_nth(head, tail) (page_to_pfn(tail) - page_to_pfn(head))
#else
#define nth_page(page,n) ((page) + (n))
+#define page_nth(head, tail) ((tail) - (head))
#endif
/* to align the pointer to the (next) page boundary */