From: Punit Agrawal <punit.agrawal@bytedance.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Punit Agrawal <punit.agrawal@bytedance.com>,
Alexei Starovoitov <ast@kernel.org>, bpf <bpf@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Feng Zhou <zhoufeng.zf@bytedance.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>, Jiri Olsa <jolsa@kernel.org>
Subject: Re: Re: [PATCH] bpf: Simplify code by using for_each_cpu_wrap()
Date: Wed, 17 Aug 2022 17:57:29 +0100 [thread overview]
Message-ID: <87o7wierk6.fsf_-_@stealth> (raw)
In-Reply-To: <CAADnVQJsDYhNmP6G7O8tVfHZ7rQLeJ4KpwAQweVidny0fgTbyw@mail.gmail.com> (Alexei Starovoitov's message of "Wed, 17 Aug 2022 09:41:14 -0700")
Hi Alexei,
Alexei Starovoitov <alexei.starovoitov@gmail.com> writes:
> On Wed, Aug 17, 2022 at 6:08 AM Punit Agrawal
> <punit.agrawal@bytedance.com> wrote:
>>
>> No functional change intended.
>
> ?
>
>> - orig_cpu = cpu = raw_smp_processor_id();
>> - while (1) {
>> + for_each_cpu_wrap(cpu, cpu_possible_mask, raw_smp_processor_id()) {
>> struct pcpu_freelist_head *head;
>>
>> head = per_cpu_ptr(s->freelist, cpu);
>> @@ -68,15 +67,10 @@ static inline void ___pcpu_freelist_push_nmi(struct pcpu_freelist *s,
>> raw_spin_unlock(&head->lock);
>> return;
>> }
>> - cpu = cpumask_next(cpu, cpu_possible_mask);
>> - if (cpu >= nr_cpu_ids)
>> - cpu = 0;
>> -
>> - /* cannot lock any per cpu lock, try extralist */
>> - if (cpu == orig_cpu &&
>> - pcpu_freelist_try_push_extra(s, node))
>> - return;
>> }
>> +
>> + /* cannot lock any per cpu lock, try extralist */
>> + pcpu_freelist_try_push_extra(s, node);
>
> This is obviously not equivalent!
Thanks for taking a look. You're right - I missed the fact that it's an
infinite loop until the node gets pushed to one of the lists.
I'll send an update with that fixed up.
prev parent reply other threads:[~2022-08-17 16:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 13:08 [PATCH] bpf: Simplify code by using for_each_cpu_wrap() Punit Agrawal
2022-08-17 16:41 ` Alexei Starovoitov
2022-08-17 16:57 ` Punit Agrawal [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=87o7wierk6.fsf_-_@stealth \
--to=punit.agrawal@bytedance.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=song@kernel.org \
--cc=yhs@fb.com \
--cc=zhoufeng.zf@bytedance.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