]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/shmem: add shmem_alloc_folio()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 13 May 2022 03:23:04 +0000 (20:23 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 13 May 2022 14:20:16 +0000 (07:20 -0700)
Call vma_alloc_folio() directly instead of alloc_page_vma().  Add a
shmem_alloc_page() wrapper to avoid changing the callers.

Link: https://lkml.kernel.org/r/20220504182857.4013401-21-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c

index d11dc37d332f9bb3d4fb0534614a9522f438c59b..668d054728bcc2acf8c2fb70896cc7755de5a6f1 100644 (file)
@@ -1544,17 +1544,23 @@ static struct page *shmem_alloc_hugepage(gfp_t gfp,
        return &folio->page;
 }
 
-static struct page *shmem_alloc_page(gfp_t gfp,
+static struct folio *shmem_alloc_folio(gfp_t gfp,
                        struct shmem_inode_info *info, pgoff_t index)
 {
        struct vm_area_struct pvma;
-       struct page *page;
+       struct folio *folio;
 
        shmem_pseudo_vma_init(&pvma, info, index);
-       page = alloc_page_vma(gfp, &pvma, 0);
+       folio = vma_alloc_folio(gfp, 0, &pvma, 0, false);
        shmem_pseudo_vma_destroy(&pvma);
 
-       return page;
+       return folio;
+}
+
+static struct page *shmem_alloc_page(gfp_t gfp,
+                       struct shmem_inode_info *info, pgoff_t index)
+{
+       return &shmem_alloc_folio(gfp, info, index)->page;
 }
 
 static struct page *shmem_alloc_and_acct_page(gfp_t gfp,