Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp213976pxu; Tue, 5 Jan 2021 08:57:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjaQVzDyxobEirBl03HWSZ6O8L7h7o6kKb1y65Qmy0wwZcXyyoOcmmheAFEqCrQypDPAo+ X-Received: by 2002:a05:6402:b9a:: with SMTP id cf26mr669847edb.372.1609865853003; Tue, 05 Jan 2021 08:57:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609865852; cv=none; d=google.com; s=arc-20160816; b=kzLBNisAB1+xsJ/zQhXBgx9KY/rJajEvjp05m6FC66DmYCR+ZVv+axpZIMdrzUlo04 TLYmmBNuQPBlfzZsKW2ZYKUJ1fN9Pf8ew6ynZgxw7Ie6IWqrEtMCNoK/c17FNbgELVRe /2dEVZ5/Jy3m+VhwOUO1TT1gY17Z0p2gpBKI7s3uAeqb5XJE3f5znl3DJKR62dbueXHh MscvaQHjlNkvrLSXk7FVYAYaS099sD0diAswiGsRMbNc7jzkEUfkMlbuUNjKzcHlVBcA rBBAnAFw5sTi44GaqZXQJ9jMpt+xRju+71YgS0JsdZAVHVBtTgJMVTtCeElu9NdrVwpT dBwQ== 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=mvbp9ydae0x8bD/hpneZjQLEAQC9nXZA01gZoxVO3D4=; b=qZyCsCW29NLZL+3IZdfuO3QISady/HgSJFza9CO1VPJNY9Q2BHAf16xH02ZTMeJ+dw Z7xZiw49pd32rYhJhtPaHekM3AV1T2TOzvkMTnhA/8qNHLz1SKTnntAZPkbswNOTbI6B XJIRckymUmCIGRnQEOc+Lp+lZT6cuhAlUPr/X7Ze5Esr58L3declITxsAcHgHiutOD/t cqOAtyE+nTN2NMql+ieEhgakciOsfjTshOHr0NzTZYHCxOFk1S70b2IN1NQOL4p9Q+bM tuwDzaff5GfUKCVnDLYHzjhL8DcFjhtvGxWqnE9qfXQMb3MFLaVnSioflvVZNt3R5Vzy tLSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LbThyeks; 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 eb5si72187edb.393.2021.01.05.08.57.09; Tue, 05 Jan 2021 08:57:32 -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=LbThyeks; 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 S1729248AbhAEQzK (ORCPT + 99 others); Tue, 5 Jan 2021 11:55:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45230 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbhAEQzK (ORCPT ); Tue, 5 Jan 2021 11:55:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609865623; 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=mvbp9ydae0x8bD/hpneZjQLEAQC9nXZA01gZoxVO3D4=; b=LbThyeksSEDEHH++iPsPjq6QNxOg1CBvQI/bwmdDkOqRrtlN9SOqhfFDCMcXvWK0jsLWOf GJCPxCn3nNE5pSmHoswM8Jh+3nvqdbkUD2b7zHCDENYkcfT/9TagXRuKV3toy0dVtEDdDB /zL9IqyQLF5qgbWm+fDhhxF68EaNgXg= 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-413-H9xuSLRIOo6Zu2iGm30Law-1; Tue, 05 Jan 2021 11:53:41 -0500 X-MC-Unique: H9xuSLRIOo6Zu2iGm30Law-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D920195D560; Tue, 5 Jan 2021 16:53:40 +0000 (UTC) Received: from [10.36.114.117] (ovpn-114-117.ams2.redhat.com [10.36.114.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2335E6D026; Tue, 5 Jan 2021 16:53:38 +0000 (UTC) Subject: Re: [PATCH v3 2/4] 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 References: <20210105074708.18483-1-bhe@redhat.com> <20210105074708.18483-3-bhe@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Tue, 5 Jan 2021 17:53:38 +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: <20210105074708.18483-3-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.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [...] > -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) > { > + unsigned long size = zone->spanned_pages; > + int nid = zone_to_nid(zone), zone_id = zone_idx(zone); > + unsigned long start_pfn = zone->zone_start_pfn; > + Nit: reverse Christmas tree. > 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/mm/page_alloc.c b/mm/page_alloc.c > index 69ebf75be91c..b2a46ffdaf0b 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -6292,16 +6292,16 @@ static inline u64 init_unavailable_range(unsigned long spfn, unsigned long epfn, > } > #endif > > -void __init __weak memmap_init_zone(unsigned long size, int nid, > - unsigned long zone, > - unsigned long zone_start_pfn) > +void __init __weak memmap_init_zone(struct zone *zone) > { > unsigned long start_pfn, end_pfn, hole_start_pfn = 0; > - unsigned long zone_end_pfn = zone_start_pfn + size; > + int i, nid = zone_to_nid(zone), zone_id = zone_idx(zone); > + unsigned long zone_start_pfn = zone->zone_start_pfn; > + unsigned long zone_end_pfn = zone_start_pfn + zone->spanned_pages; dito. > u64 pgcnt = 0; > - int i; > > for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { > + unsigned long size; You can just get rid of this parameter IMHO. (Also, there is an empty line missing right now) Apart from that LGTM -- Thanks, David / dhildenb