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]
Date:   Thu, 11 Feb 2021 11:39:05 -0800
From:   Chris Goldsworthy <cgoldswo@...eaurora.org>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Alexander Viro <viro@...iv.linux.org.uk>, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        Minchan Kim <minchan@...nel.org>
Subject: Re: [PATCH v2] [RFC] mm: fs: Invalidate BH LRU during page migration

On 2021-02-11 06:09, Matthew Wilcox wrote:
> On Wed, Feb 10, 2021 at 09:35:40PM -0800, Chris Goldsworthy wrote:
>> +/* These are used to control the BH LRU invalidation during page 
>> migration */
>> +static struct cpumask lru_needs_invalidation;
>> +static bool bh_lru_disabled = false;
> 
> As I asked before, what protects this on an SMP system?
> 

Sorry Matthew, I misconstrued your earlier question in V1, and thought 
you had been referring to compile-time protection (so as to prevent 
build breakages).  It is not protected, so I'll need to change this into 
an atomic counter that is incremented and decremented by bh_lru_enable() 
and bh_lru_disable() respectively (such that if the counter is greater 
than zero, we bail).

>> @@ -1292,7 +1296,9 @@ static inline void check_irqs_on(void)
>>  /*
>>   * Install a buffer_head into this cpu's LRU.  If not already in the 
>> LRU, it is
>>   * inserted at the front, and the buffer_head at the back if any is 
>> evicted.
>> - * Or, if already in the LRU it is moved to the front.
>> + * Or, if already in the LRU it is moved to the front. Note that if 
>> LRU is
>> + * disabled because of an ongoing page migration, we won't insert bh 
>> into the
>> + * LRU.
> 
> And also, why do we need to do this?  The page LRU has no equivalent
> mechanism to prevent new pages being added to the per-CPU LRU lists.
> If a BH has just been used, isn't that a strong hint that this page is
> a bad candidate for migration?

I had assumed that up until now, that pages in the page cache aren't an 
issue, such that they're dropped during migration as needed. Looking at 
try_to_free_buffers[1], I don't see any handling for the page cache.  I 
will need to do due diligence and follow up on this.

As for the question on necessity, if there is a case in which preventing 
buffer_heads from being added to the BH LRU ensures that the containing 
page can be migrated, then I would say that the change is justified, 
since adds another scenario in which migration is guaranteed (I will 
follow up on this as well).

Regards,

Chris.

[1] https://elixir.bootlin.com/linux/latest/source/fs/buffer.c#L3225

-- 
The Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ