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:   Thu, 27 Feb 2020 20:30:03 -0800
From:   Mike Kravetz <mike.kravetz@...cle.com>
To:     Rik van Riel <riel@...riel.com>, linux-kernel@...r.kernel.org
Cc:     kernel-team@...com, akpm@...ux-foundation.org, linux-mm@...ck.org,
        mhocko@...nel.org, vbabka@...e.cz, mgorman@...hsingularity.net,
        rientjes@...gle.com, aarcange@...hat.com, ziy@...dia.com
Subject: Re: [PATCH v2 2/2] mm,thp,compaction,cma: allow THP migration for CMA
 allocations

On 2/27/20 5:21 PM, Rik van Riel wrote:
> On Thu, 2020-02-27 at 15:41 -0800, Mike Kravetz wrote:
>> On 2/27/20 1:32 PM, Rik van Riel wrote:
>>>
>>> +++ b/mm/page_alloc.c
>>> @@ -8253,14 +8253,19 @@ struct page *has_unmovable_pages(struct
>>> zone *zone, struct page *page,
>>>  
>>>  		/*
>>>  		 * Hugepages are not in LRU lists, but they're movable.
>>> +		 * THPs are on the LRU, but need to be counted as
>>> #small pages.
>>>  		 * We need not scan over tail pages because we don't
>>>  		 * handle each tail page individually in migration.
>>>  		 */
>>> -		if (PageHuge(page)) {
>>> +		if (PageHuge(page) || PageTransCompound(page)) {
>>>  			struct page *head = compound_head(page);
>>>  			unsigned int skip_pages;
>>>  
>>> -			if
>>> (!hugepage_migration_supported(page_hstate(head)))
>>> +			if (PageHuge(page) &&
>>> +			    !hugepage_migration_supported(page_hstate(h
>>> ead)))
>>> +				return page;
>>> +
>>> +			if (!PageLRU(head) && !__PageMovable(head))
>>
>> Pretty sure this is going to be true for hugetlb pages.  So, this
>> will change
>> behavior and make all hugetlb pages look unmovable.  Perhaps, only
>> check this
>> condition for THP pages?
> 
> Does that need to be the following, then?
> 
>      if (PageTransHuge(head) && !PageHuge(page) && !PageLRU(head) &&
> !__PageMovable(head))
>                  return page;

Yes, that is what I would suggest.  Results of a simple test on small VM.

Unmodified Kernel
-----------------
# cat /sys/devices/system/memory/memory*/removable | grep 1 | wc -l
50
# hugeadm --hard --pool-pages-min DEFAULT:4G
# cat /sys/devices/system/memory/memory*/removable | grep 1 | wc -l
50

V2 patches
----------
# cat /sys/devices/system/memory/memory*/removable | grep 1 | wc -l
50
# hugeadm --hard --pool-pages-min DEFAULT:4G
# cat /sys/devices/system/memory/memory*/removable | grep 1 | wc -l
14

V2 patches + above modification
-------------------------------
# cat /sys/devices/system/memory/memory*/removable | grep 1 | wc -l
50
# hugeadm --hard --pool-pages-min DEFAULT:4G
# cat /sys/devices/system/memory/memory*/removable | grep 1 | wc -l
50

> That's an easy one liner I would be happy to send in
> if everybody agrees that should fix things :)

Another option might be to make hugetlb pages more like other pages and
__SetPageMovable on movable hugetlb pages.  This could be used instead
of hugepage_migration_supported() calls.  That is only a quick thought
and would be beyond the scope of this patch.  If people think that is
worth doing, and I have not overlooked something,  I could look into it
separately.
-- 
Mike Kravetz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ