From: Paolo Abeni <pabeni@redhat.com>
To: Alexander H Duyck <alexander.duyck@gmail.com>, netdev@vger.kernel.org
Cc: Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next] net: skb: introduce and use a single page frag cache
Date: Wed, 21 Sep 2022 22:51:58 +0200 [thread overview]
Message-ID: <d347ab0f1a1aaf370d7d2908122bd886c02ec983.camel@redhat.com> (raw)
In-Reply-To: <1642882091e772bcdbf44e61fe5fce125a034e52.camel@gmail.com>
On Wed, 2022-09-21 at 13:23 -0700, Alexander H Duyck wrote:
> On Wed, 2022-09-21 at 21:33 +0200, Paolo Abeni wrote:
> > Nice! I'll use that in v2, with page_ref_add(page, offset / SZ_1K - 1);
> > or we will leak the page.
>
> No, the offset already takes care of the -1 via the "- SZ_1K". What we
> are adding is references for the unused offset.
You are right. For some reasons I keep reading PAGE_SIZE instead of
'offset'.
> > >
> It occurs to me that I think you are missing the check for the gfp_mask
> and the reclaim and DMA flags values as a result with your change. I
> think we will need to perform that check before we can do the direct
> page allocation based on size.
Yes, the gtp_mask checks are required (it just stuck me a few moments
ago ;). I will move the code as you originally suggested.
> > >
> > Why? in the end we will still use an ancillary variable and the
> > napi_alloc_cache struct will be bigger (probaly not very relevant, but
> > for no gain at all).
>
> It was mostly just about reducing instructions. The thought is we could
> get rid of the storage of the napi cache entirely since the only thing
> used is the page member, so if we just passed that around instead it
> would save us the trouble and not really be another variable. Basically
> we would be passing a frag cache pointer instead of a napi_alloc_cache.
In that case we will still duplicate a bit of code -
this_cpu_ptr(&napi_alloc_cache) on both branches. gcc 11.3.1 here says
that the generated code is smaller without this change.
Cheers,
Paolo
next prev parent reply other threads:[~2022-09-21 20:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 16:41 [PATCH net-next] net: skb: introduce and use a single page frag cache Paolo Abeni
2022-09-21 17:18 ` Eric Dumazet
2022-09-21 18:10 ` Paolo Abeni
2022-09-21 18:11 ` Alexander H Duyck
2022-09-21 19:33 ` Paolo Abeni
2022-09-21 20:21 ` Paolo Abeni
2022-09-21 20:23 ` Alexander H Duyck
2022-09-21 20:51 ` Paolo Abeni [this message]
2022-09-21 21:44 ` Alexander Duyck
2022-09-22 16:29 ` Paolo Abeni
2022-09-22 20:21 ` Paolo Abeni
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=d347ab0f1a1aaf370d7d2908122bd886c02ec983.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=alexander.duyck@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/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