netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: "Björn Töpel" <bjorn@kernel.org>,
	"Magnus Karlsson" <magnus.karlsson@intel.com>,
	"Maciej Fijalkowski" <maciej.fijalkowski@intel.com>,
	"Jonathan Lemon" <jonathan.lemon@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Jesper Dangaard Brouer" <hawk@kernel.org>,
	"John Fastabend" <john.fastabend@gmail.com>,
	bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v3] xsk: support use vaddr as ring
Date: Wed, 15 Feb 2023 17:50:54 +0100	[thread overview]
Message-ID: <d42b574b-d546-1557-a61b-b183df84a991@intel.com> (raw)
In-Reply-To: <1676425701.9314106-1-xuanzhuo@linux.alibaba.com>

From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Date: Wed, 15 Feb 2023 09:48:21 +0800

> On Tue, 14 Feb 2023 15:45:12 +0100, Alexander Lobakin <alexandr.lobakin@intel.com> wrote:
>> From: Xuan Zhuo <xuanzhuo@linux.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

  reply	other threads:[~2023-02-15 16:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  1:51 [PATCH net-next v3] xsk: support use vaddr as ring Xuan Zhuo
2023-02-14 14:45 ` Alexander Lobakin
2023-02-15  1:48   ` Xuan Zhuo
2023-02-15 16:50     ` Alexander Lobakin [this message]
2023-02-16  8:22       ` Xuan Zhuo
2023-02-14 17:05 ` kernel test robot

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=d42b574b-d546-1557-a61b-b183df84a991@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=xuanzhuo@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).