[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABi4-ogRXQGc7ucKj=jp1AtNprZhn55g+TGhbYnfroMgZ+gVwQ@mail.gmail.com>
Date: Tue, 22 Apr 2025 11:03:11 -0700
From: Jordan Rife <jordan@...fe.io>
To: Martin KaFai Lau <martin.lau@...ux.dev>
Cc: Aditi Ghag <aditi.ghag@...valent.com>, Daniel Borkmann <daniel@...earbox.net>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>, Kuniyuki Iwashima <kuniyu@...zon.com>,
netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH v4 bpf-next 4/6] bpf: udp: Avoid socket skips and repeats
during iteration
On Mon, Apr 21, 2025 at 08:47:51PM -0700, Martin KaFai Lau wrote:
> On 4/19/25 8:58 AM, Jordan Rife wrote:
> > static void bpf_iter_udp_put_batch(struct bpf_udp_iter_state *iter)
> > {
> > - while (iter->cur_sk < iter->end_sk)
> > - sock_put(iter->batch[iter->cur_sk++].sock);
> > + union bpf_udp_iter_batch_item *item;
> > + unsigned int cur_sk = iter->cur_sk;
> > + __u64 cookie;
> > +
> > + /* Remember the cookies of the sockets we haven't seen yet, so we can
> > + * pick up where we left off next time around.
> > + */
> > + while (cur_sk < iter->end_sk) {
> > + item = &iter->batch[cur_sk++];
> > + cookie = __sock_gen_cookie(item->sock);
>
> This can be called in the start/stop which is preemptible. I suspect this
> should be sock_gen_cookie instead of __sock_gen_cookie. gen_cookie_next() is
> using this_cpu_ptr.
Good point, I will change this.
Jordan
Powered by blists - more mailing lists