From: Christian Brauner <brauner@kernel.org>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: torvalds@linux-foundation.org, viro@zeniv.linux.org.uk,
jack@suse.cz, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 0/2] two nits for path lookup
Date: Thu, 17 Apr 2025 10:13:19 +0200 [thread overview]
Message-ID: <20250417-sandplatz-hemmen-b357ce10b367@brauner> (raw)
In-Reply-To: <20250416221626.2710239-1-mjguzik@gmail.com>
On Thu, Apr 17, 2025 at 12:16:24AM +0200, Mateusz Guzik wrote:
> since path looku is being looked at, two extra nits from me:
>
> 1. some trivial jump avoidance in inode_permission()
>
> 2. but more importantly avoiding a memory access which is most likely a
> cache miss when descending into devcgroup_inode_permission()
Serge did maintain this for a while. But honestly it is an absolute
legacy eyesore from the cgroup v1 days. Somehow it was decided that
device permission management is a good fit for cgroups. Idk, I have
ranted about this in other places at length. No use warming that back
up.
They later decided to reimplement device access management as a
dedicated bpf program type. That imho is another bad design decision.
What should've happend is that device access management should've just
been implemented through the bpf-LSM infrastructure. That way all this
stuff would've gone through security_inode_permission() instead of us
having to have two separate calls in inode_permission().
I would love to kill this call. And cgroup v1 is deprecated and systemd
has dropped any support for it last year as well.
>
> the file seems to have no maintainer fwiw
>
> anyhow I'm confident the way forward is to add IOP_FAST_MAY_EXEC (or
> similar) to elide inode_permission() in the common case to begin with.
> There are quite a few branches which straight up don't need execute.
Yes.
> On top of that btrfs has a permission hook only to check for MAY_WRITE,
> which in case of path lookup is not set. With the above flag the call
> will be avoided.
>
> Mateusz Guzik (2):
> fs: touch up predicts in inode_permission()
> device_cgroup: avoid access to ->i_rdev in the common case in
> devcgroup_inode_permission()
>
> fs/namei.c | 10 +++++-----
> include/linux/device_cgroup.h | 7 ++++---
> 2 files changed, 9 insertions(+), 8 deletions(-)
>
> --
> 2.48.1
>
next prev parent reply other threads:[~2025-04-17 8:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 22:16 Mateusz Guzik
2025-04-16 22:16 ` [PATCH 1/2] fs: touch up predicts in inode_permission() Mateusz Guzik
2025-04-16 22:16 ` [PATCH 2/2] device_cgroup: avoid access to ->i_rdev in the common case in devcgroup_inode_permission() Mateusz Guzik
2025-04-16 22:35 ` [PATCH 0/2] two nits for path lookup Mateusz Guzik
2025-04-16 22:39 ` Linus Torvalds
2025-04-17 8:13 ` Christian Brauner [this message]
2025-04-17 9:04 ` 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=20250417-sandplatz-hemmen-b357ce10b367@brauner \
--to=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®