linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Uladzislau Rezki <urezki@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
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>
Subject: Re: [GIT PULL] slab updates for 6.11
Date: Thu, 26 Sep 2024 18:35:27 +0200	[thread overview]
Message-ID: <0295538a-4b79-42bf-b0e1-5a905749de1e@suse.cz> (raw)
In-Reply-To: <CA+KHdyV=0dpJX_v_tcuTQ-_ree-Yb9ch3F_HqfT4YnH8=zyWng@mail.gmail.com>

On 9/18/24 16:40, Uladzislau Rezki wrote:
>>
> Thank you for valuable feedback! Indeed it is hard to follow, even
> though it works correctly.
> I will add the comment and also break the loop on first queuing as you
> suggested!
> 
> It does not make sense to loop further because following iterations
> are never successful
> thus never overwrite "queued" variable(it never reaches the
> queue_rcu_work() call).
> 
> <snip>
>          bool queued = false;
>          ...
>          for (i = 0; i < KFREE_N_BATCHES; i++) {
>                 if (need_offload_krc(krcp)) {
>                          queued = queue_rcu_work(system_wq, &krwp->rcu_work);
>          ...
>          return queued;
> <snip>
> 
> if we queued, "if(need_offload_krc())" condition is never true anymore.
> 
> Below refactoring makes it clear. I will send the patch to address it.

Looks good, AFAICT. Can you send the full patch then? Thanks.

> <snip>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index a60616e69b66..b1f883fcd918 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3607,11 +3607,12 @@ kvfree_rcu_queue_batch(struct kfree_rcu_cpu *krcp)
>                         }
> 
>                         // One work is per one batch, so there are three
> -                       // "free channels", the batch can handle. It can
> -                       // be that the work is in the pending state when
> -                       // channels have been detached following by each
> -                       // other.
> +                       // "free channels", the batch can handle. Break
> +                       // the loop since it is done with this CPU thus
> +                       // queuing an RCU work is _always_ success here.
>                         queued = queue_rcu_work(system_unbound_wq,
> &krwp->rcu_work);
> +                       WARN_ON_ONCE(!queued);
> +                       break;
>                 }
>         }
> <snip>
> 
> Thanks!
> 



  reply	other threads:[~2024-09-26 16:35 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
2024-09-18 14:40   ` Uladzislau Rezki
2024-09-26 16:35     ` Vlastimil Babka [this message]
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=0295538a-4b79-42bf-b0e1-5a905749de1e@suse.cz \
    --to=vbabka@suse.cz \
    --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=torvalds@linux-foundation.org \
    --cc=urezki@gmail.com \
    /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