All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michel Lespinasse <walken@google.com>
To: Chinwen Chang <chinwen.chang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Daniel Jordan <daniel.m.jordan@oracle.com>,
	Davidlohr Bueso <dbueso@suse.de>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Steven Price <steven.price@arm.com>,
	Song Liu <songliubraving@fb.com>,
	Jimmy Assarsson <jimmyassarsson@gmail.com>,
	Huang Ying <ying.huang@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	linux-fsdevel@vger.kernel.org, wsd_upstream@mediatek.com
Subject: Re: [PATCH v2 0/2] Try to release mmap_lock temporarily in smaps_rollup
Date: Fri, 14 Aug 2020 01:29:59 -0700	[thread overview]
Message-ID: <CANN689GsiBga4a6P3JMG-iwT9WY6V_qodJxeaw0uWsTHVsW4JQ@mail.gmail.com> (raw)
In-Reply-To: <1597335088.32469.55.camel@mtkswgap22>

On Thu, Aug 13, 2020 at 9:11 AM Chinwen Chang
<chinwen.chang@mediatek.com> wrote:
> On Thu, 2020-08-13 at 02:53 -0700, Michel Lespinasse wrote:
> > On Wed, Aug 12, 2020 at 7:14 PM Chinwen Chang
> > <chinwen.chang@mediatek.com> wrote:
> > > 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.
> >
> > I do not mind extending the mmap lock API as needed. However, in the
> > past I have tried adding rwsem_is_contended to mlock(), and later to
> > mm_populate() paths, and IIRC gotten pushback on it both times. I
> > don't feel strongly on this, but would prefer if someone else approved
> > the rwsem_is_contended() use case.
> >
> Hi Michel,
>
> Thank you for your kind feedback.
>
> In my opinion, the difference between the case in smaps_rollup and the
> one in your example is that, for the former, the interference comes from
> the outside of the affected process, for the latter, it doesn't.
>
> In other words, anyone may use smaps_rollup to probe the affected
> process without the information about what step the affected one is
> executing.

Thanks, that is a good enough point for me :)

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

WARNING: multiple messages have this Message-ID (diff)
From: Michel Lespinasse <walken@google.com>
To: Chinwen Chang <chinwen.chang@mediatek.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Song Liu <songliubraving@fb.com>,
	wsd_upstream@mediatek.com, Davidlohr Bueso <dbueso@suse.de>,
	LKML <linux-kernel@vger.kernel.org>,
	"Matthew Wilcox \(Oracle\)" <willy@infradead.org>,
	Daniel Jordan <daniel.m.jordan@oracle.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	linux-mediatek@lists.infradead.org,
	Jimmy Assarsson <jimmyassarsson@gmail.com>,
	Huang Ying <ying.huang@intel.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Steven Price <steven.price@arm.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH v2 0/2] Try to release mmap_lock temporarily in smaps_rollup
Date: Fri, 14 Aug 2020 01:29:59 -0700	[thread overview]
Message-ID: <CANN689GsiBga4a6P3JMG-iwT9WY6V_qodJxeaw0uWsTHVsW4JQ@mail.gmail.com> (raw)
In-Reply-To: <1597335088.32469.55.camel@mtkswgap22>

On Thu, Aug 13, 2020 at 9:11 AM Chinwen Chang
<chinwen.chang@mediatek.com> wrote:
> On Thu, 2020-08-13 at 02:53 -0700, Michel Lespinasse wrote:
> > On Wed, Aug 12, 2020 at 7:14 PM Chinwen Chang
> > <chinwen.chang@mediatek.com> wrote:
> > > 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.
> >
> > I do not mind extending the mmap lock API as needed. However, in the
> > past I have tried adding rwsem_is_contended to mlock(), and later to
> > mm_populate() paths, and IIRC gotten pushback on it both times. I
> > don't feel strongly on this, but would prefer if someone else approved
> > the rwsem_is_contended() use case.
> >
> Hi Michel,
>
> Thank you for your kind feedback.
>
> In my opinion, the difference between the case in smaps_rollup and the
> one in your example is that, for the former, the interference comes from
> the outside of the affected process, for the latter, it doesn't.
>
> In other words, anyone may use smaps_rollup to probe the affected
> process without the information about what step the affected one is
> executing.

Thanks, that is a good enough point for me :)

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Michel Lespinasse <walken@google.com>
To: Chinwen Chang <chinwen.chang@mediatek.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Song Liu <songliubraving@fb.com>,
	wsd_upstream@mediatek.com, Davidlohr Bueso <dbueso@suse.de>,
	LKML <linux-kernel@vger.kernel.org>,
	"Matthew Wilcox \(Oracle\)" <willy@infradead.org>,
	Daniel Jordan <daniel.m.jordan@oracle.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	linux-mediatek@lists.infradead.org,
	Jimmy Assarsson <jimmyassarsson@gmail.com>,
	Huang Ying <ying.huang@intel.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Steven Price <steven.price@arm.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH v2 0/2] Try to release mmap_lock temporarily in smaps_rollup
Date: Fri, 14 Aug 2020 01:29:59 -0700	[thread overview]
Message-ID: <CANN689GsiBga4a6P3JMG-iwT9WY6V_qodJxeaw0uWsTHVsW4JQ@mail.gmail.com> (raw)
In-Reply-To: <1597335088.32469.55.camel@mtkswgap22>

On Thu, Aug 13, 2020 at 9:11 AM Chinwen Chang
<chinwen.chang@mediatek.com> wrote:
> On Thu, 2020-08-13 at 02:53 -0700, Michel Lespinasse wrote:
> > On Wed, Aug 12, 2020 at 7:14 PM Chinwen Chang
> > <chinwen.chang@mediatek.com> wrote:
> > > 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.
> >
> > I do not mind extending the mmap lock API as needed. However, in the
> > past I have tried adding rwsem_is_contended to mlock(), and later to
> > mm_populate() paths, and IIRC gotten pushback on it both times. I
> > don't feel strongly on this, but would prefer if someone else approved
> > the rwsem_is_contended() use case.
> >
> Hi Michel,
>
> Thank you for your kind feedback.
>
> In my opinion, the difference between the case in smaps_rollup and the
> one in your example is that, for the former, the interference comes from
> the outside of the affected process, for the latter, it doesn't.
>
> In other words, anyone may use smaps_rollup to probe the affected
> process without the information about what step the affected one is
> executing.

Thanks, that is a good enough point for me :)

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-08-14  8:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13  2:13 [PATCH v2 0/2] Try to release mmap_lock temporarily in smaps_rollup Chinwen Chang
2020-08-13  2:13 ` Chinwen Chang
2020-08-13  2:13 ` Chinwen Chang
2020-08-13  2:13 ` [PATCH v2 1/2] mmap locking API: add mmap_lock_is_contended() Chinwen Chang
2020-08-13  2:13   ` Chinwen Chang
2020-08-13  2:13   ` Chinwen Chang
2020-08-13  8:21   ` Steven Price
2020-08-13  8:21     ` Steven Price
2020-08-13  8:21     ` Steven Price
2020-08-14  8:30   ` Michel Lespinasse
2020-08-14  8:30     ` Michel Lespinasse
2020-08-14  8:30     ` Michel Lespinasse
2020-08-13  2:13 ` [PATCH v2 2/2] mm: proc: smaps_rollup: do not stall write attempts on mmap_lock Chinwen Chang
2020-08-13  2:13   ` Chinwen Chang
2020-08-13  2:13   ` Chinwen Chang
2020-08-13  8:21   ` Steven Price
2020-08-13  8:21     ` Steven Price
2020-08-13  8:21     ` Steven Price
2020-08-14  8:35   ` Michel Lespinasse
2020-08-14  8:35     ` Michel Lespinasse
2020-08-14  8:35     ` Michel Lespinasse
2020-08-14  9:08     ` Chinwen Chang
2020-08-14  9:08       ` Chinwen Chang
2020-08-14  9:08       ` Chinwen Chang
2020-08-13  9:53 ` [PATCH v2 0/2] Try to release mmap_lock temporarily in smaps_rollup Michel Lespinasse
2020-08-13  9:53   ` Michel Lespinasse
2020-08-13  9:53   ` Michel Lespinasse
2020-08-13 16:11   ` Chinwen Chang
2020-08-13 16:11     ` Chinwen Chang
2020-08-13 16:11     ` Chinwen Chang
2020-08-14  8:29     ` Michel Lespinasse [this message]
2020-08-14  8:29       ` Michel Lespinasse
2020-08-14  8:29       ` Michel Lespinasse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANN689GsiBga4a6P3JMG-iwT9WY6V_qodJxeaw0uWsTHVsW4JQ@mail.gmail.com \
    --to=walken@google.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chinwen.chang@mediatek.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=dbueso@suse.de \
    --cc=jgg@ziepe.ca \
    --cc=jimmyassarsson@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=songliubraving@fb.com \
    --cc=steven.price@arm.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=wsd_upstream@mediatek.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.