mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
![]() net_dim() is currently passed a struct dim_sample argument by value. struct dim_sample is 24 bytes. Since this is greater 16 bytes, x86-64 passes it on the stack. All callers have already initialized dim_sample on the stack, so passing it by value requires pushing a duplicated copy to the stack. Either witing to the stack and immediately reading it, or perhaps dereferencing addresses relative to the stack pointer in a chain of push instructions, seems to perform quite poorly. In a heavy TCP workload, mlx5e_handle_rx_dim() consumes 3% of CPU time, 94% of which is attributed to the first push instruction to copy dim_sample on the stack for the call to net_dim(): // Call ktime_get() 0.26 |4ead2: call 4ead7 <mlx5e_handle_rx_dim+0x47> // Pass the address of struct dim in %rdi |4ead7: lea 0x3d0(%rbx),%rdi // Set dim_sample.pkt_ctr |4eade: mov %r13d,0x8(%rsp) // Set dim_sample.byte_ctr |4eae3: mov %r12d,0xc(%rsp) // Set dim_sample.event_ctr 0.15 |4eae8: mov %bp,0x10(%rsp) // Duplicate dim_sample on the stack 94.16 |4eaed: push 0x10(%rsp) 2.79 |4eaf1: push 0x10(%rsp) 0.07 |4eaf5: push %rax // Call net_dim() 0.21 |4eaf6: call 4eafb <mlx5e_handle_rx_dim+0x6b> To allow the caller to reuse the struct dim_sample already on the stack, pass the struct dim_sample by reference to net_dim(). Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Shannon Nelson <shannon.nelson@amd.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Arthur Kiyanovski <akiyano@amazon.com> Reviewed-by: Louis Peens <louis.peens@corigine.com> Link: https://patch.msgid.link/20241031002326.3426181-2-csander@purestorage.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> |
||
---|---|---|
.. | ||
devlink | ||
ice.h | ||
ice_adapter.c | ||
ice_adapter.h | ||
ice_adminq_cmd.h | ||
ice_arfs.c | ||
ice_arfs.h | ||
ice_base.c | ||
ice_base.h | ||
ice_cgu_regs.h | ||
ice_common.c | ||
ice_common.h | ||
ice_controlq.c | ||
ice_controlq.h | ||
ice_dcb.c | ||
ice_dcb.h | ||
ice_dcb_lib.c | ||
ice_dcb_lib.h | ||
ice_dcb_nl.c | ||
ice_dcb_nl.h | ||
ice_ddp.c | ||
ice_ddp.h | ||
ice_debugfs.c | ||
ice_devids.h | ||
ice_dpll.c | ||
ice_dpll.h | ||
ice_eswitch.c | ||
ice_eswitch.h | ||
ice_eswitch_br.c | ||
ice_eswitch_br.h | ||
ice_ethtool.c | ||
ice_ethtool.h | ||
ice_ethtool_fdir.c | ||
ice_fdir.c | ||
ice_fdir.h | ||
ice_flex_pipe.c | ||
ice_flex_pipe.h | ||
ice_flex_type.h | ||
ice_flow.c | ||
ice_flow.h | ||
ice_fltr.c | ||
ice_fltr.h | ||
ice_fw_update.c | ||
ice_fw_update.h | ||
ice_fwlog.c | ||
ice_fwlog.h | ||
ice_gnss.c | ||
ice_gnss.h | ||
ice_hw_autogen.h | ||
ice_hwmon.c | ||
ice_hwmon.h | ||
ice_idc.c | ||
ice_idc_int.h | ||
ice_irq.c | ||
ice_irq.h | ||
ice_lag.c | ||
ice_lag.h | ||
ice_lan_tx_rx.h | ||
ice_lib.c | ||
ice_lib.h | ||
ice_main.c | ||
ice_nvm.c | ||
ice_nvm.h | ||
ice_osdep.h | ||
ice_parser.c | ||
ice_parser.h | ||
ice_parser_rt.c | ||
ice_pf_vsi_vlan_ops.c | ||
ice_pf_vsi_vlan_ops.h | ||
ice_protocol_type.h | ||
ice_ptp.c | ||
ice_ptp.h | ||
ice_ptp_consts.h | ||
ice_ptp_hw.c | ||
ice_ptp_hw.h | ||
ice_repr.c | ||
ice_repr.h | ||
ice_sbq_cmd.h | ||
ice_sched.c | ||
ice_sched.h | ||
ice_sf_eth.c | ||
ice_sf_eth.h | ||
ice_sf_vsi_vlan_ops.c | ||
ice_sf_vsi_vlan_ops.h | ||
ice_sriov.c | ||
ice_sriov.h | ||
ice_switch.c | ||
ice_switch.h | ||
ice_tc_lib.c | ||
ice_tc_lib.h | ||
ice_trace.h | ||
ice_txrx.c | ||
ice_txrx.h | ||
ice_txrx_lib.c | ||
ice_txrx_lib.h | ||
ice_type.h | ||
ice_vf_lib.c | ||
ice_vf_lib.h | ||
ice_vf_lib_private.h | ||
ice_vf_mbx.c | ||
ice_vf_mbx.h | ||
ice_vf_vsi_vlan_ops.c | ||
ice_vf_vsi_vlan_ops.h | ||
ice_virtchnl.c | ||
ice_virtchnl.h | ||
ice_virtchnl_allowlist.c | ||
ice_virtchnl_allowlist.h | ||
ice_virtchnl_fdir.c | ||
ice_virtchnl_fdir.h | ||
ice_vlan.h | ||
ice_vlan_mode.c | ||
ice_vlan_mode.h | ||
ice_vsi_vlan_lib.c | ||
ice_vsi_vlan_lib.h | ||
ice_vsi_vlan_ops.c | ||
ice_vsi_vlan_ops.h | ||
ice_xsk.c | ||
ice_xsk.h | ||
Makefile |