Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1122977pxb; Fri, 22 Jan 2021 07:42:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvJ6R7Umw3bsSGGOe7VStAk+mQMNixcY3PYOu4NUanoDF6V2yReRNR8HURencBs42mfVg8 X-Received: by 2002:a17:906:3fc1:: with SMTP id k1mr3520171ejj.58.1611330173645; Fri, 22 Jan 2021 07:42:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611330173; cv=none; d=google.com; s=arc-20160816; b=eyGit1VW9Up2Cw39kOl6ZdzOts176M6iJtc9S1dqWoLdRPDnNOWZeIK581vhAOL87R dwwfRyLfD0xJeMfNVuc3D0RvclJh2rWWkomis5BXqaTjHA7RlOKy6Ig0ngCc6hIoKS26 9o4L1R5IvsX7kAe0d4kaAfSvONpw9I3Vb5h5MNXq7ODjhqMYsiPV0vOaCJQW+YkMy4Hh SjPOwG9iDfVjZMr3c+XB5PANjhfel9InrslcvRCGAbvTN1S7SdPfjG3TtAliunuyYK2B GNxayE5cfY+d9Ax3eyX0aO0e4Jg8UsArv6iKToZw085Zk17nNZ0sGvp0/lf9Q3mwSN4g L6fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=ESJ0QrKeGhGsWuJLG8NvK72akqRJ71dwWfaLuOlWI3M=; b=PfmgKpTbVBPf+NJBVsPJ5vgLt9aHs1U6v5QocYuUVT/PwhayGljwCN9DzuooHmGg+R I5ulWPVreS4o9kz9/m5L0gEao1NQJ0snnxK1y2HaV/Hi7ZMPBk9ptLmmUU6qW2eYKQyP a7gxZEvhdwaK18jckxuluRdFs4AFXaDIL9GXwR52r+s2D7fPn8+NoES3d0Fw1sdKNbXK D2G6FwybTttUng2DvRGTQTZbI+IzLDtWGuFAHg+Fn1fReB42+um4IwzDdxhqN4o4l9Ld poKgw9FJV0zlORzzeoU2CDaBGFNoZY/921Z+uO57SpHlEiZUorivsId7Ef3Ud65+vP9Y uUew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FvRNDmqH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id d30si3983083edd.488.2021.01.22.07.42.28; Fri, 22 Jan 2021 07:42:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FvRNDmqH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728507AbhAVPlV (ORCPT + 99 others); Fri, 22 Jan 2021 10:41:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:25759 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728735AbhAVPk6 (ORCPT ); Fri, 22 Jan 2021 10:40:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611329970; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ESJ0QrKeGhGsWuJLG8NvK72akqRJ71dwWfaLuOlWI3M=; b=FvRNDmqHYvh/GcEY58MQcw2VUrGlKs92K9odKU97sTCDr1Wnlntpg/wd5RHS/0tXE6AXtn eB0KpKZnjZDIAYXBNYD6I0qvVHzc8ooXOVr8/zQE3u0RVziOgPWfuIeJMvmqSOSScWTHpr mUvsf5D2Psa7CiUbMf+rih7sKDXxY0Q= 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-452-XI37rcDhMJeAHZRtDUwp9Q-1; Fri, 22 Jan 2021 10:39:26 -0500 X-MC-Unique: XI37rcDhMJeAHZRtDUwp9Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 63567107AFAF; Fri, 22 Jan 2021 15:39:25 +0000 (UTC) Received: from [10.36.114.142] (ovpn-114-142.ams2.redhat.com [10.36.114.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 005DD5D960; Fri, 22 Jan 2021 15:39:23 +0000 (UTC) Subject: Re: [PATCH v5 3/5] mm: simplify parater of function memmap_init_zone() To: Baoquan He , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, rppt@kernel.org, lkp@intel.com References: <20210122135956.5946-1-bhe@redhat.com> <20210122135956.5946-4-bhe@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Fri, 22 Jan 2021 16:39:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20210122135956.5946-4-bhe@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22.01.21 14:59, Baoquan He wrote: > As David suggested, simply passing 'struct zone *zone' is enough. We can > get all needed information from 'struct zone*' easily. > > Suggested-by: David Hildenbrand > Signed-off-by: Baoquan He > --- > arch/ia64/mm/init.c | 12 +++++++----- > include/linux/mm.h | 3 +-- > mm/page_alloc.c | 24 +++++++++++------------- > 3 files changed, 19 insertions(+), 20 deletions(-) > > diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c > index c8e68e92beb3..88fb44895408 100644 > --- a/arch/ia64/mm/init.c > +++ b/arch/ia64/mm/init.c > @@ -541,12 +541,14 @@ virtual_memmap_init(u64 start, u64 end, void *arg) > return 0; > } > > -void __meminit > -memmap_init_zone(unsigned long size, int nid, unsigned long zone, > - unsigned long start_pfn) > +void __meminit memmap_init_zone(struct zone *zone) > { > + int nid = zone_to_nid(zone), zone_id = zone_idx(zone); > + unsigned long start_pfn = zone->zone_start_pfn; > + unsigned long size = zone->spanned_pages; > + > if (!vmem_map) { > - memmap_init_range(size, nid, zone, start_pfn, start_pfn + size, > + memmap_init_range(size, nid, zone_id, start_pfn, start_pfn + size, > MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > } else { > struct page *start; > @@ -556,7 +558,7 @@ memmap_init_zone(unsigned long size, int nid, unsigned long zone, > args.start = start; > args.end = start + size; > args.nid = nid; > - args.zone = zone; > + args.zone = zone_id; > > efi_memmap_walk(virtual_memmap_init, &args); > } > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 2395dc212221..073049bd0b29 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -2401,8 +2401,7 @@ extern void set_dma_reserve(unsigned long new_dma_reserve); > extern void memmap_init_range(unsigned long, int, unsigned long, > unsigned long, unsigned long, enum meminit_context, > struct vmem_altmap *, int migratetype); > -extern void memmap_init_zone(unsigned long size, int nid, > - unsigned long zone, unsigned long range_start_pfn); > +extern void memmap_init_zone(struct zone *zone); > extern void setup_per_zone_wmarks(void); > extern int __meminit init_per_zone_wmark_min(void); > extern void mem_init(void); > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 42a1d2d2a87d..cbb67d9c1b2a 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -6254,23 +6254,21 @@ static void __meminit zone_init_free_lists(struct zone *zone) > } > } > > -void __meminit __weak memmap_init_zone(unsigned long size, int nid, > - unsigned long zone, > - unsigned long range_start_pfn) > +void __meminit __weak memmap_init_zone(struct zone *zone) > { > + unsigned long zone_start_pfn = zone->zone_start_pfn; > + unsigned long zone_end_pfn = zone_start_pfn + zone->spanned_pages; > + int i, nid = zone_to_nid(zone), zone_id = zone_idx(zone); > unsigned long start_pfn, end_pfn; > - unsigned long range_end_pfn = range_start_pfn + size; > - int i; > > for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { > - start_pfn = clamp(start_pfn, range_start_pfn, range_end_pfn); > - end_pfn = clamp(end_pfn, range_start_pfn, range_end_pfn); > + start_pfn = clamp(start_pfn, zone_start_pfn, zone_end_pfn); > + end_pfn = clamp(end_pfn, zone_start_pfn, zone_end_pfn); > > - if (end_pfn > start_pfn) { > - size = end_pfn - start_pfn; > - memmap_init_range(size, nid, zone, start_pfn, range_end_pfn, > - MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > - } > + if (end_pfn > start_pfn) > + memmap_init_range(end_pfn - start_pfn, nid, > + zone_id, start_pfn, zone_end_pfn, > + MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > } > } > > @@ -6978,7 +6976,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat) > set_pageblock_order(); > setup_usemap(pgdat, zone, zone_start_pfn, size); > init_currently_empty_zone(zone, zone_start_pfn, size); > - memmap_init_zone(size, nid, j, zone_start_pfn); > + memmap_init_zone(zone); > } > } > > Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb