Skip to content

Commit ee6c400

Browse files
Matthew Wilcox (Oracle)torvalds
authored andcommitted
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: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: William Kucharski <[email protected]> Reviewed-by: Zi Yan <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2be1d71 commit ee6c400

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/linux/mm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,7 @@ static inline void clear_page_pfmemalloc(struct page *page)
15941594
extern void pagefault_out_of_memory(void);
15951595

15961596
#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
1597+
#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1))
15971598

15981599
/*
15991600
* Flags passed to show_mem() and show_free_areas() to suppress output in

0 commit comments

Comments
 (0)