lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250228-neuverfilmung-teeservice-076e89999806@brauner>
Date: Fri, 28 Feb 2025 11:16:41 +0100
From: Christian Brauner <brauner@...nel.org>
To: Mateusz Guzik <mjguzik@...il.com>
Cc: Oleg Nesterov <oleg@...hat.com>, viro@...iv.linux.org.uk, jack@...e.cz, 
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] pipe: cache 2 pages instead of 1

On Thu, Feb 27, 2025 at 11:07:45PM +0100, Mateusz Guzik wrote:
> On Thu, Feb 27, 2025 at 10:59 PM Oleg Nesterov <oleg@...hat.com> wrote:
> > > +static struct page *anon_pipe_get_page(struct pipe_inode_info *pipe)
> > > +{
> > > +     struct page *page;
> > > +
> > > +     if (pipe->tmp_page[0]) {
> > > +             page = pipe->tmp_page[0];
> > > +             pipe->tmp_page[0] = NULL;
> > > +     } else if (pipe->tmp_page[1]) {
> > > +             page = pipe->tmp_page[1];
> > > +             pipe->tmp_page[1] = NULL;
> > > +     } else {
> > > +             page = alloc_page(GFP_HIGHUSER | __GFP_ACCOUNT);
> > > +     }
> > > +
> > > +     return page;
> > > +}
> >
> > Perhaps something like
> >
> >         for (i = 0; i < ARRAY_SIZE(pipe->tmp_page); i++) {
> >                 if (pipe->tmp_page[i]) {
> >                         struct page *page = pipe->tmp_page[i];
> >                         pipe->tmp_page[i] = NULL;
> >                         return page;
> >                 }
> >         }
> >
> >         return alloc_page(GFP_HIGHUSER | __GFP_ACCOUNT);
> > ?
> >
> > Same for anon_pipe_put_page() and free_pipe_info().
> >
> > This avoids the code duplication and allows to change the size of
> > pipe->tmp_page[] array without other changes.
> >
> 
> I have almost no opinion one way or the other and I'm not going to
> argue about this bit. I only note I don't expect there is a legit
> reason to go beyond 2 pages here. As in if more is warranted, the
> approach to baking the area should probably change.
> 
> I started with this being spelled out so that I have easier time
> toggling the extra slot for testing.
> 
> That said, I don't know who counts as the pipe man today. I can do the

Linus or David should have the most detailed knowledge.

> needful(tm) no problem.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ