[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d42b574b-d546-1557-a61b-b183df84a991@intel.com>
Date: Wed, 15 Feb 2023 17:50:54 +0100
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Xuan Zhuo <xuanzhuo@...ux.alibaba.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
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.
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?
>
> I agree with you other opinions.
>
> Thanks.
Thanks,
Olek
Powered by blists - more mailing lists