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.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 57009C7618B for ; Wed, 24 Jul 2019 15:45:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B29F21951 for ; Wed, 24 Jul 2019 15:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563983136; bh=77tzEDRGccrRGloCGUlsWoBuN28+wgi20jZfdYuwA1M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=xlY8Kg44RvrV2bQvcwkidJkaDFw0D258zRanyz3YZiihPL7/QoLg1T0V49U9tkihs 2eGy6qg3WYUxIYRMIRgfWOYN3fwXRmwTHtUMp/l5Fh6TtBZdI/ilZnbk0A6pvT2OPZ K3s2H2i84X1CoM5GZ61eqUpiHpI4VWsrDIpNrQ7w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728500AbfGXPpe (ORCPT ); Wed, 24 Jul 2019 11:45:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:59058 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727716AbfGXPpe (ORCPT ); Wed, 24 Jul 2019 11:45:34 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 79B36AE96; Wed, 24 Jul 2019 15:45:33 +0000 (UTC) Date: Wed, 24 Jul 2019 17:45:32 +0200 From: Michal Hocko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Oscar Salvador , Pavel Tatashin , Dan Williams Subject: Re: [PATCH v1] mm/memory_hotplug: Remove move_pfn_range() Message-ID: <20190724154532.GE5584@dhcp22.suse.cz> References: <20190724142324.3686-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190724142324.3686-1-david@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 24-07-19 16:23:24, David Hildenbrand wrote: > Let's remove this indirection. We need the zone in the caller either > way, so let's just detect it there. Add some documentation for > move_pfn_range_to_zone() instead. > > Cc: Andrew Morton > Cc: Oscar Salvador > Cc: Michal Hocko > Cc: David Hildenbrand > Cc: Pavel Tatashin > Cc: Dan Williams > Signed-off-by: David Hildenbrand Acked-by: Michal Hocko > --- > mm/memory_hotplug.c | 23 +++++++---------------- > 1 file changed, 7 insertions(+), 16 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index efa5283be36c..e7c3b219a305 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -715,7 +715,11 @@ static void __meminit resize_pgdat_range(struct pglist_data *pgdat, unsigned lon > > pgdat->node_spanned_pages = max(start_pfn + nr_pages, old_end_pfn) - pgdat->node_start_pfn; > } > - > +/* > + * Associate the pfn range with the given zone, initializing the memmaps > + * and resizing the pgdat/zone data to span the added pages. After this > + * call, all affected pages are PG_reserved. > + */ > void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, > unsigned long nr_pages, struct vmem_altmap *altmap) > { > @@ -804,20 +808,6 @@ struct zone * zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, > return default_zone_for_pfn(nid, start_pfn, nr_pages); > } > > -/* > - * Associates the given pfn range with the given node and the zone appropriate > - * for the given online type. > - */ > -static struct zone * __meminit move_pfn_range(int online_type, int nid, > - unsigned long start_pfn, unsigned long nr_pages) > -{ > - struct zone *zone; > - > - zone = zone_for_pfn_range(online_type, nid, start_pfn, nr_pages); > - move_pfn_range_to_zone(zone, start_pfn, nr_pages, NULL); > - return zone; > -} > - > int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_type) > { > unsigned long flags; > @@ -840,7 +830,8 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ > put_device(&mem->dev); > > /* associate pfn range with the zone */ > - zone = move_pfn_range(online_type, nid, pfn, nr_pages); > + zone = zone_for_pfn_range(online_type, nid, pfn, nr_pages); > + move_pfn_range_to_zone(zone, pfn, nr_pages, NULL); > > arg.start_pfn = pfn; > arg.nr_pages = nr_pages; > -- > 2.21.0 -- Michal Hocko SUSE Labs