From: Marcelo Tosatti <mtosatti@redhat.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: linux-kernel@vger.kernel.org, Christoph Lameter <cl@linux.com>,
Thomas Gleixner <tglx@linutronix.de>,
Juri Lelli <juri.lelli@redhat.com>, Nitesh Lal <nilal@redhat.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [patch 0/5] optionally sync per-CPU vmstats counter on return to userspace
Date: Tue, 6 Jul 2021 11:09:20 -0300 [thread overview]
Message-ID: <20210706140920.GA68399@fuller.cnet> (raw)
In-Reply-To: <20210706140550.GA64308@fuller.cnet>
On Tue, Jul 06, 2021 at 11:05:50AM -0300, Marcelo Tosatti wrote:
> On Tue, Jul 06, 2021 at 03:09:25PM +0200, Frederic Weisbecker wrote:
> > On Fri, Jul 02, 2021 at 12:28:16PM -0300, Marcelo Tosatti wrote:
> > >
> > > Hi Frederic,
> > >
> > > On Fri, Jul 02, 2021 at 02:30:32PM +0200, Frederic Weisbecker wrote:
> > > > On Thu, Jul 01, 2021 at 06:03:36PM -0300, Marcelo Tosatti wrote:
> > > > > The logic to disable vmstat worker thread, when entering
> > > > > nohz full, does not cover all scenarios. For example, it is possible
> > > > > for the following to happen:
> > > > >
> > > > > 1) enter nohz_full, which calls refresh_cpu_vm_stats, syncing the stats.
> > > > > 2) app runs mlock, which increases counters for mlock'ed pages.
> > > > > 3) start -RT loop
> > > > >
> > > > > Since refresh_cpu_vm_stats from nohz_full logic can happen _before_
> > > > > the mlock, vmstat shepherd can restart vmstat worker thread on
> > > > > the CPU in question.
> > > > >
> > > > > To fix this, optionally sync the vmstat counters when returning
> > > > > from userspace, controllable by a new "vmstat_sync" isolcpus
> > > > > flags (default off).
> > > >
> > > > Wasn't the plan for such finegrained isolation features to do it at
> > > > the per task level using prctl()?
> > >
> > > Yes, but its orthogonal: when we integrate the finegrained isolation
> > > interface, will be able to use this code (to sync vmstat counters
> > > on return to userspace) only when userspace informs that it has entered
> > > isolated mode, so you don't incur the performance penalty of frequent
> > > vmstat counter writes when not using isolated apps.
> > >
> > > This is what the full task isolation task patchset mode is doing
> > > as well (CC'ing Alex BTW).
> >
> > Right there can be two ways:
>
>
> * An isolcpus flag to request sync of vmstat on all exits
> to userspace.
> > * A prctl request to sync vmstat only on exit from that prctl
> > * A prctl request to sync vmstat on all subsequent exit from
> > kernel space.
>
> * A prctl to expose "vmstat is out of sync" information
> to userspace, so that it can be queried and flushed
> (Christoph's suggestion:
> https://www.spinics.net/lists/linux-mm/msg243788.html).
>
> > > This will require modifying applications (and the new kernel with the
> > > exposed interface).
> > >
> > > But there is demand for fixing this now, for currently existing
> > > binary only applications.
> >
> > I would agree if it were a regression but it's not. It's merely
> > a new feature and we don't want to rush on a broken interface.
>
> Well, people out there need it in some form (vmstat sync).
> Can we please agree on an acceptable way to allow this.
>
> Why its a broken interface? It has good qualities IMO:
>
> - Its well contained (if you don't need, don't use it).
> - Does not require modifying -RT applications.
> - Works well for a set of applications (where the overhead of
> syncing vmstat is largely irrelevant, but the vmstat_worker
> interruption is).
>
> And its patchset integrates part another piece of full task isolation.
>
> > And I suspect some other people won't like much a new extension
> > to isolcpus.
>
> Why is that so?
Ah, yes, that would be PeterZ.
IIRC his main point was that its not runtime changeable.
We can (partially fix that), if that is the case.
Peter, was that the only problem you saw with isolcpus interface?
next prev parent reply other threads:[~2021-07-06 14:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-01 21:03 [patch 0/5] optionally sync per-CPU vmstats counter on return to userspace Marcelo Tosatti
2021-07-01 21:03 ` [patch 1/5] sched: isolation: introduce vmstat_sync isolcpu flags Marcelo Tosatti
2021-07-01 21:03 ` [patch 2/5] common entry: add hook for isolation to __syscall_exit_to_user_mode_work Marcelo Tosatti
2021-07-01 21:03 ` [patch 3/5] mm: vmstat: optionally flush per-CPU vmstat counters on return to userspace Marcelo Tosatti
2021-07-01 23:11 ` kernel test robot
2021-07-02 6:50 ` kernel test robot
2021-07-01 21:03 ` [patch 4/5] mm: vmstat: move need_update Marcelo Tosatti
2021-07-01 21:03 ` [patch 5/5] mm: vmstat_refresh: avoid queueing work item if cpu stats are clean Marcelo Tosatti
2021-07-02 4:10 ` kernel test robot
2021-07-02 4:43 ` kernel test robot
2021-07-02 8:00 ` [patch 0/5] optionally sync per-CPU vmstats counter on return to userspace Christoph Lameter
2021-07-02 11:52 ` Marcelo Tosatti
2021-07-02 11:59 ` Marcelo Tosatti
2021-07-05 14:26 ` Christoph Lameter
2021-07-05 14:45 ` Marcelo Tosatti
2021-07-02 12:30 ` Frederic Weisbecker
2021-07-02 15:28 ` Marcelo Tosatti
2021-07-06 13:09 ` Frederic Weisbecker
2021-07-06 14:05 ` Marcelo Tosatti
2021-07-06 14:09 ` Marcelo Tosatti [this message]
2021-07-06 14:17 ` Marcelo Tosatti
2021-07-06 16:15 ` Peter Zijlstra
2021-07-06 16:53 ` Marcelo Tosatti
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=20210706140920.GA68399@fuller.cnet \
--to=mtosatti@redhat.com \
--cc=cl@linux.com \
--cc=frederic@kernel.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nilal@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox