From: Naresh Kamboju <naresh.kamboju@linaro.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Kairui Song <kasong@tencent.com>,
open list <linux-kernel@vger.kernel.org>,
lkft-triage@lists.linaro.org,
Linux Regressions <regressions@lists.linux.dev>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>,
Anders Roxell <anders.roxell@linaro.org>
Subject: Re: next-20241001: WARNING: at mm/list_lru.c:77 list_lru_del (mm/list_lru.c:212 mm/list_lru.c:200)
Date: Thu, 3 Oct 2024 11:08:39 +0530 [thread overview]
Message-ID: <CA+G9fYvdzY+vWhPKPmyPDJNDqvH7AaU4HfKTFtgUwU+KTrD9_Q@mail.gmail.com> (raw)
In-Reply-To: <62a65418-2393-40ec-b462-151605a5efcf@stanley.mountain>
On Wed, 2 Oct 2024 at 16:58, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> On Wed, Oct 02, 2024 at 02:25:34PM +0300, Dan Carpenter wrote:
> > On Wed, Oct 02, 2024 at 02:24:20PM +0300, Dan Carpenter wrote:
> > > Let's add Kairui Song to the CC list.
> > >
> > > One simple thing is that we should add a READ_ONCE() to the comparison. Naresh,
> > > could you test the attached diff? I don't know that it will fix it but it's
> > > worth checking the easy stuff first.
> > >
> >
> > Actually that's not right. Let me write a different patch.
>
> Try this one.
>
Thanks for the patch,
I have applied this patch and testing is in progress.
From last night the tests running in a loop did not find the reported warning.
> regards,
> dan carpenter
>
> diff --git a/mm/list_lru.c b/mm/list_lru.c
> index 79c2d21504a2..2c429578ed31 100644
> --- a/mm/list_lru.c
> +++ b/mm/list_lru.c
> @@ -65,6 +65,7 @@ lock_list_lru_of_memcg(struct list_lru *lru, int nid, struct mem_cgroup *memcg,
> bool irq, bool skip_empty)
> {
> struct list_lru_one *l;
> + long nr_items;
> rcu_read_lock();
> again:
> l = list_lru_from_memcg_idx(lru, nid, memcg_kmem_id(memcg));
> @@ -73,8 +74,9 @@ lock_list_lru_of_memcg(struct list_lru *lru, int nid, struct mem_cgroup *memcg,
> spin_lock_irq(&l->lock);
> else
> spin_lock(&l->lock);
> - if (likely(READ_ONCE(l->nr_items) != LONG_MIN)) {
> - WARN_ON(l->nr_items < 0);
> + nr_items = READ_ONCE(l->nr_items);
> + if (likely(nr_items != LONG_MIN)) {
> + WARN_ON(nr_items < 0);
> rcu_read_unlock();
> return l;
> }
- Naresh
prev parent reply other threads:[~2024-10-03 5:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 11:10 Naresh Kamboju
2024-10-02 11:24 ` Dan Carpenter
2024-10-02 11:25 ` Dan Carpenter
2024-10-02 11:28 ` Dan Carpenter
2024-10-02 18:58 ` Kairui Song
2024-10-09 16:51 ` Dan Carpenter
2024-10-09 18:02 ` Kairui Song
2024-10-03 5:38 ` Naresh Kamboju [this message]
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=CA+G9fYvdzY+vWhPKPmyPDJNDqvH7AaU4HfKTFtgUwU+KTrD9_Q@mail.gmail.com \
--to=naresh.kamboju@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=anders.roxell@linaro.org \
--cc=arnd@arndb.de \
--cc=dan.carpenter@linaro.org \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkft-triage@lists.linaro.org \
--cc=regressions@lists.linux.dev \
/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