Thread (11 messages) 11 messages, 3 authors, 2020-08-14

Re: [PATCH v2 2/2] mm: proc: smaps_rollup: do not stall write attempts on mmap_lock

From: Chinwen Chang <hidden>
Date: 2020-08-14 09:08:17
Also in: linux-fsdevel, linux-mediatek, lkml

On Fri, 2020-08-14 at 01:35 -0700, Michel Lespinasse wrote:
On Wed, Aug 12, 2020 at 7:13 PM Chinwen Chang
[off-list ref] wrote:
quoted
smaps_rollup will try to grab mmap_lock and go through the whole vma
list until it finishes the iterating. When encountering large processes,
the mmap_lock will be held for a longer time, which may block other
write requests like mmap and munmap from progressing smoothly.

There are upcoming mmap_lock optimizations like range-based locks, but
the lock applied to smaps_rollup would be the coarse type, which doesn't
avoid the occurrence of unpleasant contention.

To solve aforementioned issue, we add a check which detects whether
anyone wants to grab mmap_lock for write attempts.
I think your retry mechanism still doesn't handle all cases. When you
get back the mmap lock, the address where you stopped last time could
now be in the middle of a vma. I think the consistent thing to do in
that case would be to retry scanning from the address you stopped at,
even if it's not on a vma boundary anymore. You may have to change
smap_gather_stats to support that, though.
Hi Michel,

I think I got your point. Let me try to prepare new patch series for
further reviews.

Thank you for your suggestion :)

Chinwen
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help