fs, proc: unconditional cond_resched when reading smaps
Subsystems (2)
[email protected]
maintainerPATCH 51/126 fs, proc: unconditional cond_resched when reading smaps
From: David Rientjes <[email protected]>
Subject: fs, proc: unconditional cond_resched when reading smaps
If there are large numbers of hugepages to iterate while reading /proc/pid/smaps, the page walk never does cond_resched(). On archs without split pmd locks, there can be significant and observable contention on mm->page_table_lock which cause lengthy delays without rescheduling.
Always reschedule in smaps_pte_range() if necessary since the pagewalk iteration can be expensive.
Signed-off-by David Rientjes <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc "Kirill A. Shutemov" <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
fs/proc/task_mmu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/proc/task_mmu.c renamed from fs/proc/task_mmu.c~fs-proc-unconditional-cond_resched-when-reading-smaps +3 -2
@@ -611,11 +611,11 @@ static int smaps_pte_range(pmd_t *pmd, uif (pmd_present (*pmd))smaps_pmd_entry (pmd, addr, walk);spin_unlock (ptl); -return 0 ; + goto out; }if (pmd_trans_unstable (pmd)) -return 0 ; + goto out;/* * The mmap_sem held all the way back in m_start() is what * keeps khugepaged out of here and from collapsing things
@@ -625,6 +625,7 @@ static int smaps_pte_range(pmd_t *pmd, ufor (; addr != end; pte++, addr +=PAGE_SIZE )smaps_pte_entry (pte, addr, walk);pte_unmap_unlock (pte -1 , ptl); +out:cond_resched ();return 0 ; }
_