In dev_map_bpf_prog_run(), xdp.txq and xdp.rxq are assigned the same stack-local pointers on every iteration. xdp_convert_frame_to_buff() does not modify these fields, so the assignments are loop-invariant. Hoist them before the loop, matching the pattern already used by cpu_map_bpf_prog_run_xdp() in cpumap.c. No functional change. Signed-off-by: Anand Kumar Shaw --- kernel/bpf/devmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index 2625601de..568477ce7 100644 --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c @@ -341,14 +341,15 @@ static int dev_map_bpf_prog_run(struct bpf_prog *xdp_prog, struct xdp_buff xdp; int i, nframes = 0; + xdp.txq = &txq; + xdp.rxq = &rxq; + for (i = 0; i < n; i++) { struct xdp_frame *xdpf = frames[i]; u32 act; int err; xdp_convert_frame_to_buff(xdpf, &xdp); - xdp.txq = &txq; - xdp.rxq = &rxq; act = bpf_prog_run_xdp(xdp_prog, &xdp); switch (act) { -- 2.39.5 (Apple Git-154)