Re: [PATCH] arm64: clear_user: align __arch_clear_user() to 128B for I-cache efficiency

From: Norman Herms

Date: Mon Nov 23 2026 - 11:53:04 EST


In reply to
https://lore.kernel.org/all/CAL2CeBzYkr-i_WTF_pF9QrqO4K8BE+Z7D8tUY_M-HJGwZeSUUw@xxxxxxxxxxxxxx/

Hi Will, Luke,

There is a layout-independent cause in clear_user.S itself: the loop
label sits in front of its alignment directive,

1: .p2align 4
USER(9f, sttr xzr, [x0])
...
b.hi 1b

so every iteration branches back into the padding. How many NOPs that
is depends on where the function lands, which would explain why
unrelated changes move the /dev/zero numbers. Moving the label after
the directive runs the padding once:

.p2align 4
1:

On an Allwinner A733 (Cortex-A55/A76, no MOPS) running 6.18.36, where
the padding was two NOPs, kernel instructions per MiB read from
/dev/zero went from 797k to 536k, and throughput rose 46% on the A55
and 25% on the A76. The layout dates from fe59e0358d9b ("arm64: lib:
Use MOPS for usercopy routines").

Measured on my board by AI agents, analysis with an AI assistant;
a report, not a Tested-by.

Norman