Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp323240ybv; Wed, 5 Feb 2020 06:14:45 -0800 (PST) X-Google-Smtp-Source: APXvYqyRfYf84WmDgN9pZgu7AvgM5kO3blwCOofAT6FfRf+J0bzLMK+XDeYn7rhyYAOhXf4VCbXK X-Received: by 2002:aca:b4c3:: with SMTP id d186mr2847775oif.131.1580912085650; Wed, 05 Feb 2020 06:14:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580912085; cv=none; d=google.com; s=arc-20160816; b=0t2vsPQD0SMwwYO/lZStrtEd1c9LNe4h8SSUmZpSyzKVO++LI/SsPi31eTnwqZsyka evwzFla8GHqrI9Xq9hH9lKn39eqY1DXNmLdfIFPcOSfjCHtCrw/12CCxNs8aYwCeym1P /L/zcifpDhQ1Jnxmc+SqQ0NSmCYixlVZcnhAs8cQS540NOE/IO9PTqyxJT/wlGzIo6Ro k17+cZuPAie8kf073P6BFFUjceu0xjyC5yp379jfO5Q5iWIDSdPrU+Cd8Px6C+bRgr79 EjhrDg/uNRxqrcikYRkcYdm64DVfunC0FAKxNjl8Fl4Fi/LtZ98rd8LnIw3z27m03nnJ mDHA== 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=Y9VUI5/IBa9XUGA62AeVFROjjQbrdeFr4e/QsRz47wE=; b=O0UMa+qSxcXWJZYSM2G7DXSWpKssRfyhcpWQN8A/sgC/vUq242DfUHFxJ5UlTLSu2i g76y8oNUBGlIzbnVwM3gf3a0Esv9XEygRsW5JUnvbkTCklwA6RRrJCyEb1vaC0UyNCqL MnQODTUO71DEBFsIG4qocZXY9J0Le7F43POWrW0EIWbspYfk+wrfgZg4pL3HzEAv5mza T9MTyiyZMjOmqOXXFW/YimuzbwTwWWii45hggdg5tLcJi1m0VKvO7uPynFwTTo4SdawZ rkCOHQ7zi9JSBSO4LDo9kSzXdfhOwPSQh0g3JPdpVIoXet/HgFCH1zZS7yVKlCjFsToo gjWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=exxx++O6; 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 t12si13788763otm.224.2020.02.05.06.14.27; Wed, 05 Feb 2020 06:14:45 -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=exxx++O6; 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 S1728133AbgBEONG (ORCPT + 99 others); Wed, 5 Feb 2020 09:13:06 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:24074 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727330AbgBEONG (ORCPT ); Wed, 5 Feb 2020 09:13:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580911984; 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=Y9VUI5/IBa9XUGA62AeVFROjjQbrdeFr4e/QsRz47wE=; b=exxx++O6Kwuti1thMMcNhzeYYeBlWd7QkRa2RFGVDaXqurYD+A8/K9SsAA5D818cywmj3o U0YMwKfH8nCfBLw1T+uOEnu8bMm9rooWBq1zqgP3TeFOni2LxUKDujs5SWjY+/QryXUDbc Q113xjafP9mQsrk5og/sCk8469r6Loo= 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-386-C5-J_TlvOiuGYBE4Esvcew-1; Wed, 05 Feb 2020 09:13:02 -0500 X-MC-Unique: C5-J_TlvOiuGYBE4Esvcew-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9FBB58010F1; Wed, 5 Feb 2020 14:13:00 +0000 (UTC) Received: from localhost (ovpn-12-97.pek2.redhat.com [10.72.12.97]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DEB9686C4A; Wed, 5 Feb 2020 14:12:57 +0000 (UTC) Date: Wed, 5 Feb 2020 22:12:54 +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: <20200205141254.GD8965@MiWiFi-R3L-srv> References: <20191006085646.5768-1-david@redhat.com> <20191006085646.5768-9-david@redhat.com> <20200204142516.GD26758@MiWiFi-R3L-srv> <20200205124329.GE26758@MiWiFi-R3L-srv> <20200205133442.GC8965@MiWiFi-R3L-srv> <2868343a-745b-e2b6-7e78-d5649c00ee31@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2868343a-745b-e2b6-7e78-d5649c00ee31@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/05/20 at 02:38pm, David Hildenbrand wrote: > On 05.02.20 14:34, Baoquan He wrote: > > On 02/05/20 at 02:20pm, David Hildenbrand wrote: > >> On 05.02.20 13:43, Baoquan He wrote: > >>> On 02/04/20 at 03:42pm, David Hildenbrand wrote: > >>>> On 04.02.20 15:25, Baoquan He wrote: > >>>>> 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. > >>>> > >>>> Could only happen in case the zone_start_pfn would have been "out of the > >>>> zone already". If you ask me: unlikely :) > >>> > >>> Yeah, I also think it's unlikely to come here. > >>> > >>> The 'if (zone_start_pfn == start_pfn)' checking also covers the case > >>> (zone_start_pfn == start_pfn && zone_end_pfn == end_pfn). So this > >>> zone_start_pfn/spanned_pages resetting can be removed to avoid > >>> confusion. > >> > >> At least I would find it more confusing without it (or want a comment > >> explaining why this does not have to be handled and why the !pfn case is > >> not possible). > > > > I don't get why being w/o it will be more confusing, but it's OK since > > it doesn't impact anything. > > Because we could actually BUG_ON(!pfn) here, right? Only having a "if > (pfn)" leaves the reader wondering "why is the other case not handled". > > > > >> > >> Anyhow, that patch is already upstream and I don't consider this high > >> priority. Thanks :) > > > > Yeah, noticed you told Wei the status in another patch thread, I am fine > > with it, just leave it to you to decide. Thanks. > > I am fairly busy right now. Can you send a patch (double-checking and > making this eventually unconditional?). Thanks! Understood, sorry about the noise, David. I will think about this.