public inbox for [email protected]
 help / color / mirror / Atom feed
From: Christian Brauner <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected], Jan Kara <[email protected]>,
	 Christoph Hellwig <[email protected]>,
	Alexander Viro <[email protected]>,
	 [email protected]
Subject: Re: [PATCH] [RFC]: fs: claw back a few FMODE_* bits
Date: Thu, 28 Mar 2024 10:40:24 +0100	[thread overview]
Message-ID: <20240328-ritualisieren-darum-9e500adaeaab@brauner> (raw)
In-Reply-To: <[email protected]>

On Wed, Mar 27, 2024 at 11:19:06AM -0600, Jens Axboe wrote:
> On 3/27/24 10:45 AM, Christian Brauner wrote:
> > There's a bunch of flags that are purely based on what the file
> > operations support while also never being conditionally set or unset.
> > IOW, they're not subject to change for individual file opens. Imho, such
> > flags don't need to live in f_mode they might as well live in the fops
> > structs itself. And the fops struct already has that lonely
> > mmap_supported_flags member. We might as well turn that into a generic
> > fops_flags member and move a few flags from FMODE_* space into FOP_*
> > space. That gets us four FMODE_* bits back and the ability for new
> > static flags that are about file ops to not have to live in FMODE_*
> > space but in their own FOP_* space. It's not the most beautiful thing
> > ever but it gets the job done. Yes, there'll be an additional pointer
> > chase but hopefully that won't matter for these flags.
> 
> Not doing that extra dereference is kind of the point of the FMODE_*
> flags, at least the ones that I care about. Probably not a huge deal for
> these cases though, as we're generally going to call one of the f_op
> handlers shortly anyway. The cases where we don't, at least for
> io_uring, we already cache the state separately.
> 
> Hence more of a general observation than an objection to the patch. I do
> like freeing up FMODE space, as it's (pretty) full.

Yes, I'm actuely aware that for some flags having them FMODE_* bits
might be performance sensitive. Moving FMODE_PATH would probably be very
noticeable due to it's use in __fget_files_rcu() and there might be
other cases like FMODE_NOWAIT and so on.

So I was delibaretely moving flags that really remain static and that
are unlikely to be in a hot path. And we certainly need to be careful
about this.

I think in the long-run it can bring us benefits for new flag proposals
that we wouldn't be willing to accept if they had to live in FMODE_*
space. Either because they're a one-off (the MAP_SYNC flag comes to
mind) or because they're not performance sensitive and of course only if
they're static.

We should still push back on unnecessary FMODE_* bit additions but we
may be able to be a little less stingy with FOP_* bits for a bit.

  reply	other threads:[~2024-03-28  9:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 16:45 [PATCH] [RFC]: fs: claw back a few FMODE_* bits Christian Brauner
2024-03-27 17:19 ` Jens Axboe
2024-03-28  9:40   ` Christian Brauner [this message]
2024-03-28  1:18 ` Dave Chinner
2024-03-28  5:36   ` Christoph Hellwig
2024-03-28  8:06   ` Christian Brauner
2024-03-28  8:13     ` Christoph Hellwig
2024-03-28  9:41       ` Christian Brauner
2024-04-01 23:16     ` Dave Chinner
2024-03-28  5:35 ` Christoph Hellwig
2024-03-28  9:29   ` Christian Brauner

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=20240328-ritualisieren-darum-9e500adaeaab@brauner \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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