diff options
author | Matthew Wilcox (Oracle) | 2022-05-12 20:23:01 -0700 |
---|---|---|
committer | Andrew Morton | 2022-05-13 07:20:14 -0700 |
commit | dfe98499ef288ac730662a70110bcadaa67c0ee0 (patch) | |
tree | b3788916523c5f28f906004cf44c65fe13e3d87c /mm/shmem.c | |
parent | 54943a1a4d2a3fed23d31e96a91aa9d18ea74500 (diff) |
shmem: convert shmem_alloc_hugepage() to use vma_alloc_folio()
Patch series "Folio patches for 5.19", v2.
This patch (of 26):
For now, return the head page of the folio, but remove use of the old
alloc_pages_vma() API.
Link: https://lkml.kernel.org/r/20220504182857.4013401-1-willy@infradead.org
Link: https://lkml.kernel.org/r/20220504182857.4013401-2-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 4a4a2e628289..7994421588a3 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1528,7 +1528,7 @@ static struct page *shmem_alloc_hugepage(gfp_t gfp, struct vm_area_struct pvma; struct address_space *mapping = info->vfs_inode.i_mapping; pgoff_t hindex; - struct page *page; + struct folio *folio; hindex = round_down(index, HPAGE_PMD_NR); if (xa_find(&mapping->i_pages, &hindex, hindex + HPAGE_PMD_NR - 1, @@ -1536,13 +1536,11 @@ static struct page *shmem_alloc_hugepage(gfp_t gfp, return NULL; shmem_pseudo_vma_init(&pvma, info, hindex); - page = alloc_pages_vma(gfp, HPAGE_PMD_ORDER, &pvma, 0, true); + folio = vma_alloc_folio(gfp, HPAGE_PMD_ORDER, &pvma, 0, true); shmem_pseudo_vma_destroy(&pvma); - if (page) - prep_transhuge_page(page); - else + if (!folio) count_vm_event(THP_FILE_FALLBACK); - return page; + return &folio->page; } static struct page *shmem_alloc_page(gfp_t gfp, |