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]
Message-ID: <bed9336d-3bff-b7e3-dfba-42506a274858@redhat.com>
Date:   Mon, 21 Oct 2019 17:04:50 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Michal Hocko <mhocko@...nel.org>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Oscar Salvador <osalvador@...e.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Anshuman Khandual <anshuman.khandual@....com>,
        Pingfan Liu <kernelfans@...il.com>, Qian Cai <cai@....pw>,
        Pavel Tatashin <pasha.tatashin@...een.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>,
        Alexander Duyck <alexander.h.duyck@...ux.intel.com>
Subject: Re: [PATCH v1 2/2] mm/page_isolation.c: Convert SKIP_HWPOISON to
 MEMORY_OFFLINE

On 21.10.19 17:02, Michal Hocko wrote:
> On Mon 21-10-19 16:19:26, David Hildenbrand wrote:
>> We have two types of users of page isolation:
>> 1. Memory offlining: Offline memory so it can be unplugged. Memory won't
>> 		     be touched.
>> 2. Memory allocation: Allocate memory (e.g., alloc_contig_range()) to
>> 		      become the owner of the memory and make use of it.
>>
>> For example, in case we want to offline memory, we can ignore (skip over)
>> PageHWPoison() pages, as the memory won't get used. We can allow to
>> offline memory. In contrast, we don't want to allow to allocate such
>> memory.
>>
>> Let's generalize the approach so we can special case other types of
>> pages we want to skip over in case we offline memory. While at it, also
>> pass the same flags to test_pages_isolated().
>>
>> Cc: Michal Hocko <mhocko@...e.com>
>> Cc: Oscar Salvador <osalvador@...e.de>
>> Cc: Andrew Morton <akpm@...ux-foundation.org>
>> Cc: Anshuman Khandual <anshuman.khandual@....com>
>> Cc: David Hildenbrand <david@...hat.com>
>> Cc: Pingfan Liu <kernelfans@...il.com>
>> Cc: Qian Cai <cai@....pw>
>> Cc: Pavel Tatashin <pasha.tatashin@...een.com>
>> Cc: Dan Williams <dan.j.williams@...el.com>
>> Cc: Vlastimil Babka <vbabka@...e.cz>
>> Cc: Mel Gorman <mgorman@...hsingularity.net>
>> Cc: Mike Rapoport <rppt@...ux.vnet.ibm.com>
>> Cc: Alexander Duyck <alexander.h.duyck@...ux.intel.com>
>> Suggested-by: Michal Hocko <mhocko@...e.com>
>> Signed-off-by: David Hildenbrand <david@...hat.com>
> 
> Yes, a highlevel flag makes more sense than requesting specific types of
> pages to skip over.
> 
> Acked-by: Michal Hocko <mhocko@...e.com>
> 
> Please make the code easier to follow ...
>> ---
>>   include/linux/page-isolation.h |  4 ++--
>>   mm/memory_hotplug.c            |  8 +++++---
>>   mm/page_alloc.c                |  4 ++--
>>   mm/page_isolation.c            | 12 ++++++------
>>   4 files changed, 15 insertions(+), 13 deletions(-)
>>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index bf6b21f02154..b44712c7fdd7 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -8270,7 +8270,7 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
>>   		 * The HWPoisoned page may be not in buddy system, and
>>   		 * page_count() is not 0.
>>   		 */
>> -		if ((flags & SKIP_HWPOISON) && PageHWPoison(page))
>> +		if (flags & MEMORY_OFFLINE && PageHWPoison(page))
>>   			continue;
>>   
>>   		if (__PageMovable(page))
> [...]
>> @@ -257,7 +258,7 @@ void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
>>    */
>>   static unsigned long
>>   __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn,
>> -				  bool skip_hwpoisoned_pages)
>> +				  int flags)
>>   {
>>   	struct page *page;
>>   
>> @@ -274,7 +275,7 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn,
>>   			 * simple way to verify that as VM_BUG_ON(), though.
>>   			 */
>>   			pfn += 1 << page_order(page);
>> -		else if (skip_hwpoisoned_pages && PageHWPoison(page))
>> +		else if (flags & MEMORY_OFFLINE && PageHWPoison(page))
>>   			/* A HWPoisoned page cannot be also PageBuddy */
>>   			pfn++;
>>   		else
> 
> .. and use parentheses for the flag check.
> 

Can do if you prefer :)

Thanks!

I'll resend both patches.

-- 

Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ