mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunsheng Lin <yunshenglin0825@gmail.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,
	Yunsheng Lin <linyunsheng@huawei.com>,
	Eric Dumazet <edumazet@google.com>,
	David Ahern <dsahern@kernel.org>
Subject: Re: [PATCH net-next v19 09/14] net: rename skb_copy_to_page_nocache() helper
Date: Sat, 5 Oct 2024 21:44:31 +0800	[thread overview]
Message-ID: <c9860411-fa9c-4e1b-bca2-a10e6737f9b0@gmail.com> (raw)
In-Reply-To: <CAKgT0UeSbXTXoOuTZS918pZQcCVZBXiTseN-NUBTGt71ctQ2Vw@mail.gmail.com>

On 10/4/2024 11:00 AM, Alexander Duyck wrote:
> On Tue, Oct 1, 2024 at 12:59 AM Yunsheng Lin <yunshenglin0825@gmail.com> wrote:
>>
>> Rename skb_copy_to_page_nocache() to skb_copy_to_va_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 | 10 ++++------
>>   net/ipv4/tcp.c     |  7 +++----
>>   net/kcm/kcmsock.c  |  7 +++----
>>   3 files changed, 10 insertions(+), 14 deletions(-)
>>
>> diff --git a/include/net/sock.h b/include/net/sock.h
>> index c58ca8dd561b..7d0b606d6251 100644
>> --- a/include/net/sock.h
>> +++ b/include/net/sock.h
>> @@ -2185,15 +2185,13 @@ 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_copy_to_va_nocache(struct sock *sk, struct iov_iter *from,
>> +                                        struct sk_buff *skb, char *va,
>> +                                        int copy)
>>   {
> 
> This new naming is kind of confusing. Currently the only other
> "skb_copy_to" functions are skb_copy_to_linear_data and
> skb_copy_to_linear_data_offset. The naming before basically indicated

I am not sure if the above "skb_copy_to" functions are really related
here, as they are in include/linux/skbuff.h and don't take '*sk' as
first input param.

As "skb_copy_to" function in include/net/sock.h does take '*sk' as first
input param, perhaps the "skb_copy_to" functions in include/net/sock.h
can be renamed to "sk_skb_copy_to" in the future as most of functions
do in include/net/sock.h

> which part of the skb the data was being copied into. So before we
> were copying into the "page" frags. With the new naming this function
> is much less clear as technically the linear data can also be a
> virtual address.

I guess it is ok to use it for linear data if there is a need, why
invent another function for the linear data when both linear data and
non-linear data can be used as a virtual address?

> 
> I would recommend maybe replacing "va" with "frag", "page_frag" or
> maybe "pfrag" as what we are doing is copying the data to one of the
> pages in the paged frags section of the skb before they are added to
> the skb itself.

Don't "frag", "page_frag" or "pfrag" also seem confusing enough that
it does not take any 'frag' as the input param?

Does skb_copy_data() make more sense here as it can work on both
linear and non-linear data, as skb_do_copy_data_nocache() and
skb_copy_to_page_nocache() in the same header file seem to have a
similar style?

  reply	other threads:[~2024-10-05 13:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01  7:58 [PATCH net-next v19 00/14] Replace page_frag with page_frag_cache for sk_page_frag() Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 01/14] mm: page_frag: add a test module for page_frag Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 02/14] mm: move the page fragment allocator from page_alloc into its own file Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 03/14] mm: page_frag: use initial zero offset for page_frag_alloc_align() Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 04/14] mm: page_frag: avoid caller accessing 'page_frag_cache' directly Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 05/14] xtensa: remove the get_order() implementation Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 06/14] mm: page_frag: reuse existing space for 'size' and 'pfmemalloc' Yunsheng Lin
2024-10-03 22:40   ` Alexander Duyck
2024-10-05 13:05     ` Yunsheng Lin
2024-10-06 16:07       ` Alexander Duyck
2024-10-01  7:58 ` [PATCH net-next v19 07/14] mm: page_frag: some minor refactoring before adding new API Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 08/14] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Yunsheng Lin
2024-10-03 23:52   ` Alexander Duyck
2024-10-01  7:58 ` [PATCH net-next v19 09/14] net: rename skb_copy_to_page_nocache() helper Yunsheng Lin
2024-10-04  3:00   ` Alexander Duyck
2024-10-05 13:44     ` Yunsheng Lin [this message]
2024-10-06 16:18       ` Alexander Duyck
2024-10-07 14:29         ` Yunsheng Lin
2024-10-07 18:49           ` Alexander Duyck
2024-10-01  7:58 ` [PATCH net-next v19 10/14] mm: page_frag: introduce prepare/probe/commit API Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 11/14] mm: page_frag: add testing for the newly added prepare API Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 12/14] net: replace page_frag with page_frag_cache Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 13/14] mm: page_frag: update documentation for page_frag Yunsheng Lin
2024-10-01  7:58 ` [PATCH net-next v19 14/14] mm: page_frag: add an entry in MAINTAINERS " 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=c9860411-fa9c-4e1b-bca2-a10e6737f9b0@gmail.com \
    --to=yunshenglin0825@gmail.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=linyunsheng@huawei.com \
    --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®