Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2974223ybp; Sun, 6 Oct 2019 01:58:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzx0MdBFJNow1fizMaxPH8mqX1I8943bl/EL1YVZ47S9d4MNXWNsXOVsSjj3aRui7e8R/a8 X-Received: by 2002:a05:6402:13c2:: with SMTP id a2mr23313529edx.21.1570352300019; Sun, 06 Oct 2019 01:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570352300; cv=none; d=google.com; s=arc-20160816; b=hbAt+zaSoY/cIkry6InPPsNLnhxmQX2uoCT36V2BXPGknU9FICiGoWe/6Ta6G0/DAp w5ex0Ty1TKCAF4ZLO+G8vgeLc0Sr7deADUWfCrZJT8ZlSFcxoBoVhHRkqE8wbzzSlin0 Ps/Zrh/2xIeUAUldouLOIDei65NW66HcF/v741Y/zq3roGReelA8y8DIg3mMCB4DwIRc H9c+JbQAhOWxkyGDOvBG22rsWjzCFksZ3URa917h1OvA/tGsX1tBd9FPemKqf64GJm57 1/SaWNCrnL2lMGee7o3CfRAD98iz3R7gbyxXDDmPDS0LjQuFl+JXv/C6tTMezwXmbyrt 7wkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fozZf8LO1N11PyzmHPmHjFG+ssu3EuXGzIQNvGQAyuc=; b=j2PME5xUnyTmoRK6hnrny02YNLKdK4jy+6uLUO8jwuV8FB/5S1MWmjZmem9xqt7CFE RXHXgCqld0tVOxePVjnWtPcfAaQr3k72mN7KehvJ2Cqu+QJu/Uf723Lt16Raj3iglwbX wdYuMJ7LiLHeTsOY7u/OmVrcA1BdXUygMAsK3oUhR/iIIf8Xt5i6jMYowja6QOS7bcu1 Z5JlH70lKHo6oHcvblfOs5sod62YPnzaiQdtnyr3DbOLL+1nwm54ZK82RO5ikUtN1eL1 yVNF4clBw5+Mt+CzC6oYuFzWITKHIdFbdMdImNgrwopHZm8I5gu+TiFGWMJYD9ZxMM53 jr1A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 g3si7322302edj.220.2019.10.06.01.57.56; Sun, 06 Oct 2019 01:58:20 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726498AbfJFI5k (ORCPT + 99 others); Sun, 6 Oct 2019 04:57:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52294 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbfJFI5j (ORCPT ); Sun, 6 Oct 2019 04:57:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2CB58C057EC0; Sun, 6 Oct 2019 08:57:39 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-58.ams2.redhat.com [10.36.116.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60EC55EE1D; Sun, 6 Oct 2019 08:57:36 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: 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, David Hildenbrand , Andrew Morton , Oscar Salvador , Michal Hocko , Pavel Tatashin , Dan Williams , Wei Yang Subject: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span() Date: Sun, 6 Oct 2019 10:56:44 +0200 Message-Id: <20191006085646.5768-9-david@redhat.com> In-Reply-To: <20191006085646.5768-1-david@redhat.com> References: <20191006085646.5768-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sun, 06 Oct 2019 08:57:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; + } } - - /* - * 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