From: Frederic Weisbecker <frederic@kernel.org>
To: Christoph Lameter <cl@gentwo.de>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
atomlin@atomlin.com, tglx@linutronix.de, mingo@kernel.org,
peterz@infradead.org, pauld@redhat.com, neelx@redhat.com,
oleksandr@natalenko.name, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH v13 1/6] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy
Date: Tue, 10 Jan 2023 13:12:09 +0100 [thread overview]
Message-ID: <Y71WGeT2+6s4ewfv@lothringen> (raw)
In-Reply-To: <e9673684-ef3-4070-18bd-2f20fbfe8d5@gentwo.de>
On Tue, Jan 10, 2023 at 12:58:32PM +0100, Christoph Lameter wrote:
> On Thu, 5 Jan 2023, Marcelo Tosatti wrote:
>
> > +static inline void vmstat_mark_dirty(void)
> > +{
> > + this_cpu_write(vmstat_dirty, true);
> > +}
>
> this_cpu_write() is intended for an per cpu atomic context. You are not
> using it in that way. The processor may have changed before or after and
> thus vmstat_dirty for another CPU may have been marked dirty.
>
> I guess this would have to be called __vmstat_mark_dirty() and be using
> __this_cpu_write(*) with a requirement that preemption be disabled before
> using this function.
You're right. So this patchset also arranges for these vmstat functions to be
called with preemption disabled. I'm converting the this_cpu operations
to __this_cpu versions to make sure of that. And I believe the __this_cpu
WARN if preemptible().
>
> > +static inline void vmstat_clear_dirty(void)
> > +{
> > + this_cpu_write(vmstat_dirty, false);
> > +}
>
> Same
>
> > +static inline bool is_vmstat_dirty(void)
> > +{
> > + return this_cpu_read(vmstat_dirty);
> > +}
>
> This function would only work correctly if preemption is disabled.
> Otherwise the processor may change.
Indeed that should apply as __this_cpu_read() as well.
Thanks!
next prev parent reply other threads:[~2023-01-10 12:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 12:52 [PATCH v13 0/6] Ensure quiet_vmstat() is called when returning to userpace and when idle tick is stopped Marcelo Tosatti
2023-01-05 12:52 ` [PATCH v13 1/6] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy Marcelo Tosatti
2023-01-10 11:58 ` Christoph Lameter
2023-01-10 12:12 ` Frederic Weisbecker [this message]
2023-01-05 12:52 ` [PATCH v13 2/6] mm/vmstat: Use vmstat_dirty to track CPU-specific vmstat discrepancies Marcelo Tosatti
2023-01-10 12:06 ` Christoph Lameter
2023-01-10 12:18 ` Frederic Weisbecker
2023-01-10 13:39 ` Christoph Lameter
2023-01-10 20:09 ` Marcelo Tosatti
2023-01-11 8:42 ` Christoph Lameter
2023-01-11 17:07 ` Marcelo Tosatti
2023-01-16 9:51 ` Christoph Lameter
2023-01-16 16:11 ` Marcelo Tosatti
2023-01-17 12:52 ` Christoph Lameter
2023-01-05 12:52 ` [PATCH v13 3/6] mm/vmstat: manage per-CPU stats from CPU context when NOHZ full Marcelo Tosatti
2023-01-05 12:52 ` [PATCH v13 4/6] tick/nohz_full: Ensure quiet_vmstat() is called on exit to user-mode when the idle tick is stopped Marcelo Tosatti
2023-01-05 12:52 ` [PATCH v13 5/6] tick/sched: Ensure quiet_vmstat() is called when the idle tick was stopped too Marcelo Tosatti
2023-01-05 12:52 ` [PATCH v13 6/6] mm/vmstat: avoid queueing work item if cpu stats are clean Marcelo Tosatti
[not found] ` <20230106001244.4463-1-hdanton@sina.com>
2023-01-06 12:51 ` [PATCH v13 3/6] mm/vmstat: manage per-CPU stats from CPU context when NOHZ full Marcelo Tosatti
2023-01-06 15:01 ` Hillf Danton
2023-01-06 18:16 ` Marcelo Tosatti
2023-01-07 0:15 ` Hillf Danton
2023-01-09 14:12 ` Marcelo Tosatti
2023-01-10 2:43 ` Hillf Danton
2023-01-10 11:50 ` Marcelo Tosatti
2023-01-10 15:19 ` Hillf Danton
2023-01-10 16:12 ` Frederic Weisbecker
2023-01-10 23:58 ` Hillf Danton
2023-01-11 0:09 ` Frederic Weisbecker
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=Y71WGeT2+6s4ewfv@lothringen \
--to=frederic@kernel.org \
--cc=atomlin@atomlin.com \
--cc=cl@gentwo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@kernel.org \
--cc=mtosatti@redhat.com \
--cc=neelx@redhat.com \
--cc=oleksandr@natalenko.name \
--cc=pauld@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 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.