Re: [PATCH] pipe_read: don't wake up the writer if the pipe is still full

From: Oleg Nesterov
Date: Sun Feb 02 2025 - 14:33:02 EST


On 02/02, Linus Torvalds wrote:
>
> On Sun, 2 Feb 2025 at 09:02, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> >
> > And if we do care about performance... Could you look at the trivial patch
> > at the end? I don't think {a,c,m}time make any sense in the !fifo case, but
> > as you explained before they are visible to fstat() so we probably shouldn't
> > remove file_accessed/file_update_time unconditionally.
>
> I dislike that patch because if we actually want to do this, I don't
> think you are going far enough.

...

Oh yes, yes, I agree, and for the same reasons, including the unnecessary
sb_start_write_trylock() even if it is likely very cheap. Plus it doesn't
look consistent in that "f_flags & O_NOATIME" can be changed by fcntl()
but "i_flags & S_NOCMTIME" can't be changed. Not to mention that this
"feature" will probably be never used.

In case it was not clear, I just tried to measure how much
file_accessed/file_update_time hurt performance-wise. It turns out - a lot.
And the ugly O_NOATIME knob simplifies the before/after testing.

However, yes I was worried about fstat(). But,

> So I'd actually favor a "let's just remove time updates entirely for
> unnamed pipes", and see if anybody notices. Simpler and more
> straightforward.

OK, agreed. Will send the patch.

Oleg.