]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net/sched: netem: reorder struct netem_sched_data
authorStephen Hemminger <stephen@networkplumber.org>
Sat, 9 May 2026 17:03:22 +0000 (10:03 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 14 May 2026 09:41:30 +0000 (11:41 +0200)
commit9371b229a1ced41ab6372f8a2fc33fe6af21efe9
tree758dc2dd6a6acd2c95d76af87e4738d48df9b0d1
parent18dc8e6d15d7a30888beec46a1e01ca0f98508fa
net/sched: netem: reorder struct netem_sched_data

The current layout of struct netem_sched_data can be improved
by optimizing cache locality, compacting data types (use u8
for enum) and eliminating unused elements.

Reorganize the struct as follows:

  - Cacheline 0 holds the tfifo state (t_root/t_head/t_tail/t_len),
    counter, and the unconditional enqueue scalars
    latency/jitter/rate/gap/loss.

  - Cacheline 1 holds the remaining zero-check scalars
    (duplicate/reorder/corrupt/ecn), all five crndstate correlation
    structures, and loss_model.

  - Cacheline 2 holds prng, delay_dist, the slot dequeue state,
    slot_dist, and the inner classful qdisc pointer.

  - Rate-shaping fields, q->limit (config-only; the fast path reads
    sch->limit), and the CLG Markov state move to the warm tail.

  - tc_netem_slot slot_config and qdisc_watchdog (only consulted on
    slot reschedule and watchdog wake) move to the cold tail.

Also reorder struct clgstate to place the u8 state member after the
u32 transition probabilities.  This removes the 3-byte interior hole
without changing the struct's size.

Should have no functional change.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Link: https://patch.msgid.link/20260509171123.307549-2-stephen@networkplumber.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/sched/sch_netem.c