linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tejun Heo <tj@kernel.org>,
	lizefan@huawei.com, Johannes Weiner <hannes@cmpxchg.org>,
	axboe@kernel.dk, dennis@kernel.org,
	Dennis Zhou <dennisszhou@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	cgroups@vger.kernel.org, linux-mm <linux-mm@kvack.org>,
	linux-doc@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	kernel-team@android.com
Subject: Re: [PATCH v3 5/5] psi: introduce psi monitor
Date: Tue, 29 Jan 2019 10:31:40 -0800	[thread overview]
Message-ID: <CAJuCfpHdtY7cRBfVP-+e9hQrTigStj2XK_qpk8z91HSKW+Y5WA@mail.gmail.com> (raw)
In-Reply-To: <CAJuCfpGxtGHsow002nd8Ao8mo9MaZQqZau_NLTMrZ8=aypTkig@mail.gmail.com>

On Tue, Jan 29, 2019 at 10:18 AM Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Tue, Jan 29, 2019 at 4:38 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > On Thu, Jan 24, 2019 at 01:15:18PM -0800, Suren Baghdasaryan wrote:
> > > +                     atomic_set(&group->polling, polling);
> > > +                     /*
> > > +                      * Memory barrier is needed to order group->polling
> > > +                      * write before times[] read in collect_percpu_times()
> > > +                      */
> > > +                     smp_mb__after_atomic();
> >
> > That's broken, smp_mb__{before,after}_atomic() can only be used on
> > atomic RmW operations, something atomic_set() is _not_.
>
> Oh, I didn't realize that. After reading the following example from
> atomic_ops.txt I was under impression that smp_mb__after_atomic()
> would make changes done by atomic_set() visible:
>
> /* All memory operations before this call will
> * be globally visible before the clear_bit().
> */
> smp_mb__before_atomic();
> clear_bit( ... );
> /* The clear_bit() will be visible before all
> * subsequent memory operations.
> */
> smp_mb__after_atomic();
>
> but I'm probably missing something. Is there a more detailed
> description of these rules anywhere else?

I was referred to memory-barriers.txt that explains this clearly
stating that "These functions do not imply memory barriers.". Thanks
for noticing! Will change to smp_mb().

> Meanwhile I'll change smp_mb__after_atomic() into smp_mb(). Would that
> fix the ordering?
>
> > --
> > You received this message because you are subscribed to the Google Groups "kernel-team" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
> >

  reply	other threads:[~2019-01-29 18:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 21:15 [PATCH v3 0/5] psi: pressure stall monitors v3 Suren Baghdasaryan
2019-01-24 21:15 ` [PATCH v3 1/5] fs: kernfs: add poll file operation Suren Baghdasaryan
2019-01-24 21:15 ` [PATCH v3 2/5] kernel: cgroup: " Suren Baghdasaryan
2019-01-24 21:15 ` [PATCH v3 3/5] psi: introduce state_mask to represent stalled psi states Suren Baghdasaryan
2019-01-28 21:22   ` Johannes Weiner
2019-01-24 21:15 ` [PATCH v3 4/5] psi: rename psi fields in preparation for psi trigger addition Suren Baghdasaryan
2019-01-28 21:23   ` Johannes Weiner
2019-01-24 21:15 ` [PATCH v3 5/5] psi: introduce psi monitor Suren Baghdasaryan
2019-01-28 21:26   ` Johannes Weiner
2019-01-28 23:53   ` Minchan Kim
2019-01-29  1:52     ` Suren Baghdasaryan
2019-01-29 18:35     ` Johannes Weiner
2019-01-29 10:44   ` Peter Zijlstra
2019-01-29 18:05     ` Suren Baghdasaryan
2019-01-29 12:38   ` Peter Zijlstra
2019-01-29 15:16     ` Peter Zijlstra
2019-01-29 18:25       ` Suren Baghdasaryan
2019-01-29 18:18     ` Suren Baghdasaryan
2019-01-29 18:31       ` Suren Baghdasaryan [this message]
2019-01-29 19:08       ` Peter Zijlstra

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=CAJuCfpHdtY7cRBfVP-+e9hQrTigStj2XK_qpk8z91HSKW+Y5WA@mail.gmail.com \
    --to=surenb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=dennis@kernel.org \
    --cc=dennisszhou@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@android.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizefan@huawei.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tj@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).