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 91343C2D0CE for ; Tue, 21 Jan 2020 18:02:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 439A524125 for ; Tue, 21 Jan 2020 18:02:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="as3YGSGg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 439A524125 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 C6E116B000E; Tue, 21 Jan 2020 13:02:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BF7586B0010; Tue, 21 Jan 2020 13:02:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC2986B0266; Tue, 21 Jan 2020 13:02:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id 951376B000E for ; Tue, 21 Jan 2020 13:02:32 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 2F8903AA7 for ; Tue, 21 Jan 2020 18:02:32 +0000 (UTC) X-FDA: 76402411344.09.skate51_6d6a975fb6337 X-HE-Tag: skate51_6d6a975fb6337 X-Filterd-Recvd-Size: 6102 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Tue, 21 Jan 2020 18:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579629751; 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=as3YGSGgyRIPLALoGLyKCrtCrRx8Og+TZBK+iob2+o0HaUSSajz2YrU3CkYDfxtdX5WfEV ucjO1xTTQbV8wJb2WAuYWBPK1771BM5xAZWExlY10jGbge5PWDgRFayQJ7k0NH6urb/SP7 BcwoswuB5eYqsKdaWjzRNthz1SwUdiI= 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-37-c_WWBxw5P_q2DjVlB9Uwjg-1; Tue, 21 Jan 2020 13:02:12 -0500 X-MC-Unique: c_WWBxw5P_q2DjVlB9Uwjg-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 62B92100550E; Tue, 21 Jan 2020 18:02:10 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.36.118.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35EE45C1C3; Tue, 21 Jan 2020 18:02:08 +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 v2 03/24] mm, sparse: pass nid instead of pgdat to sparse_add_one_section() Date: Tue, 21 Jan 2020 19:01:29 +0100 Message-Id: <20200121180150.37454-4-david@redhat.com> In-Reply-To: <20200121180150.37454-1-david@redhat.com> References: <20200121180150.37454-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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