From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: kernel test robot <oliver.sang@intel.com>,
oe-lkp@lists.linux.dev, lkp@intel.com,
linux-kernel@vger.kernel.org, Jann Horn <jannh@google.com>,
linux-doc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
intel-gfx@lists.freedesktop.org, linux-fsdevel@vger.kernel.org,
gfs2@lists.linux.dev, bpf@vger.kernel.org, ying.huang@intel.com,
feng.tang@intel.com, fengwei.yin@intel.com
Subject: Re: [linus:master] [file] 0ede61d858: will-it-scale.per_thread_ops -2.9% regression
Date: Tue, 28 Nov 2023 16:52:31 +0100 [thread overview]
Message-ID: <20231128-serpentinen-sinnieren-e186ea8742e9@brauner> (raw)
In-Reply-To: <CAHk-=wgwpzgoSYU9Ob+MRyFuHRow4s5J099=DsCo1hGT=bkCtw@mail.gmail.com>
On Mon, Nov 27, 2023 at 09:10:54AM -0800, Linus Torvalds wrote:
> On Mon, 27 Nov 2023 at 02:27, Christian Brauner <brauner@kernel.org> wrote:
> >
> > So I've picked up your patch (vfs.misc). It's clever alright so thanks
> > for the comments in there otherwise I would've stared at this for far
> > too long.
>
> Note that I should probably have commented on one other thing: that
> whole "just load from fd[0] is always safe, because the fd[] array
> always exists".
I added a comment to that effect in the code.
>
> IOW, that whole "load and mask" thing only works when you know the
> array exists at all.
>
> Doing that "just mask the index" wouldn't be valid if "size = 0" is an
> option and might mean that we don't have an array at all (ie if "->fd"
> itself could be NULL.
>
> But we never have a completely empty file descriptor array, and
> fdp->fd is never NULL. At a minimum 'max_fds' is NR_OPEN_DEFAULT.
>
> (The whole 'tsk->files' could be NULL, but only for kernel threads or
> when exiting, so fget_task() will check for *that*, but it's a
> separate thing)
Yep.
>
> So that's why it's safe to *entirely* remove the whole
>
> if (unlikely(fd >= fdt->max_fds))
>
> test, and do it *all* with just "mask the index, and mask the resulting load".
Yep.
WARNING: multiple messages have this Message-ID (diff)
From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: feng.tang@intel.com, Jann Horn <jannh@google.com>,
intel-gfx@lists.freedesktop.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, fengwei.yin@intel.com,
gfs2@lists.linux.dev, linux-fsdevel@vger.kernel.org,
kernel test robot <oliver.sang@intel.com>,
ying.huang@intel.com, oe-lkp@lists.linux.dev,
bpf@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [Intel-gfx] [linus:master] [file] 0ede61d858: will-it-scale.per_thread_ops -2.9% regression
Date: Tue, 28 Nov 2023 16:52:31 +0100 [thread overview]
Message-ID: <20231128-serpentinen-sinnieren-e186ea8742e9@brauner> (raw)
In-Reply-To: <CAHk-=wgwpzgoSYU9Ob+MRyFuHRow4s5J099=DsCo1hGT=bkCtw@mail.gmail.com>
On Mon, Nov 27, 2023 at 09:10:54AM -0800, Linus Torvalds wrote:
> On Mon, 27 Nov 2023 at 02:27, Christian Brauner <brauner@kernel.org> wrote:
> >
> > So I've picked up your patch (vfs.misc). It's clever alright so thanks
> > for the comments in there otherwise I would've stared at this for far
> > too long.
>
> Note that I should probably have commented on one other thing: that
> whole "just load from fd[0] is always safe, because the fd[] array
> always exists".
I added a comment to that effect in the code.
>
> IOW, that whole "load and mask" thing only works when you know the
> array exists at all.
>
> Doing that "just mask the index" wouldn't be valid if "size = 0" is an
> option and might mean that we don't have an array at all (ie if "->fd"
> itself could be NULL.
>
> But we never have a completely empty file descriptor array, and
> fdp->fd is never NULL. At a minimum 'max_fds' is NR_OPEN_DEFAULT.
>
> (The whole 'tsk->files' could be NULL, but only for kernel threads or
> when exiting, so fget_task() will check for *that*, but it's a
> separate thing)
Yep.
>
> So that's why it's safe to *entirely* remove the whole
>
> if (unlikely(fd >= fdt->max_fds))
>
> test, and do it *all* with just "mask the index, and mask the resulting load".
Yep.
WARNING: multiple messages have this Message-ID (diff)
From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: feng.tang@intel.com, lkp@intel.com, Jann Horn <jannh@google.com>,
intel-gfx@lists.freedesktop.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, fengwei.yin@intel.com,
gfs2@lists.linux.dev, linux-fsdevel@vger.kernel.org,
kernel test robot <oliver.sang@intel.com>,
ying.huang@intel.com, oe-lkp@lists.linux.dev,
bpf@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [linus:master] [file] 0ede61d858: will-it-scale.per_thread_ops -2.9% regression
Date: Tue, 28 Nov 2023 16:52:31 +0100 [thread overview]
Message-ID: <20231128-serpentinen-sinnieren-e186ea8742e9@brauner> (raw)
In-Reply-To: <CAHk-=wgwpzgoSYU9Ob+MRyFuHRow4s5J099=DsCo1hGT=bkCtw@mail.gmail.com>
On Mon, Nov 27, 2023 at 09:10:54AM -0800, Linus Torvalds wrote:
> On Mon, 27 Nov 2023 at 02:27, Christian Brauner <brauner@kernel.org> wrote:
> >
> > So I've picked up your patch (vfs.misc). It's clever alright so thanks
> > for the comments in there otherwise I would've stared at this for far
> > too long.
>
> Note that I should probably have commented on one other thing: that
> whole "just load from fd[0] is always safe, because the fd[] array
> always exists".
I added a comment to that effect in the code.
>
> IOW, that whole "load and mask" thing only works when you know the
> array exists at all.
>
> Doing that "just mask the index" wouldn't be valid if "size = 0" is an
> option and might mean that we don't have an array at all (ie if "->fd"
> itself could be NULL.
>
> But we never have a completely empty file descriptor array, and
> fdp->fd is never NULL. At a minimum 'max_fds' is NR_OPEN_DEFAULT.
>
> (The whole 'tsk->files' could be NULL, but only for kernel threads or
> when exiting, so fget_task() will check for *that*, but it's a
> separate thing)
Yep.
>
> So that's why it's safe to *entirely* remove the whole
>
> if (unlikely(fd >= fdt->max_fds))
>
> test, and do it *all* with just "mask the index, and mask the resulting load".
Yep.
next prev parent reply other threads:[~2023-11-28 15:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 7:11 [linus:master] [file] 0ede61d858: will-it-scale.per_thread_ops -2.9% regression kernel test robot
2023-11-20 7:11 ` kernel test robot
2023-11-20 7:11 ` [Intel-gfx] " kernel test robot
2023-11-20 7:41 ` Mateusz Guzik
2023-11-20 7:41 ` Mateusz Guzik
2023-11-20 7:41 ` [Intel-gfx] " Mateusz Guzik
2023-11-26 20:23 ` Linus Torvalds
2023-11-26 20:23 ` Linus Torvalds
2023-11-26 20:23 ` [Intel-gfx] " Linus Torvalds
2023-11-26 23:20 ` Linus Torvalds
2023-11-26 23:20 ` Linus Torvalds
2023-11-26 23:20 ` [Intel-gfx] " Linus Torvalds
2023-11-27 6:58 ` Oliver Sang
2023-11-27 6:58 ` Oliver Sang
2023-11-27 6:58 ` [Intel-gfx] " Oliver Sang
2023-11-27 10:27 ` Christian Brauner
2023-11-27 10:27 ` Christian Brauner
2023-11-27 10:27 ` [Intel-gfx] " Christian Brauner
2023-11-27 17:10 ` Linus Torvalds
2023-11-27 17:10 ` Linus Torvalds
2023-11-27 17:10 ` [Intel-gfx] " Linus Torvalds
2023-11-28 15:52 ` Christian Brauner [this message]
2023-11-28 15:52 ` Christian Brauner
2023-11-28 15:52 ` [Intel-gfx] " Christian Brauner
2023-11-27 10:13 ` Christian Brauner
2023-11-27 10:13 ` Christian Brauner
2023-11-27 10:13 ` [Intel-gfx] " Christian Brauner
2023-11-26 20:50 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2023-11-26 20:50 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-11-26 23:26 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for 0ede61d858: will-it-scale.per_thread_ops -2.9% regression (rev2) Patchwork
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=20231128-serpentinen-sinnieren-e186ea8742e9@brauner \
--to=brauner@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=feng.tang@intel.com \
--cc=fengwei.yin@intel.com \
--cc=gfs2@lists.linux.dev \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jannh@google.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkp@intel.com \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=ying.huang@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.