From: Peter Zijlstra <peterz@infradead.org>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: "Ahmed S. Darwish" <a.darwish@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Sebastian A. Siewior" <bigeasy@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org
Subject: Re: [PATCH v1 02/25] mm/swap: Don't abuse the seqcount latching API
Date: Wed, 20 May 2020 15:05:12 +0200 [thread overview]
Message-ID: <20200520130512.GD325280@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <706c697c-c951-e0c3-40f8-f6e429b2226a@yandex-team.ru>
On Wed, May 20, 2020 at 03:22:15PM +0300, Konstantin Khlebnikov wrote:
> On 20/05/2020 00.45, Ahmed S. Darwish wrote:
> > Commit eef1a429f234 ("mm/swap.c: piggyback lru_add_drain_all() calls")
> > implemented an optimization mechanism to exit the to-be-started LRU
> > drain operation (name it A) if another drain operation *started and
> > finished* while (A) was blocked on the LRU draining mutex.
That commit is horrible...
> Well, I thought it fits perfectly =)
>
> Maybe it's worth to add helpers with appropriate semantics?
> This is pretty common pattern.
Where's more sites?
> > @@ -725,21 +735,48 @@ void lru_add_drain_all(void)
> > if (WARN_ON(!mm_percpu_wq))
> > return;
> > - seq = raw_read_seqcount_latch(&seqcount);
> > mutex_lock(&lock);
> > /*
> > - * Piggyback on drain started and finished while we waited for lock:
> > - * all pages pended at the time of our enter were drained from vectors.
> > */
> > - if (__read_seqcount_retry(&seqcount, seq))
> > goto done;
Since there is no ordering in raw_read_seqcount_latch(), and
mutex_lock() is an ACQUIRE, there's no guarantee the read actually
happens before the mutex is acquired.
> > - raw_write_seqcount_latch(&seqcount);
> > cpumask_clear(&has_work);
next prev parent reply other threads:[~2020-05-20 13:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 21:45 [PATCH v1 00/25] seqlock: Extend seqcount API with associated locks Ahmed S. Darwish
2020-05-19 21:45 ` [PATCH v1 02/25] mm/swap: Don't abuse the seqcount latching API Ahmed S. Darwish
2020-05-20 11:24 ` Hillf Danton
2020-05-20 12:22 ` Konstantin Khlebnikov
2020-05-20 13:05 ` Peter Zijlstra [this message]
2020-05-22 14:57 ` Peter Zijlstra
2020-05-22 15:17 ` Sebastian A. Siewior
2020-05-22 16:23 ` Peter Zijlstra
2020-05-25 15:24 ` Ahmed S. Darwish
2020-05-25 15:45 ` Peter Zijlstra
2020-05-25 16:10 ` John Ogness
[not found] ` <20200827114044.11173-1-a.darwish@linutronix.de>
2020-08-27 11:40 ` [PATCH v1 2/8] mm/swap: Do not abuse the seqcount_t " Ahmed S. Darwish
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=20200520130512.GD325280@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=a.darwish@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=khlebnikov@yandex-team.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--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 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).