From: Yunsheng Lin <linyunsheng@huawei.com>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>,
David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH net-next v20 09/14] net: rename skb_copy_to_page_nocache() helper
Date: Thu, 10 Oct 2024 19:32:37 +0800 [thread overview]
Message-ID: <fa578d46-d898-4d29-b42b-cb93c57bdc5f@huawei.com> (raw)
In-Reply-To: <CAKgT0Ue_mp1JB2XffSx-9siR4V6u3U_jEyy91BUqTS9C6TJ5mw@mail.gmail.com>
On 2024/10/10 7:40, Alexander Duyck wrote:
> On Tue, Oct 8, 2024 at 4:27 AM Yunsheng Lin <linyunsheng@huawei.com> wrote:
>>
>> Rename skb_copy_to_page_nocache() to skb_add_frag_nocache()
>> to avoid calling virt_to_page() as we are about to pass virtual
>> address directly.
>>
>> CC: Alexander Duyck <alexander.duyck@gmail.com>
>> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
>> ---
>> include/net/sock.h | 9 +++------
>> net/ipv4/tcp.c | 7 +++----
>> net/kcm/kcmsock.c | 7 +++----
>> 3 files changed, 9 insertions(+), 14 deletions(-)
>>
>> diff --git a/include/net/sock.h b/include/net/sock.h
>> index e282127092ab..e0b4e2daca5d 100644
>> --- a/include/net/sock.h
>> +++ b/include/net/sock.h
>> @@ -2192,15 +2192,12 @@ static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb,
>> return err;
>> }
>>
>> -static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *from,
>> - struct sk_buff *skb,
>> - struct page *page,
>> - int off, int copy)
>> +static inline int skb_add_frag_nocache(struct sock *sk, struct iov_iter *from,
>> + struct sk_buff *skb, char *va, int copy)
>
> This is not adding a frag. It is copying to a frag. This naming is a
> hard no as there are functions that actually add frags to the skb and
> this is not what this is doing. It sounds like it should be some
> variant on skb_add_rx_frag and it isn't.
>
> Instead of "_add_" I would suggest you stick with "_copy_to_" as the
> action as the alternative would be confusing as it implies you are
> going to be adding this to frags yourself.
I though we had reached a agreement in [1]? I guessed the 'That works
for me' only refer to the 'sk_' prefix?
The argumemt is that "skb_add_data_nocache() does memcpy'ing to skb->data
and update skb->len only by calling skb_put()" without calling something as
pskb_expand_head() to add more tailroom, so skb_add_frag_nocache is mirroring
that.
Does it mean skb_add_data_nocache() may be renamed to skb_copy_to_data_nocache()
in the future?
1. https://lore.kernel.org/all/CAKgT0Ue=tX+hKWiXQaM-6ypZ8fGvcUagGKfVrNGtRHVuhMX80g@mail.gmail.com/
next prev parent reply other threads:[~2024-10-10 11:32 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 11:20 [PATCH net-next v20 00/14] Replace page_frag with page_frag_cache for sk_page_frag() Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 01/14] mm: page_frag: add a test module for page_frag Yunsheng Lin
2024-10-08 19:56 ` Shuah Khan
2024-10-09 3:59 ` Yunsheng Lin
2024-10-10 21:18 ` Shuah Khan
2024-10-08 11:20 ` [PATCH net-next v20 02/14] mm: move the page fragment allocator from page_alloc into its own file Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 03/14] mm: page_frag: use initial zero offset for page_frag_alloc_align() Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 04/14] mm: page_frag: avoid caller accessing 'page_frag_cache' directly Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 05/14] xtensa: remove the get_order() implementation Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 06/14] mm: page_frag: reuse existing space for 'size' and 'pfmemalloc' Yunsheng Lin
2024-10-09 23:50 ` Alexander Duyck
2024-10-10 11:32 ` Yunsheng Lin
2024-10-10 14:33 ` Alexander Duyck
2024-10-11 11:40 ` Yunsheng Lin
2024-10-11 15:31 ` Alexander Duyck
2024-10-08 11:20 ` [PATCH net-next v20 07/14] mm: page_frag: some minor refactoring before adding new API Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 08/14] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 09/14] net: rename skb_copy_to_page_nocache() helper Yunsheng Lin
2024-10-09 23:40 ` Alexander Duyck
2024-10-10 11:32 ` Yunsheng Lin [this message]
2024-10-10 14:39 ` Alexander Duyck
2024-10-08 11:20 ` [PATCH net-next v20 10/14] mm: page_frag: introduce prepare/probe/commit API Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 11/14] mm: page_frag: add testing for the newly added prepare API Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 12/14] net: replace page_frag with page_frag_cache Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 13/14] mm: page_frag: update documentation for page_frag Yunsheng Lin
2024-10-08 11:20 ` [PATCH net-next v20 14/14] mm: page_frag: add an entry in MAINTAINERS " Yunsheng Lin
2024-10-09 0:43 ` Jakub Kicinski
2024-10-09 4:01 ` Yunsheng Lin
2024-10-09 16:32 ` Paolo Abeni
2024-10-10 11:37 ` Yunsheng Lin
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=fa578d46-d898-4d29-b42b-cb93c57bdc5f@huawei.com \
--to=linyunsheng@huawei.com \
--cc=alexander.duyck@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@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®