mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: Byungchul Park <byungchul@sk.com>
Cc: Mina Almasry <almasrymina@google.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, hawk@kernel.org,
	toke@redhat.com, kernel_team@skhynix.com
Subject: Re: [RFC net-next] netmem: replace __netmem_clear_lsb() with netmem_to_nmdesc()
Date: Tue, 29 Jul 2025 10:11:49 +0100	[thread overview]
Message-ID: <1dbe988f-5703-4ccc-8f53-dea455192983@gmail.com> (raw)
In-Reply-To: <20250729011711.GE56089@system.software.com>

On 7/29/25 02:17, Byungchul Park wrote:
> On Mon, Jul 28, 2025 at 07:58:13PM +0100, Pavel Begunkov wrote:
>> On 7/28/25 19:46, Pavel Begunkov wrote:
>>> On 7/28/25 18:44, Mina Almasry wrote:
>>>> On Sun, Jul 27, 2025 at 9:21 PM Byungchul Park <byungchul@sk.com> wrote:
...>>
>>
>>> info to the compiler to optimise it out without assumptions on
>>> the layouts nor NET_IOV_ASSERT_OFFSET. Currently it's not so bad,
>>> but we should be able to remove this test+cmove.
>>>
>>>       movq    %rdi, %rax    # netmem, tmp105
>>>       andq    $-2, %rax    #, tmp105
>>>       testb    $1, %dil    #, netmem
>>>       cmove    %rdi, %rax    # tmp105,, netmem, <retval>
>>>       jmp    __x86_return_thunk
>>
>> struct netmem_desc *netmem_to_nmdesc(netmem_ref netmem)
>> {
>>         void *p = (void *)((__force unsigned long)netmem & ~NET_IOV);
>>
>>         if (netmem_is_net_iov(netmem))
>>                 return &((struct net_iov *)p)->desc;
>>         return __pp_page_to_nmdesc((struct page *)p);
>> }
> 
> I wanted to remove constraints that can be removed, but Mina want not to
> add additional overhead more.  So I'm thinking to keep the constraint,
> 'netmem_desc is the first member of net_iov'.
> 
> Thoughts?

We don't want extra overhead, the function above doesn't add
any, so just use it. You don't need to explicitly check that
layouts match.

-- 
Pavel Begunkov


  reply	other threads:[~2025-07-29  9:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-28  4:20 Byungchul Park
2025-07-28  5:35 ` Byungchul Park
2025-07-28 17:44 ` Mina Almasry
2025-07-28 18:46   ` Pavel Begunkov
2025-07-28 18:58     ` Pavel Begunkov
2025-07-29  1:17       ` Byungchul Park
2025-07-29  9:11         ` Pavel Begunkov [this message]
2025-07-29  1:10   ` Byungchul Park

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=1dbe988f-5703-4ccc-8f53-dea455192983@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=almasrymina@google.com \
    --cc=byungchul@sk.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=kernel_team@skhynix.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=toke@redhat.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

all inboxes | Powered by JetHome®