summaryrefslogtreecommitdiff
path: root/include/linux/page_ext.h
diff options
context:
space:
mode:
authorKemeng Shi <shikemeng@huaweicloud.com>2023-07-18 22:58:10 +0800
committerAndrew Morton <akpm@linux-foundation.org>2023-08-21 13:37:27 -0700
commitc0a5d93a885b42c22085ad0f39233795f4a578e0 (patch)
treeb219fe154ec13788bb41b036eeaee891d6295b03 /include/linux/page_ext.h
parentca54f6d89d60abf3e7dea68c95dfd442eeece212 (diff)
mm/page_ext: add common function to get client data from page_ext
Patch series "add page_ext_data to get client data in page_ext". Current clients get data from page_ext by adding offset which is auto generated in page_ext core and exposes the data layout design inside page_ext core. This series adds a page_ext_data() to hide this from clients. Benefits include: 1. Future clients can call page_ext_data directly instead of defining a new function like get_page_owner to get the data. 2. There is no change to clients if the layout of page_ext data changes. This patch (of 3): Add common page_ext_data function to get client data. This could hide offset which is auto generated in page_ext core and expose the desgin of page_ext data layout. Link: https://lkml.kernel.org/r/20230718145812.1991717-1-shikemeng@huaweicloud.com Link: https://lkml.kernel.org/r/20230718145812.1991717-2-shikemeng@huaweicloud.com Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Andrew Morton <akpm@linux-foudation.org> Acked-by: Mike Rapoport (IBM) <rppt@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/page_ext.h')
-rw-r--r--include/linux/page_ext.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h
index 67314f648aeb..658d8d39a10e 100644
--- a/include/linux/page_ext.h
+++ b/include/linux/page_ext.h
@@ -82,6 +82,12 @@ static inline void page_ext_init(void)
extern struct page_ext *page_ext_get(struct page *page);
extern void page_ext_put(struct page_ext *page_ext);
+static inline void *page_ext_data(struct page_ext *page_ext,
+ struct page_ext_operations *ops)
+{
+ return (void *)(page_ext) + ops->offset;
+}
+
static inline struct page_ext *page_ext_next(struct page_ext *curr)
{
void *next = curr;