mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	 Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	 x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	 Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	 Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 linux-block@vger.kernel.org, Breno Leitao <leitao@debian.org>,
	 kernel-team@meta.com, Mateusz Guzik <mjguzik@gmail.com>
Subject: [PATCH RFC 0/3] fs/pipe: copy a run of pipe buffers in one user access section
Date: Fri, 13 Nov 2026 03:51:43 -0800	[thread overview]
Message-ID: <20261113-pipe-pool-regression-smap-v1-0-b0dc69558ab3@debian.org> (raw)

anon_pipe_read() opens and closes a user access section for every pipe
buffer it copies, which on x86 is a STAC/CLAC pair per page. Mateusz
suggested [1] doing the copies under one section instead.

Patch 1 splits the STAC/CLAC out of copy_user_generic(), so that its
rep movs body can run inside a caller's user access section.

Patch 2 adds copy_bvecs_to_iter_full(), which copies an array of pages
to an iov_iter, all or nothing, in one section when the destination is
a plain user buffer.

Patch 3 uses it in anon_pipe_read() for up to 16 anonymous buffers that
the read consumes whole.

This is an RFC. A single patch PoC [2] behaved as Mateusz expected but
was "on the uglier side" [3], so the user access part moved out of
fs/pipe.c into lib/iov_iter.c. The main question is whether that helper
is welcome there, or, make the party a bit uglier.

Benchmark wise, see the numbers on the last patch.

[1] https://lore.kernel.org/all/CAGudoHF3de_55YvdztPs7QiYs25u6nPEV=uMOzfr=bWmwof69g@mail.gmail.com/
[2] https://lore.kernel.org/all/avMQxhpHhIPM_6HP@gmail.com/
[3] https://lore.kernel.org/all/CAGudoHFe8XgtKZohfn0Q=EH0EeXozTZq+UPJKN0BEmLnEG2s=Q@mail.gmail.com/

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (3):
      x86/uaccess: Split the STAC/CLAC out of copy_user_generic()
      iov_iter: add copy_bvecs_to_iter_full()
      fs/pipe: copy a run of anonymous buffers in one user access section

 arch/x86/include/asm/uaccess_64.h | 20 +++++++++++--
 fs/pipe.c                         | 44 +++++++++++++++++++++++++++-
 include/linux/uio.h               |  2 ++
 lib/iov_iter.c                    | 61 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 124 insertions(+), 3 deletions(-)
---
base-commit: 6d582d78fad9d828e575ca0cdcff8ea47a77220b
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
change-id: 20261106-pipe-pool-regression-smap-13cc7cd3b482

Best regards,
--  
Breno Leitao <leitao@debian.org>


             reply	other threads:[~2026-11-13 11:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 11:51 Breno Leitao [this message]
2026-11-13 11:51 ` [PATCH RFC 1/3] x86/uaccess: Split the STAC/CLAC out of copy_user_generic() Breno Leitao
2026-11-13 11:51 ` [PATCH RFC 2/3] iov_iter: add copy_bvecs_to_iter_full() Breno Leitao
2026-11-13 11:51 ` [PATCH RFC 3/3] fs/pipe: copy a run of anonymous buffers in one user access section Breno Leitao
2026-11-17  9:04   ` Chris Down
2026-11-17  9:04 ` [PATCH RFC 0/3] fs/pipe: copy a run of pipe " Chris Down

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=20261113-pipe-pool-regression-smap-v1-0-b0dc69558ab3@debian.org \
    --to=leitao@debian.org \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=brauner@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jack@suse.cz \
    --cc=kernel-team@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mjguzik@gmail.com \
    --cc=tglx@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@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®