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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 3 Nov 2021 22:01:47 +0000
From:   Matthew Wilcox <willy@...radead.org>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] mm/mremap_pages: Save a few cycles in 'get_dev_pagemap()'

On Wed, Nov 03, 2021 at 10:54:09PM +0100, Christophe JAILLET wrote:
> Le 03/11/2021 à 22:41, Matthew Wilcox a écrit :
> > On Wed, Nov 03, 2021 at 10:35:34PM +0100, Christophe JAILLET wrote:
> > > Use 'percpu_ref_tryget_live_rcu()' instead of 'percpu_ref_tryget_live()' to
> > > save a few cycles when it is known that the rcu lock is already
> > > taken/released.
> > 
> > If this is really important, we can add an __xa_load() which doesn't
> > take the RCU read lock.
> 
> There are a few:
>    rcu_read_lock();
>    mem = xa_load(...);
>    rcu_read_unlock();
> patterns here and there.

If that's all they are, then the rcu_read_lock() and unlock can be
deleted.

if they're actually

	rcu_read_lock()
	mem = xa_load(...);
	try_get_ref(mem);
	rcu_read_unlock();

then of course they can't be.

> I don't have any numbers of if saving some rcu_read_lock/rcu_read_unlock
> would be useful in these cases.
> 
> The only numbers I have are in [1].
> 
> [1]: https://lore.kernel.org/linux-kernel/cover.1634822969.git.asml.silence@gmail.com/

It may not be worth hyperoptimising the slow path like this patch ...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ