Avoid unnecessary nested min()/max() which reults in egregious macro expansion.
The nesting occurs when NET_SKB_PAD is used in a min() or max() invocation, for instance, various ethernet drivers wrap it in a max().
Not doing so results in an impact on build times.
Cc: stable@vger.kernel.org Fixes: 867046cc7027 ("minmax: relax check to allow comparison between unsigned arguments and signed constants") Signed-off-by: Lorenzo Stoakes lorenzo.stoakes@oracle.com --- include/linux/skbuff.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 29c3ea5b6e93..d53b296df504 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3164,7 +3164,11 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) */ #ifndef NET_SKB_PAD -#define NET_SKB_PAD max(32, L1_CACHE_BYTES) +#if L1_CACHE_BYTES < 32 +#define NET_SKB_PAD 32 +#else +#define NET_SKB_PAD L1_CACHE_BYTES +#endif #endif
int ___pskb_trim(struct sk_buff *skb, unsigned int len); -- 2.46.0
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#opti...
Rule: The upstream commit ID must be specified with a separate line above the commit text. Subject: [PATCH hotfix 6.11 v2 2/3] minmax: reduce min/max macro expansion in skbuff Link: https://lore.kernel.org/stable/a32131084038312529243bc22b06f0ee64c95fb6.1726...
Please ignore this mail if the patch is not relevant for upstream.
linux-stable-mirror@lists.linaro.org