lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQJsDYhNmP6G7O8tVfHZ7rQLeJ4KpwAQweVidny0fgTbyw@mail.gmail.com>
Date:   Wed, 17 Aug 2022 09:41:14 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Punit Agrawal <punit.agrawal@...edance.com>
Cc:     Alexei Starovoitov <ast@...nel.org>, bpf <bpf@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Feng Zhou <zhoufeng.zf@...edance.com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <martin.lau@...ux.dev>,
        Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>, Jiri Olsa <jolsa@...nel.org>
Subject: Re: [PATCH] bpf: Simplify code by using for_each_cpu_wrap()

On Wed, Aug 17, 2022 at 6:08 AM Punit Agrawal
<punit.agrawal@...edance.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!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ