mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jirka Hladky <jhladky@redhat.com>
To: will@kernel.org
Cc: catalin.marinas@arm.com, kristina.martsenko@arm.com,
	luyang@redhat.com, dockseed@proton.me, jmario@redhat.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] arm64: clear_user: keep alignment padding out of the zeroing loop
Date: Wed, 25 Nov 2026 02:56:18 +0100	[thread overview]
Message-ID: <20261125015618.1331650-1-jhladky@redhat.com> (raw)
In-Reply-To: <20261124233043.1289050-1-jhladky@redhat.com>

Hi Will,

Some additional measurements supporting the patch, to quantify the
impact beyond the /dev/zero benchmark. Since the fixed loop is the
generic zero-fill-to-userspace primitive (clear_user() /
iov_iter_zero()), the impact scales with the number of zero-filled
bytes in any workload. Same A/B pair as the commit message (Ampere
Altra, Neoverse N1, two kernels built from one tree, differing only
in the label move):

O_DIRECT read of a sparse NTFS3 file (2 GiB, fully sparse; ntfs3
zero-fills such reads directly into the user buffer via
iov_iter_zero(), no page cache involved):

  kernel instructions per MiB:    791.1k -> 528.8k
  throughput:                     11.9 GB/s -> 25.6 GB/s (+116%)

The instruction delta is again exactly the two removed NOPs (262.3k
per MiB at 8 bytes per iteration). The gain is larger than for
/dev/zero (+92%) because ntfs3 zero-fills the whole 1 MiB read in a
single clear_user() call, while read_zero() clears in 4 KiB chunks.

/proc/kcore read (1 GiB): 1064.4k -> 990.7k kernel instructions per
MiB (-6.9%), throughput unchanged, as the remaining ~72% of kcore
bytes are real memory copies. The arithmetic implies about 28% of
/proc/kcore read bytes are zero-filled holes.

For completeness, tmpfs hole reads do not benefit: mm/shmem.c
deliberately copies the zero page instead of calling clear_user()
("Copy to user tends to be so well optimized, but clear_user() not
so much, that it is noticeably faster to copy the zero page instead
of clearing"), which reads like an existing workaround for exactly
the cost this patch removes.

By code inspection, the same zero-fill path serves sparse reads on
Ceph, SMB and netfs, so those are the likely real-world
beneficiaries.

Jirka


  reply	other threads:[~2026-11-25  1:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21  5:04 [PATCH] arm64: clear_user: align __arch_clear_user() to 128B for I-cache efficiency Luke Yang
2025-11-24 13:38 ` Will Deacon
2025-11-25  3:45   ` Luke Yang
2026-11-24 23:30 ` [PATCH v2] arm64: clear_user: keep alignment padding out of the zeroing loop Jirka Hladky
2026-11-25  1:56   ` Jirka Hladky [this message]
2026-11-26 12:28   ` Kristina Martšenko
2026-11-26 12:49     ` Jirka Hladky
2026-11-26 12:50 ` [PATCH v3] " Jirka Hladky
2026-11-26 15:24   ` Catalin Marinas
2026-11-26 16:15 ` [PATCH v4] " Jirka Hladky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125015618.1331650-1-jhladky@redhat.com \
    --to=jhladky@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=dockseed@proton.me \
    --cc=jmario@redhat.com \
    --cc=kristina.martsenko@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luyang@redhat.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®