[PATCH net-next v2 0/9] net: Remove unused function parameters in skbuff.c

Michal Luczaj posted 9 patches 3 months, 2 weeks ago
There is a newer version of this series
.../chelsio/inline_crypto/chtls/chtls_io.c         |  3 +-
include/linux/skbuff.h                             |  5 ++-
net/core/skbuff.c                                  | 37 ++++++++--------------
net/ipv4/ip_output.c                               |  3 +-
net/ipv4/tcp.c                                     |  7 ++--
net/ipv6/ip6_output.c                              |  3 +-
net/kcm/kcmsock.c                                  |  5 ++-
net/smc/smc_rx.c                                   |  1 -
net/tls/tls_sw.c                                   |  2 +-
net/unix/af_unix.c                                 |  7 ++--
10 files changed, 26 insertions(+), 47 deletions(-)
[PATCH net-next v2 0/9] net: Remove unused function parameters in skbuff.c
Posted by Michal Luczaj 3 months, 2 weeks ago
Couple of cleanup patches to get rid of unused function parameters around
skbuff.c, plus little things spotted along the way.

Offshoot of my question in [1], but way more contained. Found by adding
"-Wunused-parameter -Wno-error" to KBUILD_CFLAGS and grepping for specific
skbuff.c warnings.

[1]: https://lore.kernel.org/netdev/972af569-0c90-4585-9e1f-f2266dab6ec6@rbox.co/

Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
Changes in v2:
- Fix typos in commit messages
- Remove one more unused parameter in skbuff.c (patch 9)
- Collect R-b, add a one-line cleanup of smc_rx_splice() (patch 7) [Simon]
- Link to v1: https://lore.kernel.org/r/20250624-splice-drop-unused-v1-0-cf641a676d04@rbox.co

---
Michal Luczaj (9):
      net: splice: Drop unused @pipe
      net: splice: Drop unused @flags
      tcp: Drop tcp_splice_state::flags
      af_unix: Drop unix_stream_read_state::splice_flags
      net: splice: Drop unused @gfp
      net: splice: Drop nr_pages_max initialization
      net/smc: Drop nr_pages_max initialization
      net: skbuff: Drop unused @skb
      net: skbuff: Drop unused @skb

 .../chelsio/inline_crypto/chtls/chtls_io.c         |  3 +-
 include/linux/skbuff.h                             |  5 ++-
 net/core/skbuff.c                                  | 37 ++++++++--------------
 net/ipv4/ip_output.c                               |  3 +-
 net/ipv4/tcp.c                                     |  7 ++--
 net/ipv6/ip6_output.c                              |  3 +-
 net/kcm/kcmsock.c                                  |  5 ++-
 net/smc/smc_rx.c                                   |  1 -
 net/tls/tls_sw.c                                   |  2 +-
 net/unix/af_unix.c                                 |  7 ++--
 10 files changed, 26 insertions(+), 47 deletions(-)
---
base-commit: a9b24b3583ae1da7dbda031f141264f2da260219
change-id: 20250618-splice-drop-unused-0e4ea8a12681

Best regards,
-- 
Michal Luczaj <mhal@rbox.co>
Re: [PATCH net-next v2 0/9] net: Remove unused function parameters in skbuff.c
Posted by Jakub Kicinski 3 months, 1 week ago
On Thu, 26 Jun 2025 10:33:33 +0200 Michal Luczaj wrote:
> Couple of cleanup patches to get rid of unused function parameters around
> skbuff.c, plus little things spotted along the way.
> 
> Offshoot of my question in [1], but way more contained. Found by adding
> "-Wunused-parameter -Wno-error" to KBUILD_CFLAGS and grepping for specific
> skbuff.c warnings.

I feel a little ambivalent about the removal of the flags arguments.
I understand that they are unused now, but theoretically the operation
as a whole has flags so it's not crazy to pass them along.. Dunno.
Re: [PATCH net-next v2 0/9] net: Remove unused function parameters in skbuff.c
Posted by Michal Luczaj 3 months, 1 week ago
On 7/1/25 03:18, Jakub Kicinski wrote:
> On Thu, 26 Jun 2025 10:33:33 +0200 Michal Luczaj wrote:
>> Couple of cleanup patches to get rid of unused function parameters around
>> skbuff.c, plus little things spotted along the way.
>>
>> Offshoot of my question in [1], but way more contained. Found by adding
>> "-Wunused-parameter -Wno-error" to KBUILD_CFLAGS and grepping for specific
>> skbuff.c warnings.
> 
> I feel a little ambivalent about the removal of the flags arguments.
> I understand that they are unused now, but theoretically the operation
> as a whole has flags so it's not crazy to pass them along.. Dunno.

I suspect you can say the same about @gfp. Even though they've both became
irrelevant for the functions that define them. But I understand your
hesitation. Should I post v3 without this/these changes?

What's netdev's stance on using __always_unused in such cases?

Thanks,
Michal
Re: [PATCH net-next v2 0/9] net: Remove unused function parameters in skbuff.c
Posted by Paolo Abeni 3 months, 1 week ago
On 7/1/25 9:27 AM, Michal Luczaj wrote:
> On 7/1/25 03:18, Jakub Kicinski wrote:
>> On Thu, 26 Jun 2025 10:33:33 +0200 Michal Luczaj wrote:
>>> Couple of cleanup patches to get rid of unused function parameters around
>>> skbuff.c, plus little things spotted along the way.
>>>
>>> Offshoot of my question in [1], but way more contained. Found by adding
>>> "-Wunused-parameter -Wno-error" to KBUILD_CFLAGS and grepping for specific
>>> skbuff.c warnings.
>>
>> I feel a little ambivalent about the removal of the flags arguments.
>> I understand that they are unused now, but theoretically the operation
>> as a whole has flags so it's not crazy to pass them along.. Dunno.
> 
> I suspect you can say the same about @gfp. Even though they've both became
> irrelevant for the functions that define them. But I understand your
> hesitation. Should I post v3 without this/these changes?

Yes please, I think it would make the series less controversial.

Also I feel like the gfp flag removal is less controversial, as is IMHO
reasonable that skb_splice_from_iter() would not allocate any memory.

Thanks,

Paolo
Re: [PATCH net-next v2 0/9] net: Remove unused function parameters in skbuff.c
Posted by Jakub Kicinski 3 months, 1 week ago
On Tue, 1 Jul 2025 11:02:50 +0200 Paolo Abeni wrote:
> >> I feel a little ambivalent about the removal of the flags arguments.
> >> I understand that they are unused now, but theoretically the operation
> >> as a whole has flags so it's not crazy to pass them along.. Dunno.  
> > 
> > I suspect you can say the same about @gfp. Even though they've both became
> > irrelevant for the functions that define them. But I understand your
> > hesitation. Should I post v3 without this/these changes?  
> 
> Yes please, I think it would make the series less controversial.
> 
> Also I feel like the gfp flag removal is less controversial, as is IMHO
> reasonable that skb_splice_from_iter() would not allocate any memory.

+1, FWIW, gfp flags are more as need be the callee.

> > What's netdev's stance on using __always_unused in such cases?

Subjectively, I find the unused argument warnings in the kernel
to usually be counter-productive. If a maintainer of a piece of code
wants to clean them up -- perfectly fine. But taking cleanup patches
and annotating with __always_unused doesn't see very productive.
Re: [PATCH net-next v2 0/9] net: Remove unused function parameters in skbuff.c
Posted by Michal Luczaj 3 months, 1 week ago
On 7/2/25 01:52, Jakub Kicinski wrote:
> On Tue, 1 Jul 2025 11:02:50 +0200 Paolo Abeni wrote:
>>>> I feel a little ambivalent about the removal of the flags arguments.
>>>> I understand that they are unused now, but theoretically the operation
>>>> as a whole has flags so it's not crazy to pass them along.. Dunno.  
>>>
>>> I suspect you can say the same about @gfp. Even though they've both became
>>> irrelevant for the functions that define them. But I understand your
>>> hesitation. Should I post v3 without this/these changes?  
>>
>> Yes please, I think it would make the series less controversial.
>>
>> Also I feel like the gfp flag removal is less controversial, as is IMHO
>> reasonable that skb_splice_from_iter() would not allocate any memory.
> 
> +1, FWIW, gfp flags are more as need be the callee.

OK, here's v3 with @flags untouched:
https://lore.kernel.org/netdev/20250702-splice-drop-unused-v3-0-55f68b60d2b7@rbox.co/

>>> What's netdev's stance on using __always_unused in such cases?
> 
> Subjectively, I find the unused argument warnings in the kernel
> to usually be counter-productive. If a maintainer of a piece of code
> wants to clean them up -- perfectly fine. But taking cleanup patches
> and annotating with __always_unused doesn't see very productive.

Go it, thanks.

Michal