diff mbox series

[v14-fix,09/11] mm: multi-gen LRU: add comment in lru_gen_look_around()

Message ID 20220918204755.3135720-9-yuzhao@google.com (mailing list archive)
State New
Headers show
Series [v14-fix,01/11] mm: multi-gen LRU: update admin guide | expand

Commit Message

Yu Zhao Sept. 18, 2022, 8:47 p.m. UTC
Signed-off-by: Yu Zhao <yuzhao@google.com>
---
 mm/vmscan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1c5c357bee42..f6eab73bdfb9 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4604,6 +4604,9 @@  void lru_gen_look_around(struct page_vma_mapped_walk *pvmw)
 	if (spin_is_contended(pvmw->ptl))
 		return;
 
+	/* avoid taking the LRU lock under the PTL when possible */
+	walk = current->reclaim_state ? current->reclaim_state->mm_walk : NULL;
+
 	start = max(pvmw->address & PMD_MASK, pvmw->vma->vm_start);
 	end = min(pvmw->address | ~PMD_MASK, pvmw->vma->vm_end - 1) + 1;
 
@@ -4619,7 +4622,6 @@  void lru_gen_look_around(struct page_vma_mapped_walk *pvmw)
 	}
 
 	pte = pvmw->pte - (pvmw->address - start) / PAGE_SIZE;
-	walk = current->reclaim_state ? current->reclaim_state->mm_walk : NULL;
 
 	rcu_read_lock();
 	arch_enter_lazy_mmu_mode();