Chinwen Chang ff9f47f6f0 mm: proc: smaps_rollup: do not stall write attempts on mmap_lock
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.

Signed-off-by: Chinwen Chang <chinwen.chang@mediatek.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Steven Price <steven.price@arm.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: Chinwen Chang <chinwen.chang@mediatek.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Song Liu <songliubraving@fb.com>
Cc: Jimmy Assarsson <jimmyassarsson@gmail.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Daniel Kiss <daniel.kiss@arm.com>
Cc: Laurent Dufour <ldufour@linux.ibm.com>
Link: http://lkml.kernel.org/r/1597715898-3854-4-git-send-email-chinwen.chang@mediatek.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-10-13 18:38:31 -07:00
..
2020-10-13 12:12:44 -07:00
2020-10-13 12:12:44 -07:00
2020-10-13 08:59:39 -07:00
2020-10-13 08:54:00 -07:00
2020-10-13 12:12:44 -07:00
2020-10-13 12:12:44 -07:00
\n
2020-08-06 19:28:26 -07:00
2020-06-05 14:05:57 -07:00
2020-10-13 12:12:44 -07:00
2020-10-13 12:12:44 -07:00
2020-09-05 10:04:53 -07:00
2020-08-11 17:42:24 +09:00
2020-07-27 14:29:23 -04:00
2020-10-05 10:38:33 -06:00
2020-08-23 17:36:59 -05:00
2020-10-13 12:12:44 -07:00
2020-08-04 21:02:38 -04:00
2020-06-05 16:26:36 -07:00
2020-09-22 23:45:57 -04:00
2020-10-13 12:36:21 -07:00
2020-09-30 20:32:34 -06:00
2020-07-31 08:16:01 +02:00
2020-08-07 11:33:24 -07:00
2020-09-22 23:45:57 -04:00
2020-05-14 16:44:24 +02:00
2020-08-12 10:58:01 -07:00
2020-07-31 08:16:00 +02:00
2020-06-02 19:45:12 -07:00
2020-06-09 15:40:50 -07:00
2020-07-31 08:16:01 +02:00