All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sasha Levin <sashal@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [git pull] d_revalidate pile
Date: Tue, 28 Jan 2025 02:56:28 +0000	[thread overview]
Message-ID: <20250128025628.GM1977892@ZenIV> (raw)
In-Reply-To: <CAHk-=whtfm7wKucbsT7=qSvtt7YZcQNmgn_cj3+h__1w7d_0WQ@mail.gmail.com>

On Mon, Jan 27, 2025 at 05:27:08PM -0800, Linus Torvalds wrote:
> On Mon, 27 Jan 2025 at 17:21, Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > Umm...  On some architectures it does, but mostly that's the ones
> > where unaligned word loads are costly.  Which target do you have
> > in mind?
> 
> I was more thinking that we could just make the fallback case be a 'memcmp()'.
> 
> It's not like this particular place matters - as you say, that
> byte-at-a-time code is only used on architectures that don't enable
> the dcache word-at-a-time code (that requires the special "do loads
> that can fault" zeropad helper), but we've had some other places where
> we'd worry about the string length.
> 
> Look at d_path() for another example. That copy_from_kernel_nofault()
> in prepend_copy()...

Hmm...  So something like

/*
 * Returns a pointer to name and a length; length might be
 * inaccurate in case of race with dentry renaming, but
 * it will not exceed the distance from returned pointer
 * to the end of containing object.
 * Caller MUST hold rcu_read_lock().
 * Caller MUST NOT expect the contents of name to remain
 * stable - it can change at any time.
 */
const char *__d_name_rcu(struct dentry *dentry, int *p)
{
	const char *name = smp_load_acquire(&dentry->d_name.name);

	if (unlikely(name != &dentry->d_shortname.string))
		*p = container_of(name, struct external_name, name)->len;
	else if (unlikely((*p = dentry->d_name.name) >= DNAME_INLINE_LEN)
		*p = DNAME_INLINE_LEN - 1;
	return name;
}

with very limited accessibility (basically, dcache.c and d_path.c)

prepend_name() might be able to use that...

  reply	other threads:[~2025-01-28  2:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27  4:47 [git pull] d_revalidate pile Al Viro
2025-01-27 17:19 ` Sasha Levin
2025-01-27 17:36   ` Al Viro
2025-01-27 20:52     ` Sasha Levin
2025-01-27 21:34       ` Al Viro
2025-01-27 22:40         ` Al Viro
2025-01-27 23:08           ` Linus Torvalds
2025-01-27 23:26           ` Sasha Levin
2025-01-28  0:26             ` Al Viro
2025-01-28  0:31               ` Al Viro
2025-01-30  4:37                 ` [git pull] d_revalidate pile (v2) Al Viro
2025-01-30 17:24                   ` Linus Torvalds
2025-01-30 19:31                     ` Miklos Szeredi
2025-01-31  5:56                     ` Al Viro
2025-01-30 17:46                   ` pr-tracker-bot
2025-01-28  0:43               ` [git pull] d_revalidate pile Linus Torvalds
2025-01-28  1:21                 ` Al Viro
2025-01-28  1:27                   ` Linus Torvalds
2025-01-28  2:56                     ` Al Viro [this message]
2025-01-27 19:12   ` Linus Torvalds
2025-01-27 20:38     ` Mark Brown
2025-01-27 22:32       ` Sasha Levin
2025-01-28 12:14         ` Mark Brown
2025-01-28 12:43           ` Dan Carpenter
2025-01-28 12:33         ` Dan Carpenter
2025-01-28 19:24           ` Sasha Levin
2025-01-28  9:19       ` Guillaume Tucker

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=20250128025628.GM1977892@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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.