net: xdp: Give compiler __always_inline hint for xdp_rxq_info_init()
Subsystems (4)
PATCH 1/1 net: xdp: Give compiler __always_inline hint for xdp_rxq_info_init()
The function has only a statement of calling memset() to clear xdp_rxq object. Let it always be an inline function.
Signed-off-by Leesoo Ahn <[email protected]>
--- net/core/xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/xdp.c +1 -1
@@ -151,7 +151,7 @@ void xdp_rxq_info_unreg(struct xdp_rxq_info *xdp_rxq) }EXPORT_SYMBOL_GPL (xdp_rxq_info_unreg); -static void xdp_rxq_info_init (struct xdp_rxq_info *xdp_rxq) +static __always_inline void xdp_rxq_info_init(struct xdp_rxq_info *xdp_rxq) {memset (xdp_rxq,0 ,sizeof (*xdp_rxq)); }
Signature · 1 line
2.26.2
Quoted 2 lines · On Mon, 30 Nov 2020 20:48:25 +0900 Leesoo Ahn <[email protected]> wrote:
The function has only a statement of calling
memset()to clearxdp_rxqobject. Let it always be an inline function.
No, this is the wrong approach.
The function is already "static", and the compiler have likely already inlined this code, but we leave it up to the compiler to choose. Besides this is slowpath code, why are you even trying to optimize this?
Quoted 18 lines
Signed-off-by Leesoo Ahn <[email protected]>--- net/core/xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/core/xdp.c +1
-1@@ -151,7 +151,7 @@ void xdp_rxq_info_unreg(struct xdp_rxq_info *xdp_rxq) }EXPORT_SYMBOL_GPL (xdp_rxq_info_unreg); -static void xdp_rxq_info_init (struct xdp_rxq_info *xdp_rxq) +static __always_inline void xdp_rxq_info_init(struct xdp_rxq_info *xdp_rxq) {memset (xdp_rxq,0 ,sizeof (*xdp_rxq)); }
Signature · 4 lines
Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer