Signed-off-by: Yu Zhao <yuzhao@xxxxxxxxxx> --- mm/vmscan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); -- 2.37.3.968.ga6b4b080e4-goog