All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Muchun Song <songmuchun@bytedance.com>
Cc: Will Deacon <will@kernel.org>,
	mingo@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [External] Re: [PATCH] seqlock: Use while instead of if+goto in __read_seqcount_begin
Date: Wed, 15 Apr 2020 13:41:54 +0200	[thread overview]
Message-ID: <20200415114154.GF20730@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CAMZfGtWk+gG7Z2bOy_bq=XnuuSJzic16zpeajhJiiekpJEFrFg@mail.gmail.com>

On Tue, Apr 14, 2020 at 08:01:06PM +0800, Muchun Song wrote:
> On Tue, Apr 14, 2020 at 7:05 PM Peter Zijlstra <peterz@infradead.org> wrote:

> > .... That said,
> > Will, would it make sense to use smp_cond_load_relaxed() here ?
> 
> I have a similar idea. Would it make sense to use smp_cond_load_acquire()
> in raw_read_seqcount_begin()?

Not sure; I did consider it, but that rmb it has seems more natural in
the over-all ordering scheme here. I mean:

	load seqcount		inc seqcount
	rmb			wmb
	// load stuff		// modify stuff
	rmb			wmb
	compare seqcount	inc seqcount

is nice and symmetric, making that upper left rmb an acquire 'works' but
is just weird IMO. And I suppose you can make the lower right wmb a
store-release, which is somewhat better, but then it gets all weird when
you consider things like barrier and latch.

So best to just leave it as is I think.

Those incs do seem to be really wanting a WRITE_ONCE() though.

  reply	other threads:[~2020-04-15 11:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 13:45 [PATCH] seqlock: Use while instead of if+goto in __read_seqcount_begin Muchun Song
2020-04-10 11:56 ` Will Deacon
2020-04-14  8:58   ` [External] " Muchun Song
2020-04-14 11:05   ` Peter Zijlstra
2020-04-14 12:01     ` [External] " Muchun Song
2020-04-15 11:41       ` Peter Zijlstra [this message]
2020-04-14 13:48     ` Will Deacon
2020-04-15 11:44       ` Peter Zijlstra
2020-04-15  9:37     ` David Laight

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=20200415114154.GF20730@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=songmuchun@bytedance.com \
    --cc=will@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 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.