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: <20200206061658.uhhsglozzqojd7yr@master>
Date:   Thu, 6 Feb 2020 06:16:58 +0000
From:   Wei Yang <richard.weiyang@...il.com>
To:     Baoquan He <bhe@...hat.com>
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        akpm@...ux-foundation.org, richardw.yang@...ux.intel.com,
        david@...hat.com, mhocko@...e.com, osalvador@...e.de
Subject: Re: [PATCH] mm/hotplug: Adjust shrink_zone_span() to keep the old
 logic

On Thu, Feb 06, 2020 at 01:39:12PM +0800, Baoquan He wrote:
>In commit 950b68d9178b ("mm/memory_hotplug: don't check for "all holes"
>in shrink_zone_span()"), the zone->zone_start_pfn/->spanned_pages
>resetting is moved into the if()/else if() branches, if the zone becomes
>empty. However the 2nd resetting code block may cause misunderstanding.
>
>So take the resetting codes out of the conditional checking and handling
>branches just as the old code does, the find_smallest_section_pfn()and
>find_biggest_section_pfn() searching have done the the same thing as
>the old for loop did, the logic is kept the same as the old code. This
>can remove the possible confusion.
>
>Signed-off-by: Baoquan He <bhe@...hat.com>

Reviewed-by: Wei Yang <richardw.yang@...ux.intel.com>

>---
> mm/memory_hotplug.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
>diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>index 089b6c826a9e..475d0d68a32c 100644
>--- a/mm/memory_hotplug.c
>+++ b/mm/memory_hotplug.c
>@@ -398,7 +398,7 @@ static unsigned long find_biggest_section_pfn(int nid, struct zone *zone,
> static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
> 			     unsigned long end_pfn)
> {
>-	unsigned long pfn;
>+	unsigned long pfn = zone->zone_start_pfn;
> 	int nid = zone_to_nid(zone);
> 
> 	zone_span_writelock(zone);
>@@ -414,9 +414,6 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
> 		if (pfn) {
> 			zone->spanned_pages = zone_end_pfn(zone) - pfn;
> 			zone->zone_start_pfn = pfn;
>-		} else {
>-			zone->zone_start_pfn = 0;
>-			zone->spanned_pages = 0;
> 		}
> 	} else if (zone_end_pfn(zone) == end_pfn) {
> 		/*
>@@ -429,10 +426,11 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
> 					       start_pfn);
> 		if (pfn)
> 			zone->spanned_pages = pfn - zone->zone_start_pfn + 1;
>-		else {
>-			zone->zone_start_pfn = 0;
>-			zone->spanned_pages = 0;
>-		}
>+	}
>+
>+	if (!pfn) {
>+		zone->zone_start_pfn = 0;
>+		zone->spanned_pages = 0;
> 	}
> 	zone_span_writeunlock(zone);
> }
>-- 
>2.17.2

-- 
Wei Yang
Help you, Help me

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ