linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Try to release mmap_lock temporarily in smaps_rollup
@ 2020-08-11  4:42 Chinwen Chang
  2020-08-11  4:42 ` [PATCH 1/2] mmap locking API: add mmap_lock_is_contended() Chinwen Chang
  2020-08-11  4:42 ` [PATCH 2/2] mm: proc: smaps_rollup: do not stall write attempts on mmap_lock Chinwen Chang
  0 siblings, 2 replies; 5+ messages in thread
From: Chinwen Chang @ 2020-08-11  4:42 UTC (permalink / raw)
  To: Matthias Brugger, Michel Lespinasse, Andrew Morton,
	Vlastimil Babka, Daniel Jordan, Davidlohr Bueso, Chinwen Chang,
	Alexey Dobriyan, Matthew Wilcox (Oracle),
	Jason Gunthorpe, Steven Price, Song Liu, Jimmy Assarsson,
	Huang Ying
  Cc: linux-kernel, linux-arm-kernel, linux-mediatek, linux-fsdevel,
	wsd_upstream

Recently, we have observed some janky issues caused by unpleasantly long
contention on mmap_lock which is held by smaps_rollup when probing large
processes. To address the problem, we let smaps_rollup detect if anyone
wants to acquire mmap_lock for write attempts. If yes, just release the
lock temporarily to ease the contention.

smaps_rollup is a procfs interface which allows users to summarize the
process's memory usage without the overhead of seq_* calls. Android uses
it to sample the memory usage of various processes to balance its memory
pool sizes. If no one wants to take the lock for write requests, smaps_rollup
with this patch will behave like the original one.

Although there are on-going mmap_lock optimizations like range-based locks,
the lock applied to smaps_rollup would be the coarse one, which is hard to
avoid the occurrence of aforementioned issues. So the detection and temporary
release for write attempts on mmap_lock in smaps_rollup is still necessary.


Chinwen Chang (2):
  mmap locking API: add mmap_lock_is_contended()
  mm: proc: smaps_rollup: do not stall write attempts on mmap_lock

 fs/proc/task_mmu.c        | 21 +++++++++++++++++++++
 include/linux/mmap_lock.h |  5 +++++
 2 files changed, 26 insertions(+)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-12  9:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11  4:42 [PATCH 0/2] Try to release mmap_lock temporarily in smaps_rollup Chinwen Chang
2020-08-11  4:42 ` [PATCH 1/2] mmap locking API: add mmap_lock_is_contended() Chinwen Chang
2020-08-11  4:42 ` [PATCH 2/2] mm: proc: smaps_rollup: do not stall write attempts on mmap_lock Chinwen Chang
2020-08-12  8:39   ` Steven Price
2020-08-12  9:26     ` Chinwen Chang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).