From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40031C2D0B1 for ; Thu, 6 Feb 2020 06:17:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2AB2206CC for ; Thu, 6 Feb 2020 06:17:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K4URz717" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2AB2206CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6A8E36B000A; Thu, 6 Feb 2020 01:17:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 65A356B000C; Thu, 6 Feb 2020 01:17:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 56EC16B000D; Thu, 6 Feb 2020 01:17:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id 3B55F6B000A for ; Thu, 6 Feb 2020 01:17:01 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DB9A1181AC212 for ; Thu, 6 Feb 2020 06:17:00 +0000 (UTC) X-FDA: 76458694200.18.brick57_77626e55ade49 X-HE-Tag: brick57_77626e55ade49 X-Filterd-Recvd-Size: 5281 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Feb 2020 06:17:00 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id z7so5622718wrl.13 for ; Wed, 05 Feb 2020 22:17:00 -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=DxsjDR67XGpibGDOUdfLEDLg20xkYw6c6w5s1if7aFOB+MYxe04dW8XwBRebetSu7M aOv6Ufd8AoveOnaUQZdh+jA0KluhRVT4bD4pO3SxWTn0yyh8mMRk29NIZUNyqlD4KpuQ GpkqpJ6mdJcGwWND2dK5iHtxNPAmMZBr1daJfkLFYVJh9Hrmx9wzJyB4GKfP/gQJhr3o OlFj1lVEiynYEpvuk0NLerdWnT47klkv7vvOi0O8qTBuicKuhVZf1oy7GlHbe8fbDSMO yUe4Jl4XnudbyVLNFKVDo6orATJ0cflz16A3DsMtKaIDRmhwaya6lLpaHGF/mZpjfdmt 8QsA== X-Gm-Message-State: APjAAAV01WbcsaRRSBIuWERbsweIc8CLpI4unTXkhTA3NoMbkiXj1HwA dgqQdroQ8UTGf2+w9hCpqvk= X-Google-Smtp-Source: APXvYqwTLHQvq8dKx7gcXsdDFu4ciVrTaZgfQEsNQh9NpckWMDytxoedgsK/TUPVY50RM/UzY9aQvg== 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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