Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1151675ybv; Wed, 5 Feb 2020 22:19:15 -0800 (PST) X-Google-Smtp-Source: APXvYqyY+0bre1B4QDaPXitFmHWxL9iGQpIRsIPd1dltkOpwwiFhKBKfmF2nZTj9+T/z1T9jSepA X-Received: by 2002:a9d:7a47:: with SMTP id z7mr29942586otm.179.1580969955571; Wed, 05 Feb 2020 22:19:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580969955; cv=none; d=google.com; s=arc-20160816; b=b9CiolGZJNU+UNTY0LwtierzEj9RhHwMuYgVUsiNB66omJHId5eLRruElQaWfgzXdg ec2n/PLdY3BbygpTE5QzMsw1xMxTl9o0RX1nle4ACwJEWVexZgkvFmp73cqV96zfUlIb vU9df+rTQND6R4kwy6trmN0beYEUuLgjeq1e9x81kVjreu6NjrjCNPSXbOdVfHQxZWYj 4Xt/FMbLRR6/LRL+nw6MMdS+EMICmc4TiZaAD/pzM/OBEynBdFk872LeBTyj+y6yAY/6 gTI99yQTXjOULh/dH2o5ACBl7sed0lXp362I7y2KnWQwLOPIAbvtrMHpaZtDC6hjKzDx +voA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=Pob0crvk+bFSNi+7NzU1uAYzHzvw+xluiXIfFVGQQvY=; b=PEtqLzNMrlc/PcEW51q9eBXpMhgl/mwCkoJYtPj++IXrtiVH4oHUh6fWeqsOyIcPgB xHmK99+aJp+DB0FO+POe1U2jtnjvVYxmfYxsmBVtsd6o4vm1EVcAoXbY/FnIdr1sV1da Iizqw0IAuMTbaVMGUjgZXatBH2Xoj4cTPujtbgtMLE7ct1UYrMtI4td9XocIkHCVBYy9 l1zL7PqZHoFMjFEBEpvNdJ/dn5wYmIlavuU/LAqxZPRRbcm72Z+oMEZoKETzTJWKecOO oxCbZwl4Xrnma1iE50h6O5++kd2PXR0mV+wns4MCaU6kBkmPsIxQSC5Rr60EmT6rOjzC kWxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=K4URz717; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a205si1637083oif.159.2020.02.05.22.19.03; Wed, 05 Feb 2020 22:19:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=K4URz717; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727802AbgBFGRB (ORCPT + 99 others); Thu, 6 Feb 2020 01:17:01 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38257 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726673AbgBFGRB (ORCPT ); Thu, 6 Feb 2020 01:17:01 -0500 Received: by mail-wr1-f68.google.com with SMTP id y17so5672415wrh.5 for ; Wed, 05 Feb 2020 22:16:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Pob0crvk+bFSNi+7NzU1uAYzHzvw+xluiXIfFVGQQvY=; b=K4URz717ISLejVb4wNysW+YXWdx+KzvpjXNMHbx/MKwN7FKka1YdxDnyOk9e/ykZEB sqaJ6/GHFHOLSGg96AMXLqtWLB6L1fjNg44dSDQpqsBPGTJDqgSoALtbfADZUrIaeUgV XFAc1ScYxJZCo/Ohnlm6zrmrpzwwcg2GKiEtyhFNqaoD6kzTCiZ6+cjvtxk/b+NlB2zV JG45R5b4vTDPt4mj0v4tnmWi/vI955iNyZ5/Xa+KdnGxmZ4tX+K84+5rQiaRYJk0tmKg XVwq5Zi8c2TSuWsQPzmcwSdgnwNDKOnw1+g2yQpu+5Zo3mgBOJeo//cTB7f+eI3+aI7R wnhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Pob0crvk+bFSNi+7NzU1uAYzHzvw+xluiXIfFVGQQvY=; b=mi6Sf/AFoNX7UZlWyq3g+ilL/z+UNfwQlqdOUiHJteKLRB/K/oiTvg4FMR8MHVpJjC oPZ0Jcet6lat9wf9D6yu2lZm52YVJdAYVM7Nb7P7LCLzsh7tel0d4LUZr12EV9DNNgYI kitOtjlJRP/dkdtoAthwItCk4SgozeCRMwYJzwstNjI9fNTttAip7LDhn/QXzUtUqa2H tRfBNRkXDvXCF+6QJAAr9eHoViXKo+TwqA9xWIoRgnenNAfeJH0MJH7gKvWZMxVXVS7K USwRNkbkNLnb7NqHZWSsdj25QVcORkJlC4yHo71hqDsU8utnHxlC7JsQYv98+R7Vd32v VhVg== X-Gm-Message-State: APjAAAUedIh+vrS990VBy3wVfAMddbg1lz01OShYGspUHnpXhWnMFnLF 9H3YN3NJbhasq34LqHKqM00= X-Received: by 2002:a5d:6a88:: with SMTP id s8mr1782167wru.173.1580969819032; Wed, 05 Feb 2020 22:16:59 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id v12sm2846122wru.23.2020.02.05.22.16.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Feb 2020 22:16:58 -0800 (PST) Date: Thu, 6 Feb 2020 06:16:58 +0000 From: Wei Yang To: Baoquan He Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, richardw.yang@linux.intel.com, david@redhat.com, mhocko@suse.com, osalvador@suse.de Subject: Re: [PATCH] mm/hotplug: Adjust shrink_zone_span() to keep the old logic Message-ID: <20200206061658.uhhsglozzqojd7yr@master> Reply-To: Wei Yang References: <20200206053912.1211-1-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200206053912.1211-1-bhe@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Wei Yang >--- > 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