diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2026-03-09 17:40:42 +0100 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-03-16 13:16:49 +0100 |
| commit | 2deccd5c862a0337a691bcfaa87919b4216e6103 (patch) | |
| tree | 159c143067bbb3d55cac77736cd8c2e629728793 /tools/perf/scripts/python | |
| parent | acb38872d4cbec5b6825345d9d757e21d2d9d953 (diff) | |
cleanup: Optimize guards
Andrew reported that a guard() conversion of zone_lock increased the
code size unnecessarily.
It turns out the unconditional __GUARD_IS_ERR() is to blame. As
explored earlier [1], __GUARD_IS_ERR(), similar to IS_ERR_OR_NULL(),
generates somewhat sub-optimal code.
However, looking at things again, it is possible to avoid doing the
__GUARD_IS_ERR() unconditionally. Revert the normal destructors to a
simple NULL test and only add the IS_ERR bit to COND guards.
This cures the reported overhead; as compiled by GCC-16:
page_alloc.o:
pre: Total: Before=45299, After=45371, chg +0.16%
post: Total: Before=45299, After=45026, chg -0.60%
[1] https://lkml.kernel.org/r/20250513085001.GC25891@noisy.programming.kicks-ass.net
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Dan Williams <dan.j.williams@intel.com>
Link: https://patch.msgid.link/20260309164516.GE606826@noisy.programming.kicks-ass.net
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
