unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: Alyssa Ross <hi@alyssa.is>
Cc: meta@public-inbox.org
Subject: Re: [PATCH 2/2] treewide: lose F_SETPIPE_SZ page size assumptions
Date: Wed, 8 Jan 2025 04:51:35 +0000	[thread overview]
Message-ID: <20250108045136.M43020@dcvr> (raw)
In-Reply-To: <20250107222656.M989952@dcvr>

Eric Wong <e@80x24.org> wrote:
> Alyssa Ross <hi@alyssa.is> wrote:
> > fcntl(2) is documented as rounding up sizes to an integer multiple of
> > the page size.  When a pipe buffer as small as possible is desired,
> > it's cleaner to pass 0 and let the kernel set the pipe buffer to
> > exactly one page than it is to assume that pages are 4096 bytes.
> 
> OK.  I suppose the Linux kernel has enough testers that it's
> chances of it mishandling someday 0 would be caught before any
> release.

Well, that was only thinking about potential future bugs...

Looking backwards, older Linux appeared to handle 0 improperly before
d3f14c485867 (pipe: avoid round_pipe_size() nr_pages overflow on 32-bit, 2017-11-17)
https://yhbt.net/lore/lkml/d3f14c485867cfb2e0c48aa88c41d0ef4bf5209c/s/

I haven't tried an ancient kernel to verify and my arithmetic is awful
(d3f14c485867 also got backported to older distro kernels).

  reply	other threads:[~2025-01-08  4:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 17:46 [PATCH 1/2] t/lei-sigpipe.t: use correct pipe size Alyssa Ross
2025-01-07 17:46 ` [PATCH 2/2] treewide: lose F_SETPIPE_SZ page size assumptions Alyssa Ross
2025-01-07 22:26   ` Eric Wong
2025-01-08  4:51     ` Eric Wong [this message]
2025-01-07 22:22 ` [PATCH 1/2] t/lei-sigpipe.t: use correct pipe size Eric Wong

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

  List information: https://public-inbox.org/README

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

  git send-email \
    --in-reply-to=20250108045136.M43020@dcvr \
    --to=e@80x24.org \
    --cc=hi@alyssa.is \
    --cc=meta@public-inbox.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).