diff options
author | Matthew Wilcox <willy@infradead.org> | 2019-05-13 20:16:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-14 12:47:45 -0400 |
commit | 5fd4ca2d84b249f0858ce28cf637cf25b61a398f (patch) | |
tree | a7660b8f5f9fa02945070e2ab918eb645c92ba36 /include/linux/pagemap.h | |
parent | cefdca0a86be517bc390fc4541e3674b8e7803b0 (diff) |
mm: page cache: store only head pages in i_pages
Transparent Huge Pages are currently stored in i_pages as pointers to
consecutive subpages. This patch changes that to storing consecutive
pointers to the head page in preparation for storing huge pages more
efficiently in i_pages.
Large parts of this are "inspired" by Kirill's patch
https://lore.kernel.org/lkml/20170126115819.58875-2-kirill.shutemov@linux.intel.com/
[willy@infradead.org: fix swapcache pages]
Link: http://lkml.kernel.org/r/20190324155441.GF10344@bombadil.infradead.org
[kirill@shutemov.name: hugetlb stores pages in page cache differently]
Link: http://lkml.kernel.org/r/20190404134553.vuvhgmghlkiw2hgl@kshutemo-mobl1
Link: http://lkml.kernel.org/r/20190307153051.18815-1-willy@infradead.org
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Acked-by: Jan Kara <jack@suse.cz>
Reviewed-by: Kirill Shutemov <kirill@shutemov.name>
Reviewed-and-tested-by: Song Liu <songliubraving@fb.com>
Tested-by: William Kucharski <william.kucharski@oracle.com>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Tested-by: Qian Cai <cai@lca.pw>
Cc: Hugh Dickins <hughd@google.com>
Cc: Song Liu <liu.song.a23@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/pagemap.h')
-rw-r--r-- | include/linux/pagemap.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index bcf909d0de5f..2e8438a1216a 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -333,6 +333,19 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, | |||
333 | mapping_gfp_mask(mapping)); | 333 | mapping_gfp_mask(mapping)); |
334 | } | 334 | } |
335 | 335 | ||
336 | static inline struct page *find_subpage(struct page *page, pgoff_t offset) | ||
337 | { | ||
338 | unsigned long mask; | ||
339 | |||
340 | if (PageHuge(page)) | ||
341 | return page; | ||
342 | |||
343 | VM_BUG_ON_PAGE(PageTail(page), page); | ||
344 | |||
345 | mask = (1UL << compound_order(page)) - 1; | ||
346 | return page + (offset & mask); | ||
347 | } | ||
348 | |||
336 | struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); | 349 | struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); |
337 | struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset); | 350 | struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset); |
338 | unsigned find_get_entries(struct address_space *mapping, pgoff_t start, | 351 | unsigned find_get_entries(struct address_space *mapping, pgoff_t start, |