[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1676535726.8031962-1-xuanzhuo@linux.alibaba.com>
Date: Thu, 16 Feb 2023 16:22:06 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: Alexander Lobakin <aleksander.lobakin@...el.com>
Cc: Björn Töpel <bjorn@...nel.org>,
Magnus Karlsson <magnus.karlsson@...el.com>,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Jonathan Lemon <jonathan.lemon@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
<bpf@...r.kernel.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next v3] xsk: support use vaddr as ring
On Wed, 15 Feb 2023 17:50:54 +0100, Alexander Lobakin <aleksander.lobakin@...el.com> wrote:
> From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> Date: Wed, 15 Feb 2023 09:48:21 +0800
>
> > On Tue, 14 Feb 2023 15:45:12 +0100, Alexander Lobakin <alexandr.lobakin@...el.com> wrote:
> >> From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> >> Date: Tue, 14 Feb 2023 09:51:12 +0800
> >>
> >>> When we try to start AF_XDP on some machines with long running time, due
> >>> to the machine's memory fragmentation problem, there is no sufficient
> >>> contiguous physical memory that will cause the start failure.
> >>
> >> [...]
> >>
> >>> @@ -1319,13 +1317,10 @@ static int xsk_mmap(struct file *file, struct socket *sock,
> >>>
> >>> /* Matches the smp_wmb() in xsk_init_queue */
> >>> smp_rmb();
> >>> - qpg = virt_to_head_page(q->ring);
> >>> - if (size > page_size(qpg))
> >>> + if (size > PAGE_ALIGN(q->ring_size))
> >>
> >> You can set q->ring_size as PAGE_ALIGN(size) already at the allocation
> >> to simplify this. I don't see any other places where you use it.
> >
> > That's it, but I think it is not particularly appropriate to change the
> > the semantics of ring_size just for simplify this code. This may make
> > people feel strange.
>
> You can name it 'vmalloc_size' then. By "ring_size" I first of all
> assume the number of elements, not the allocation size.
Maybe "ring_vmalloc_size"
>
> Also, wait, shouldn't you do this PAGE_ALIGN() *before* you actually
> vmalloc() it? Can't here be out-of-bounds with the current approach?
vmalloc_user() will do PAGE_ALIGN().
Thanks.
>
> >
> > I agree with you other opinions.
> >
> > Thanks.
>
> Thanks,
> Olek
Powered by blists - more mailing lists