Commit ee6c400f authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Linus Torvalds
Browse files

mm: introduce offset_in_thp

Mirroring offset_in_page(), this gives you the offset within this
particular page, no matter what size page it is.  It optimises down to
offset_in_page() if CONFIG_TRANSPARENT_HUGEPAGE is not set.

Signed-off-by: default avatarMatthew Wilcox (Oracle) <>
Signed-off-by: default avatarAndrew Morton <>
Reviewed-by: default avatarDavid Hildenbrand <>
Reviewed-by: default avatarWilliam Kucharski <>
Reviewed-by: default avatarZi Yan <>
Cc: Mike Kravetz <>
Cc: "Kirill A. Shutemov" <>

Signed-off-by: default avatarLinus Torvalds <>
parent 2be1d718
......@@ -1594,6 +1594,7 @@ static inline void clear_page_pfmemalloc(struct page *page)
extern void pagefault_out_of_memory(void);
#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1))
* Flags passed to show_mem() and show_free_areas() to suppress output in
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment