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:   Sat, 13 Mar 2021 21:10:31 -0800
From:   Chris Goldsworthy <cgoldswo@...eaurora.org>
To:     Minchan Kim <minchan@...nel.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-mm <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>, joaodias@...gle.com,
        surenb@...gle.com, willy@...radead.org, mhocko@...e.com,
        david@...hat.com, vbabka@...e.cz, linux-fsdevel@...r.kernel.org,
        Minchan Kim <minchan.kim@...il.com>
Subject: Re: [PATCH v3 2/3] mm: disable LRU pagevec during the migration
 temporarily

On 2021-03-11 14:41, Chris Goldsworthy wrote:
> On 2021-03-10 08:14, Minchan Kim wrote:
>> LRU pagevec holds refcount of pages until the pagevec are drained.
>> It could prevent migration since the refcount of the page is greater
>> than the expection in migration logic. To mitigate the issue,
>> callers of migrate_pages drains LRU pagevec via migrate_prep or
>> lru_add_drain_all before migrate_pages call.
>> 
>> However, it's not enough because pages coming into pagevec after the
>> draining call still could stay at the pagevec so it could keep
>> preventing page migration. Since some callers of migrate_pages have
>> retrial logic with LRU draining, the page would migrate at next trail
>> but it is still fragile in that it doesn't close the fundamental race
>> between upcoming LRU pages into pagvec and migration so the migration
>> failure could cause contiguous memory allocation failure in the end.
>> 
>> To close the race, this patch disables lru caches(i.e, pagevec)
>> during ongoing migration until migrate is done.
>> 
>> Since it's really hard to reproduce, I measured how many times
>> migrate_pages retried with force mode(it is about a fallback to a
>> sync migration) with below debug code.
>> 
>> int migrate_pages(struct list_head *from, new_page_t get_new_page,
>> 			..
>> 			..
>> 
>> if (rc && reason == MR_CONTIG_RANGE && pass > 2) {
>>        printk(KERN_ERR, "pfn 0x%lx reason %d\n", page_to_pfn(page), 
>> rc);
>>        dump_page(page, "fail to migrate");
>> }
>> 
>> The test was repeating android apps launching with cma allocation
>> in background every five seconds. Total cma allocation count was
>> about 500 during the testing. With this patch, the dump_page count
>> was reduced from 400 to 30.
>> 
>> The new interface is also useful for memory hotplug which currently
>> drains lru pcp caches after each migration failure. This is rather
>> suboptimal as it has to disrupt others running during the operation.
>> With the new interface the operation happens only once. This is also 
>> in
>> line with pcp allocator cache which are disabled for the offlining as
>> well.
>> 
>> Signed-off-by: Minchan Kim <minchan@...nel.org>
>> ---
> 
> Hi Minchan,
> 
> This all looks good to me - feel free to add a Reviewed-by from me.
> 
> Thanks,
> 
> Chris.
Should have added:

Reviewed-by: Chris Goldsworthy <cgoldswo@...eaurora.org>
-- 
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