linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: David Rientjes <rientjes@google.com>,
	Christoph Lameter <cl@linux.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	 LKML <linux-kernel@vger.kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	 Hyeonggon Yoo <42.hyeyoo@gmail.com>,
	Christian Brauner <brauner@kernel.org>, RCU <rcu@vger.kernel.org>,
	 Shakeel Butt <shakeel.butt@linux.dev>,
	"Uladzislau Rezki (Sony)" <urezki@gmail.com>
Subject: Re: [GIT PULL] slab updates for 6.11
Date: Wed, 18 Sep 2024 09:06:23 +0200	[thread overview]
Message-ID: <CAHk-=wjmu93njmUVqfkAbGKqHaOKFrTmgU2O=UkP3OOmpCjo4Q@mail.gmail.com> (raw)
In-Reply-To: <8d6c5d10-5750-4472-858c-eadc105453be@suse.cz>

On Mon, 16 Sept 2024 at 11:45, Vlastimil Babka <vbabka@suse.cz> wrote:
>
> There's a small conflict with the rcu tree:
> https://lore.kernel.org/lkml/20240812124748.3725011b@canb.auug.org.au/

Hmm. The conflict resolution is trivial, but the code itself looks buggy.

Look here, commit 2b55d6a42d14 ("rcu/kvfree: Add kvfree_rcu_barrier()
API") makes kvfree_rcu_queue_batch() do this:

        bool queued = false;
        ...
        for (i = 0; i < KFREE_N_BATCHES; i++) {
                ...
                        queued = queue_rcu_work(system_wq, &krwp->rcu_work);
        ...
        return queued;

and note how that return value is completely nonsensical. It doesn't
imply anything got queued. It's returning whether the *last* call to
queue_rcu_work() resulted in queued work.

There is no way the return value is meaningful that I can see, and
honestly, that means that the code in kvfree_rcu_barrier() looks
actively buggy, and at worst might be an endless loop

Now, maybe there's some reason why the code works fine, but it looks
really really wrong. Please fix.

The fix might be either a big comment about why it's ok, or making the
"queued" assignment be a '|=' instead, or perhaps breaking out of the
loop on the first successful queueing, or whatever.

But not this "randomly return _one_ value of many of the queuing success".

I've merged this, but I expect this to be fixed.

                  Linus


  reply	other threads:[~2024-09-18  7:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-16  9:45 Vlastimil Babka
2024-09-18  7:06 ` Linus Torvalds [this message]
2024-09-18 14:40   ` Uladzislau Rezki
2024-09-26 16:35     ` Vlastimil Babka
2024-09-26 16:40       ` Uladzislau Rezki
2024-09-26 16:46         ` Vlastimil Babka
2024-09-26 17:07           ` Uladzislau Rezki
2024-09-18  8:10 ` pr-tracker-bot
  -- strict thread matches above, loose matches on Subject: below --
2024-07-17 10:49 Vlastimil Babka
2024-07-18 23:06 ` pr-tracker-bot

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='CAHk-=wjmu93njmUVqfkAbGKqHaOKFrTmgU2O=UkP3OOmpCjo4Q@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rcu@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=urezki@gmail.com \
    --cc=vbabka@suse.cz \
    /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