[Devel] [PATCH RHEL10 COMMIT] ms/net: add noinline __init __no_profile to skb_extensions_init() for GCOV compatibility

Konstantin Khorenko khorenko at virtuozzo.com
Wed Apr 22 17:24:23 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-55.52.1.5.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.52.1.5.21.vz10
------>
commit 78a27f73cbfc72f03f6390bbeada2c04f109da50
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Apr 10 19:21:50 2026 +0300

    ms/net: add noinline __init __no_profile to skb_extensions_init() for GCOV compatibility
    
    With -fprofile-update=atomic in global CFLAGS_GCOV, GCC still cannot
    constant-fold the skb_ext_total_length() loop when it is inlined into a
    profiled caller.  The existing __no_profile on skb_ext_total_length()
    itself is insufficient because after __always_inline expansion the code
    resides in the caller's body, which still carries GCOV instrumentation.
    
    Mark skb_extensions_init() with __no_profile so the BUILD_BUG_ON checks
    can be evaluated at compile time.  Also mark it noinline to prevent the
    compiler from inlining it into skb_init() (which lacks __no_profile),
    which would re-expose the function body to GCOV instrumentation.
    
    Add __init since skb_extensions_init() is only called from __init
    skb_init().  Previously it was implicitly inlined into the .init.text
    section; with noinline it would otherwise remain in permanent .text,
    wasting memory after boot.
    
    Build-tested with both CONFIG_GCOV_PROFILE_ALL=y and
    CONFIG_KCOV_INSTRUMENT_ALL=y.
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    Link: https://patch.msgid.link/20260410162150.3105738-3-khorenko@virtuozzo.com
    Signed-off-by: Jakub Kicinski <kuba at kernel.org>
    
    https://virtuozzo.atlassian.net/browse/VSTOR-127788
    https://virtuozzo.atlassian.net/browse/VSTOR-128012
    (cherry picked from linux-next commit 29b1ee8788c5fe03588e06adf0868008305d9b01)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    
    Feature: fix ms/gcov
---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index d05be5d81d3b4..da35e4cb28e86 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5061,7 +5061,7 @@ static __always_inline __no_profile unsigned int skb_ext_total_length(void)
 	return l;
 }
 
-static void skb_extensions_init(void)
+static noinline void __init __no_profile skb_extensions_init(void)
 {
 	BUILD_BUG_ON(SKB_EXT_NUM >= 8);
 	BUILD_BUG_ON(skb_ext_total_length() > 255);


More information about the Devel mailing list