Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp357786ybv; Wed, 5 Feb 2020 06:49:45 -0800 (PST) X-Google-Smtp-Source: APXvYqxf4h6EqzRFQLzL+9+MwJG4DCFu4WDVZM+4xMTq+RF+UcMpCb9J0XGjwPy/96CsrahCGKcT X-Received: by 2002:a9d:7086:: with SMTP id l6mr25065852otj.294.1580914184990; Wed, 05 Feb 2020 06:49:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580914184; cv=none; d=google.com; s=arc-20160816; b=gWa3kYvML8aSr4kJRCB7WgIY6i29yXGtx9fRxSztXlNcdZQEwGbvo7dkBgNEbjb9Ej np/kmjA7tp5BHrwGVfUn1KkHo9ZoWa0/VBG5dtIp6ubg9K+tKPr5ucHQlPaiwsVxlk1c shUGqON5kBIbznBCK1khDFecGjOpd0PHDvUwQqWs2ajaA/90ciQ6QoBbGE5EU0UR8qmb +H1ACCQc7tfE2IW4ConefVb7olsIZ2mtU6xDQO7nEXYGPoXIX74FSN+O2slAOHGOjViw QPCPkWuyRUd2lcyaifryV7Nyjq/+GASGfvhAgp73sjOlqkrWnzSTh6jlewNCOk5NByJM BgKw== 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=95aJqeVITxcGTfX0TCyAquXczebVTrMMk8jxCMfrdaA=; b=aXOyqJhRKjCqkornb0Vmmmt2fatGbtRPW9I/O/YylJa387c3eCP408SzjaY+uCX2M2 XnPQs/s4/ci9G6a5/yaVUIp1vJetS97Snb8p8aVyZBCFG3hPh5CPEKD+jtLWMMKlnLK/ 5bt1m4EfmHlGArsiP1mOKKMZyZIfnGB7I4DnTVRX+SyycU/B8t063g0zsOL8+9oKe2hI tqve9X1vW4OEDrQ5VsqGyv0Bly/KYFcldh9/dVcr/bl5Jo+hWfAbYZabM9vwli+D9e+y 8wUQQ9CQ+4U66nvzr7Yy6AeHAAGvNWRrtxCcPD6FEM8ePdE72X10/40LDdeT3+SmEX4O hH9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=csholPkl; 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 k8si13461698otp.69.2020.02.05.06.49.32; Wed, 05 Feb 2020 06:49:44 -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=csholPkl; 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 S1726806AbgBEOsf (ORCPT + 99 others); Wed, 5 Feb 2020 09:48:35 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:46599 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726334AbgBEOse (ORCPT ); Wed, 5 Feb 2020 09:48:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580914113; 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=95aJqeVITxcGTfX0TCyAquXczebVTrMMk8jxCMfrdaA=; b=csholPklvLJoEHzFfu9LFT9gxzMrcpncGEy7oe69ILdvOfG3/gp7OjkeegT5nqAxbQTmtN 6BycIpZyO/+3LB+OH97P3R56TU7Hi4xdLVn9jzu7bM0emW4dMZuM0EwzJov31UXAnLWedV JRHRNiFNRhAoU4/TI1vNC298FpIqJlY= 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-34-CRKct6xKO9GNNI26yrfXjA-1; Wed, 05 Feb 2020 09:48:20 -0500 X-MC-Unique: CRKct6xKO9GNNI26yrfXjA-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 8C1E51083E81; Wed, 5 Feb 2020 14:48:18 +0000 (UTC) Received: from localhost (ovpn-12-38.pek2.redhat.com [10.72.12.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC77F87B00; Wed, 5 Feb 2020 14:48:14 +0000 (UTC) Date: Wed, 5 Feb 2020 22:48:11 +0800 From: Baoquan He To: Wei Yang Cc: David Hildenbrand , 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 Subject: Re: [PATCH v6 08/10] mm/memory_hotplug: Don't check for "all holes" in shrink_zone_span() Message-ID: <20200205144811.GF26758@MiWiFi-R3L-srv> References: <20191006085646.5768-1-david@redhat.com> <20191006085646.5768-9-david@redhat.com> <20200205095924.GC24162@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200205095924.GC24162@richard> 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 Hi Wei Yang, On 02/05/20 at 05:59pm, Wei Yang wrote: > >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; > >+ } > > } > > If it is me, I would like to take out these two similar logic out. I also like this style. > > For example: > > if () { > } else if () { > } else { > goto out; Here the last else is unnecessary, right? > } > > Like this, I believe both David and I will be satisfactory. Even though I still think his 2nd resetting is not needed :-) > /* The zone has no valid section */ > if (!pfn) { > zone->zone_start_pfn = 0; > zone->spanned_pages = 0; > } > > out: > zone_span_writeunlock(zone); > > Well, this is just my personal taste :-) > > >- > >- /* > >- * 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 > > -- > Wei Yang > Help you, Help me >