lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <173916348251.22054.1170999043107860979@noble.neil.brown.name>
Date: Mon, 10 Feb 2025 15:58:02 +1100
From: "NeilBrown" <neilb@...e.de>
To: "Al Viro" <viro@...iv.linux.org.uk>
Cc: "Christian Brauner" <brauner@...nel.org>, "Jan Kara" <jack@...e.cz>,
 "Linus Torvalds" <torvalds@...ux-foundation.org>,
 "Jeff Layton" <jlayton@...nel.org>, "Dave Chinner" <david@...morbit.com>,
 linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject:
 Re: [PATCH 02/19] VFS: use global wait-queue table for d_alloc_parallel()

On Sat, 08 Feb 2025, Al Viro wrote:
> 1) what's wrong with using middle bits of dentry as index?  What the hell
> is that thing about pid for?

That does "hell" have to do with it?

All we need here is a random number.  Preferably a cheap random number.
pid is cheap and quite random.
The dentry pointer would be even cheaper (no mem access) providing it
doesn't cost much to get the randomness out.  I considered hash_ptr()
but thought that was more code that it was worth.

Do you have a formula for selecting the "middle" bits in a way that is
expected to still give good randomness?

> 
> 2) part in d_add_ci() might be worth a comment re d_lookup_done() coming
> for the original dentry, no matter what.

I think the previous code deserved explanation more than the new, but
maybe I missed something.
In each case, d_wait_lookup() will wait for the given dentry to no
longer be d_in_lookup() which means waiting for DCACHE_PAR_LOOKUP to be
cleared.  The only place which clears DCACHE_PAR_LOOKUP is
__d_lookup_unhash_wake(). which always wakes the target.
In the previous code it would wake both the non-case-exact dentry and
the case-exact dentry waiters but they would go back to sleep if their
DCACHE_PAR_LOOKUP hadn't been cleared, so no interesting behaviour.
Reusing the wq from one to the other is a sensible simplification, but
not something we need any reminder of once it is no longer needed.

Would sort of comment would you add?

> 
> 3) the dance with conditional __wake_up() is worth a helper, IMO.
> 

I tried to explain that in the commit message bug I agree it deserves to
be in the code too.
I have added:

	/* ->d_wait is only set if some thread is actually waiting.
	 * If we find it is NULL - the common case - then there was no
	 * contention and there are no waiters to be woken.
	 */

and 
	/* Don't set a wait_queue until someone is actually waiting */
before
	new->d_wait = NULL;
in d_alloc_parallel().

Thanks,
NeilBrown



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ