Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14396652pxu; Mon, 4 Jan 2021 23:51:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBlni+fVpacbRrFF1XtMglDleQPdgfuMLKsnh9t620PaRs2HBGQMOAIv/z5hZFcmzwdD3x X-Received: by 2002:a17:906:31d2:: with SMTP id f18mr69035699ejf.407.1609833071074; Mon, 04 Jan 2021 23:51:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609833071; cv=none; d=google.com; s=arc-20160816; b=Rc1ELPDb7CWdi+a5N4FmkyR9nU/KEWXP1iu0iOIYtKWkbO8ti0Wjr+I/53XROK/q2q eNbjCozEnHfwWEsvkjVy+GDSPMeb0ZqfGP3FJLfLgo+lYFyN/7pn3F/1eH/gZRE7JPQ0 gGgBsMu5nyjDjBUKHk9psGnTQFotq9miRgc4axh+zhnMeF6MuhiV3Hx8zozNL+yEXm9J 2G2V6Jf9D+5WQ6rSFxvbUmKtRuItVpWvf189loPSz52JI3dY6zViMQjQ3BD77HutPymQ gCybATCfsb/oXY2icm8GxdMghKzRaepmvO8/oXOkfIAdFo98kVY2bg/jilmsW4Nk5tiw 5veg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=b2U2nEqaOtojovkjXAeglzjCU2zPKv7iQLxjUumzErg=; b=eTMJkb/rdSHBPqj0Uo5G/gdfmuYm5rjjGVFw43KWRD7Tj19Z6mNogFQOb4HuBkwYNN SoaTyolPrauwlwf1Yj8i1N4A1EeOhJ9GlZEFTa6d3pjc10hmuugj9eJ7l2ADkqvg5MYN uIxiXVUVO1mJe8KBLZIosZ6dZX5tmC80y/616XDiex+5DK1fEu/ccwaHGDbaBEyWySUq 3/VH4EdEXYY1hfvIt2YwpcEE+MhOkNLSMrrnCEyG4Ece+H95+E6wx7aBKLRw5f4zk+ZY kkxrxtaiBUA1HxwQcUPVizFurRfzITRt3xkoS2yUz0/6OH+AKk1bUJ/L0+kNr0iViKRc 7YGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fmm6KucZ; 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 n17si30412069eja.271.2021.01.04.23.50.48; Mon, 04 Jan 2021 23:51:11 -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=Fmm6KucZ; 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 S1727187AbhAEHs4 (ORCPT + 99 others); Tue, 5 Jan 2021 02:48:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46914 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbhAEHsz (ORCPT ); Tue, 5 Jan 2021 02:48:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609832849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=b2U2nEqaOtojovkjXAeglzjCU2zPKv7iQLxjUumzErg=; b=Fmm6KucZj/W5CeqQGV5PkZaQSeqqMh2bhZGd4tr07DYIosvEtGwl2Fat/GOxr3vcGr/sTM UCbII3ekUPZFPGoGQkxzcIH8LFI/+JXGG0KuXBRHilxnSsehRZcbdgHxCjdMAg0hXAUISz lGgc5PSyYlhZuh1ws16FquQmsIhjRB8= 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-480-CHXO33XYPL2TcSEPInJL1A-1; Tue, 05 Jan 2021 02:47:27 -0500 X-MC-Unique: CHXO33XYPL2TcSEPInJL1A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C115859; Tue, 5 Jan 2021 07:47:26 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-13-56.pek2.redhat.com [10.72.13.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64D6671CA1; Tue, 5 Jan 2021 07:47:24 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, rppt@kernel.org, david@redhat.com, bhe@redhat.com Subject: [PATCH v3 3/4] mm: simplify parameter of setup_usemap() Date: Tue, 5 Jan 2021 15:47:07 +0800 Message-Id: <20210105074708.18483-4-bhe@redhat.com> In-Reply-To: <20210105074708.18483-1-bhe@redhat.com> References: <20210105074708.18483-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Parameter 'zone' has got needed information, let's remove other unnecessary parameters. Signed-off-by: Baoquan He Reviewed-by: Mike Rapoport --- mm/page_alloc.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b2a46ffdaf0b..e0ce6fb6373b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6824,25 +6824,22 @@ static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned l return usemapsize / 8; } -static void __ref setup_usemap(struct pglist_data *pgdat, - struct zone *zone, - unsigned long zone_start_pfn, - unsigned long zonesize) +static void __ref setup_usemap(struct zone *zone) { - unsigned long usemapsize = usemap_size(zone_start_pfn, zonesize); + unsigned long usemapsize = usemap_size(zone->zone_start_pfn, + zone->spanned_pages); zone->pageblock_flags = NULL; if (usemapsize) { zone->pageblock_flags = memblock_alloc_node(usemapsize, SMP_CACHE_BYTES, - pgdat->node_id); + zone_to_nid(zone)); if (!zone->pageblock_flags) panic("Failed to allocate %ld bytes for zone %s pageblock flags on node %d\n", - usemapsize, zone->name, pgdat->node_id); + usemapsize, zone->name, zone_to_nid(zone)); } } #else -static inline void setup_usemap(struct pglist_data *pgdat, struct zone *zone, - unsigned long zone_start_pfn, unsigned long zonesize) {} +static inline void setup_usemap(struct zone *zone) {} #endif /* CONFIG_SPARSEMEM */ #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE @@ -7037,7 +7034,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat) continue; set_pageblock_order(); - setup_usemap(pgdat, zone, zone_start_pfn, size); + setup_usemap(zone); init_currently_empty_zone(zone, zone_start_pfn, size); memmap_init_zone(zone); } -- 2.17.2