Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5029226ybl; Tue, 4 Feb 2020 06:27:47 -0800 (PST) X-Google-Smtp-Source: APXvYqz8Tk76i0mRRfmd44qotepo7Vs0w1qgG+BRSF5gjPekgkmiXuVtlyWYhZRmQ31kJfyKhTBz X-Received: by 2002:aca:53c6:: with SMTP id h189mr3612020oib.11.1580826467106; Tue, 04 Feb 2020 06:27:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580826467; cv=none; d=google.com; s=arc-20160816; b=mTwC7NNoIdqJHx4seEwxupCXVTgEtqDTFMa/8R4b5B8H9iZLZg0j1j8qxoh3/rJVsd 7LTAIDxt1yqUTKyEyCi/RzB1NqgTMzfLPot7ETBXCy3vXWe71GNWfOT76wy7ONMKUp3O EpdqNxrkI5G+54qmoPrgY2ebnlR3yTifgE6/kMvCo80qIAuK1XMGd3QvdjT6r5zHUPe8 uNjkVFgpvKGYJ8Is3xt6ghXIGOg1cQQKkBARelG3voN9kVIWpFRz0oJaLnWeUgEIXXYv hOZwQaOL4TJz+6o5J1eTv7neIaxaf2JlJ6ajok6KtTOjdsERmyT/tB3g7wGDlnY6Fl2e Y9Rg== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=ut05QA9J5WKSRE8iQ2AH3oPYzXnHzXfW9BoUs/aT13g=; b=kGUKMyaXmTZVam6LIXSWiX+4GUuIKL+5sXIpcLeTVzLHUNO8xnX9uyhhLXwAZix9WO M18GowkRFg2IfAFX7yshy7tivYIoBM2LnSlzrM57PlTorWBCvopfK/43yjE4rwwI8/dz 1/jT24vdBMwXobwD7wz+UHe7Wby++izSTrZ6/AyBuQfEC8wxEv9+rUTLmtExPCpTaOI7 +S+EZfdNNs8pWWmrt2XuyjLICvkwcVPg0PXO3nZUFQDksLcGUzudWYuakmzjHjYdCXkX x4YSofnQGgzQmFOn/tucBsDNtnhW78MzbhdClFpWr2bkvtafabvkYIeglvsbwCjBFpOy evEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c3z7W9fl; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si12322076otq.51.2020.02.04.06.27.34; Tue, 04 Feb 2020 06:27:47 -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=@redhat.com header.s=mimecast20190719 header.b=c3z7W9fl; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727328AbgBDOZa (ORCPT + 99 others); Tue, 4 Feb 2020 09:25:30 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:49484 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727247AbgBDOZ3 (ORCPT ); Tue, 4 Feb 2020 09:25:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580826327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ut05QA9J5WKSRE8iQ2AH3oPYzXnHzXfW9BoUs/aT13g=; b=c3z7W9flyFddKlyVmMluuCNT5S/u5TlsjcpbfE0Hbh81XBCFSZMKYUEKPVcBgJcAe9bVQe d493F0qrV53Irth3yNQLnmVr4ilxdthhK3ZnYk2eQpBya1QCevv75BkMlKpJztB8HmuSka M2xGt5DOXEBe3T9haPil6aNGmBiucF4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-172-0pa_ZXTfPAGteHs5vWnWkg-1; Tue, 04 Feb 2020 09:25:25 -0500 X-MC-Unique: 0pa_ZXTfPAGteHs5vWnWkg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F08C18010E6; Tue, 4 Feb 2020 14:25:22 +0000 (UTC) Received: from localhost (ovpn-13-129.pek2.redhat.com [10.72.13.129]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DC6085785; Tue, 4 Feb 2020 14:25:19 +0000 (UTC) Date: Tue, 4 Feb 2020 22:25:16 +0800 From: Baoquan He To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, x86@kernel.org, Andrew Morton , Oscar Salvador , Michal Hocko , Pavel Tatashin , Dan Williams , Wei Yang Subject: Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span() Message-ID: <20200204142516.GD26758@MiWiFi-R3L-srv> References: <20191006085646.5768-1-david@redhat.com> <20191006085646.5768-9-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191006085646.5768-9-david@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/06/19 at 10:56am, David Hildenbrand wrote: > If we have holes, the holes will automatically get detected and removed > once we remove the next bigger/smaller section. The extra checks can > go. > > Cc: Andrew Morton > Cc: Oscar Salvador > Cc: Michal Hocko > Cc: David Hildenbrand > Cc: Pavel Tatashin > Cc: Dan Williams > Cc: Wei Yang > Signed-off-by: David Hildenbrand > --- > mm/memory_hotplug.c | 34 +++++++--------------------------- > 1 file changed, 7 insertions(+), 27 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index f294918f7211..8dafa1ba8d9f 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -393,6 +393,9 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, > if (pfn) { > zone->zone_start_pfn = pfn; > zone->spanned_pages = zone_end_pfn - pfn; > + } else { > + zone->zone_start_pfn = 0; > + zone->spanned_pages = 0; > } > } else if (zone_end_pfn == end_pfn) { > /* > @@ -405,34 +408,11 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, > start_pfn); > if (pfn) > zone->spanned_pages = pfn - zone_start_pfn + 1; > + else { > + zone->zone_start_pfn = 0; > + zone->spanned_pages = 0; Thinking in which case (zone_start_pfn != start_pfn) and it comes here. > + } > } > - > - /* > - * The section is not biggest or smallest mem_section in the zone, it > - * only creates a hole in the zone. So in this case, we need not > - * change the zone. But perhaps, the zone has only hole data. Thus > - * it check the zone has only hole or not. > - */ > - pfn = zone_start_pfn; > - for (; pfn < zone_end_pfn; pfn += PAGES_PER_SUBSECTION) { > - if (unlikely(!pfn_to_online_page(pfn))) > - continue; > - > - if (page_zone(pfn_to_page(pfn)) != zone) > - continue; > - > - /* Skip range to be removed */ > - if (pfn >= start_pfn && pfn < end_pfn) > - continue; > - > - /* If we find valid section, we have nothing to do */ > - zone_span_writeunlock(zone); > - return; > - } > - > - /* The zone has no valid section */ > - zone->zone_start_pfn = 0; > - zone->spanned_pages = 0; > zone_span_writeunlock(zone); > } > > -- > 2.21.0 > >