Re: [PATCH net v9] skb_expand_head() adjust skb->truesize incorrectly

From: Eric Dumazet
Date: Wed Oct 20 2021 - 12:14:43 EST




On 10/4/21 10:57 PM, Vasily Averin wrote:

>>>
>>> diff --git a/net/core/sock.c b/net/core/sock.c
>>> index 62627e868e03..1932755ae9ba 100644
>>> --- a/net/core/sock.c
>>> +++ b/net/core/sock.c
>>> @@ -2227,6 +2227,14 @@ void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
>>> }
>>> EXPORT_SYMBOL(skb_set_owner_w);
>>>
>>> +bool is_skb_wmem(const struct sk_buff *skb)
>>> +{
>>> + return skb->destructor == sock_wfree ||
>>> + skb->destructor == __sock_wfree ||
>>> + (IS_ENABLED(CONFIG_INET) && skb->destructor == tcp_wfree);
>>> +}
>>> +EXPORT_SYMBOL(is_skb_wmem);
>>> +
>>
>> This probably should be inlined.
>
> David Miller pointed me out in the comments to an early version of the patch
> "Please do not use inline in foo.c files, let the compiler decide."
>

Sure, my suggestion was to move this helper in an include file,
and use

static inline bool ....

I would not suggest add an inline in a C file, unless absolutely critical.