summaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-10-19 19:33:31 +0100
committerAndrew Morton <akpm@linux-foundation.org>2022-11-08 17:37:18 -0800
commit524984ff66ee4b63264dffe568c3547a20b4136c (patch)
tree3a49ec8c2ede1958bb6dbd4a426b68cfe7f25e0e /mm/memcontrol.c
parentdd8095b15a6034165bc48da1eb6d0acc73c1558a (diff)
downloadlinux-stable-524984ff66ee4b63264dffe568c3547a20b4136c.tar.gz
linux-stable-524984ff66ee4b63264dffe568c3547a20b4136c.tar.bz2
linux-stable-524984ff66ee4b63264dffe568c3547a20b4136c.zip
mm: convert find_get_incore_page() to filemap_get_incore_folio()
Return the containing folio instead of the precise page. One of the callers wants the folio and the other can do the folio->page conversion itself. Nets 442 bytes of text size reduction, 478 bytes removed and 36 bytes added. Link: https://lkml.kernel.org/r/20221019183332.2802139-4-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f264a856ba86..fd707dcd6d04 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5648,15 +5648,21 @@ static struct page *mc_handle_swap_pte(struct vm_area_struct *vma,
static struct page *mc_handle_file_pte(struct vm_area_struct *vma,
unsigned long addr, pte_t ptent)
{
+ unsigned long index;
+ struct folio *folio;
+
if (!vma->vm_file) /* anonymous vma */
return NULL;
if (!(mc.flags & MOVE_FILE))
return NULL;
- /* page is moved even if it's not RSS of this task(page-faulted). */
+ /* folio is moved even if it's not RSS of this task(page-faulted). */
/* shmem/tmpfs may report page out on swap: account for that too. */
- return find_get_incore_page(vma->vm_file->f_mapping,
- linear_page_index(vma, addr));
+ index = linear_page_index(vma, addr);
+ folio = filemap_get_incore_folio(vma->vm_file->f_mapping, index);
+ if (!folio)
+ return NULL;
+ return folio_file_page(folio, index);
}
/**