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=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 5227CC35240 for ; Tue, 28 Jan 2020 09:50:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 16AFC214D8 for ; Tue, 28 Jan 2020 09:50:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MeQgYqeo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16AFC214D8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BA9C56B000C; Tue, 28 Jan 2020 04:50:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B80D06B000D; Tue, 28 Jan 2020 04:50:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABD116B000E; Tue, 28 Jan 2020 04:50:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 961A76B000C for ; Tue, 28 Jan 2020 04:50:43 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 44497181AEF10 for ; Tue, 28 Jan 2020 09:50:43 +0000 (UTC) X-FDA: 76426573566.15.geese77_63e822b3cd5d X-HE-Tag: geese77_63e822b3cd5d X-Filterd-Recvd-Size: 6124 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Jan 2020 09:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580205042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z4VEk1TQJocoVn1eCYftAUL2rOMd475xRd2wOypY3DE=; b=MeQgYqeo39njWfL3T0dgtutdYfiK3uhA58kw0yPgUxQXKOjb1CCzeKM1gDVZJBtMKYsbgK RmgC7o2j2eM5u9FyijYgOtSsr27RMQBzG1EpcPsToDr7ejdarUAdzBf4k1Ta36x4oXOucj A7W5S1n8M0a1VgYwOXfUP7RqHblxFzA= 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-366-AsW-bVXtPd-zlna0HVTFAQ-1; Tue, 28 Jan 2020 04:50:36 -0500 X-MC-Unique: AsW-bVXtPd-zlna0HVTFAQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 677E51088381; Tue, 28 Jan 2020 09:50:35 +0000 (UTC) Received: from t480s.redhat.com (ovpn-116-207.ams2.redhat.com [10.36.116.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05DDC60C05; Tue, 28 Jan 2020 09:50:31 +0000 (UTC) From: David Hildenbrand To: stable@vger.kernel.org Cc: linux-mm@kvack.org, Michal Hocko , Greg Kroah-Hartman , Andrew Morton , "Aneesh Kumar K . V" , Baoquan He , Dan Williams , Oscar Salvador , Wei Yang , David Hildenbrand Subject: [PATCH for 4.19-stable v3 03/24] mm, sparse: pass nid instead of pgdat to sparse_add_one_section() Date: Tue, 28 Jan 2020 10:50:00 +0100 Message-Id: <20200128095021.8076-4-david@redhat.com> In-Reply-To: <20200128095021.8076-1-david@redhat.com> References: <20200128095021.8076-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Wei Yang commit 4e0d2e7ef14d9e1c900dac909db45263822b824f upstream. Since the information needed in sparse_add_one_section() is node id to allocate proper memory, it is not necessary to pass its pgdat. This patch changes the prototype of sparse_add_one_section() to pass node id directly. This is intended to reduce misleading that sparse_add_one_section() would touch pgdat. Link: http://lkml.kernel.org/r/20181204085657.20472-2-richard.weiyang@gma= il.com Signed-off-by: Wei Yang Reviewed-by: David Hildenbrand Acked-by: Michal Hocko Cc: Dave Hansen Cc: Oscar Salvador Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: David Hildenbrand --- include/linux/memory_hotplug.h | 4 ++-- mm/memory_hotplug.c | 2 +- mm/sparse.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplu= g.h index 6f13a5a33b51..008e5281e7d7 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -335,8 +335,8 @@ extern void move_pfn_range_to_zone(struct zone *zone,= unsigned long start_pfn, unsigned long nr_pages, struct vmem_altmap *altmap); extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages= ); extern bool is_memblock_offlined(struct memory_block *mem); -extern int sparse_add_one_section(struct pglist_data *pgdat, - unsigned long start_pfn, struct vmem_altmap *altmap); +extern int sparse_add_one_section(int nid, unsigned long start_pfn, + struct vmem_altmap *altmap); extern void sparse_remove_one_section(struct zone *zone, struct mem_sect= ion *ms, unsigned long map_offset, struct vmem_altmap *altmap); extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index e2e2cf7014ee..c109e3f0bc16 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -255,7 +255,7 @@ static int __meminit __add_section(int nid, unsigned = long phys_start_pfn, if (pfn_valid(phys_start_pfn)) return -EEXIST; =20 - ret =3D sparse_add_one_section(NODE_DATA(nid), phys_start_pfn, altmap); + ret =3D sparse_add_one_section(nid, phys_start_pfn, altmap); if (ret < 0) return ret; =20 diff --git a/mm/sparse.c b/mm/sparse.c index 9aca9f24bdc5..f52e8c328761 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -661,8 +661,8 @@ static void free_map_bootmem(struct page *memmap) * set. If this is <=3D0, then that means that the passed-in * map was not consumed and must be freed. */ -int __meminit sparse_add_one_section(struct pglist_data *pgdat, - unsigned long start_pfn, struct vmem_altmap *altmap) +int __meminit sparse_add_one_section(int nid, unsigned long start_pfn, + struct vmem_altmap *altmap) { unsigned long section_nr =3D pfn_to_section_nr(start_pfn); struct mem_section *ms; @@ -674,11 +674,11 @@ int __meminit sparse_add_one_section(struct pglist_= data *pgdat, * no locking for this, because it does its own * plus, it does a kmalloc */ - ret =3D sparse_index_init(section_nr, pgdat->node_id); + ret =3D sparse_index_init(section_nr, nid); if (ret < 0 && ret !=3D -EEXIST) return ret; ret =3D 0; - memmap =3D kmalloc_section_memmap(section_nr, pgdat->node_id, altmap); + memmap =3D kmalloc_section_memmap(section_nr, nid, altmap); if (!memmap) return -ENOMEM; usemap =3D __kmalloc_section_usemap(); --=20 2.24.1