Skip to content

Commit 22d1e68

Browse files
sidkumar99akpm00
authored andcommitted
mm/memory: convert do_read_fault() to use folios
Saves one implicit call to compound_head(). Link: https://lkml.kernel.org/r/20230706163847.403202-4-sidhartha.kumar@oracle.com Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: ZhangPeng <zhangpeng362@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 6f609b7 commit 22d1e68

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mm/memory.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4536,6 +4536,7 @@ static inline bool should_fault_around(struct vm_fault *vmf)
45364536
static vm_fault_t do_read_fault(struct vm_fault *vmf)
45374537
{
45384538
vm_fault_t ret = 0;
4539+
struct folio *folio;
45394540

45404541
/*
45414542
* Let's call ->map_pages() first and use ->fault() as fallback
@@ -4553,9 +4554,10 @@ static vm_fault_t do_read_fault(struct vm_fault *vmf)
45534554
return ret;
45544555

45554556
ret |= finish_fault(vmf);
4556-
unlock_page(vmf->page);
4557+
folio = page_folio(vmf->page);
4558+
folio_unlock(folio);
45574559
if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY)))
4558-
put_page(vmf->page);
4560+
folio_put(folio);
45594561
return ret;
45604562
}
45614563

0 commit comments

Comments
 (0)