From patchwork Tue Dec 4 08:56:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10711321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4BF21057 for ; Tue, 4 Dec 2018 08:57:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6EE62A50D for ; Tue, 4 Dec 2018 08:57:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A3E62A861; Tue, 4 Dec 2018 08:57:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A8282A50D for ; Tue, 4 Dec 2018 08:57:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52B556B6DDB; Tue, 4 Dec 2018 03:57:22 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 500476B6DDC; Tue, 4 Dec 2018 03:57:22 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F1F26B6DDD; Tue, 4 Dec 2018 03:57:22 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id EF8C16B6DDB for ; Tue, 4 Dec 2018 03:57:21 -0500 (EST) Received: by mail-pf1-f197.google.com with SMTP id h11so13458797pfj.13 for ; Tue, 04 Dec 2018 00:57:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=/BJUgbUYteirAsYokbZffEub6YPomN+G44tmfyiWZ5c=; b=a5sD/+7H52NLz9L5com0Bx+wgx14Kf0JCIbfqpnpRUTCCDK2w0LccThdQZnZmzo1vD kWEjlXh1v3gBy8ErvWVV7YzuFwNEzjI47NL/H8CIe/jCdO+C8tijCbaqvDuPfhwx+TCO uK0JXA5Cgnicfq4QcJ1IeKmKDRtT/ehxT4KSlEATmlP8BjSeJ/YbIItRJgQSzgKzB15R HBjoks7xa8xk3LAfBlqB50eU+sXphnlhkZNE5UF7qj0mU64g1tP5QMsfIuZ9Xq5GaNtR 5UzQ7XHcdPxwdJznirCj13os+r0eqvepoe5hP7hhs4KzidJj0KZcIrIqJhu9zbgjf1vW t8zQ== X-Gm-Message-State: AA+aEWbc9n+aaQvMEEFQaVsRrukiZTjwirj9gFFp5W27Jo9M0W5Xwrik nBG0Q8Ktd9qq0lSWBIpVL7AnQa4jBbAPrmy35WBbKkZMgeRKxScpDgbQ8OCk9GcT/421N7yqm+J x3LxRwXguVQ18nlj4BlPJ58162bOSs2hy0CLc63fdEdePV5SThB8+wTHD4paku4/KRlPxPBy3xp qGi9BLwPKKut9CergjeuQS4mf0jt+Qk7vmQRi+mOmgz8aBuioVIDJNE2IzsygvyaTBbm77nk+Aq 4JbiRKObsGPrfZFjZPmXs+jvOwg7AMwJO2lGHxHq5FpMLi/OM5RXL1sZjBu85IQeIEmjTBc6QI0 ANY+OCwDKw6PS/k/a0jZ9fbE4mtJqgEEy2NaMKC23k/J+Gd4hXBsgOBpFX3YYW3Y8gKkkncjioT r X-Received: by 2002:a65:65c9:: with SMTP id y9mr16468567pgv.438.1543913841649; Tue, 04 Dec 2018 00:57:21 -0800 (PST) X-Received: by 2002:a65:65c9:: with SMTP id y9mr16468540pgv.438.1543913840939; Tue, 04 Dec 2018 00:57:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543913840; cv=none; d=google.com; s=arc-20160816; b=Kff4oZClVebteogbeEEhErmh9habz0Xliu7qwKIjkm8PKrrbzT9/2OwrAlJbmb5ZSo sJ7dyiyQmFnIK4k4H6xCYzhmdrkyjqCaVBlOEIUhqh4652oaBuxr+4zxiK6NTDRbgLIy Y7J/cPvjDgwjaScvDyrL8Hofx5gKzQPcwFrM5S4Oy6pOomohWPFsngNdd1E7YHzs6vQL hdBPuUjdlWRzDq4gc2jJYTSr7cG+Jr55+zQjipB4ZpLyNyrB6PngL6v5K1PSyDIL60VX qx6R2Fc2zrgAtM9Q9rYjQwczydrCrwS6A2igrAhR2sNRzpxoLipNP1rFH8Ig5g3wfQS7 C1SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/BJUgbUYteirAsYokbZffEub6YPomN+G44tmfyiWZ5c=; b=xBXRCH2NJJ2q37v22RavEQh3BSUr8u6oO3YltUFdkIEMzjpo2WR5HTWRaixux+sG3d hFGBamlz/oQSrLqkddQrQdAbxV1Afsq6HCWsifx4ocBaxm5k4WbxD3DaGurkSobrGsQK bOHp+a5zdB/abu4WucN5rNqjkCfGAgVdWT4iK2rfUC0m6BKv7C7B7T4qteRHHTVSLcD9 E3AcOSut8M8fPE3F3sNgy8F5389SIi9OwYBslVNNs1ctOyKFswD5cqNr9sMefVwen0Rw El+pRz4SALsRG/TwpuZAZmHW5YaSoeittEJTkKIOV6yLvRuR1a8N5Dc8DaiebzYlkc51 oXXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R6HYZril; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y23sor20572187pga.35.2018.12.04.00.57.20 for (Google Transport Security); Tue, 04 Dec 2018 00:57:20 -0800 (PST) Received-SPF: pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R6HYZril; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/BJUgbUYteirAsYokbZffEub6YPomN+G44tmfyiWZ5c=; b=R6HYZrilphgqBPR1Dv8AToqxDFW81UdauCyVYERWcceJAaz78+UOsXw4fV9IYgorV6 WufHq3dt8HjFQTTs/CSuDXLkECGDnELj6g5EcIPl7nUsP/8kB5U7/KZPVYTmksQqs1Xc MiJa/d/ad2h/ub1kV1KkzPQle3a/1iEJf2BsmvYD0stUggt3N0bzkpSQ/TU8Lir5VDwC RRhx5e6YlDD89nbFJaJHea+ndalYlu7kCyp7DjoddTPe/AMm8g/v+yANcCkJRR3rku2F vlPAsQWeOXRUhe30wsAItLE9o8VDNNBBAJPhAcT8orMLikaChjDibBw9Iec94Lp1vvtC POYA== X-Google-Smtp-Source: AFSGD/VgSSirdPpHse5RXl5NF+w8H3f34dKdUEzWengBminWrgRixtD86pAAczgoahsXWHvo0v3bxA== X-Received: by 2002:a63:df13:: with SMTP id u19mr16231556pgg.294.1543913840565; Tue, 04 Dec 2018 00:57:20 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id y6sm45391424pfd.104.2018.12.04.00.57.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 00:57:19 -0800 (PST) From: Wei Yang To: mhocko@suse.com, dave.hansen@intel.com, osalvador@suse.de, david@redhat.com Cc: akpm@linux-foundation.org, linux-mm@kvack.org, Wei Yang Subject: [PATCH v4 2/2] mm, sparse: pass nid instead of pgdat to sparse_add_one_section() Date: Tue, 4 Dec 2018 16:56:57 +0800 Message-Id: <20181204085657.20472-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20181204085657.20472-1-richard.weiyang@gmail.com> References: <20181129155316.8174-1-richard.weiyang@gmail.com> <20181204085657.20472-1-richard.weiyang@gmail.com> 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: X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Wei Yang Reviewed-by: David Hildenbrand Acked-by: Michal Hocko --- * adjust parameter alignment --- 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_hotplug.h index 45a5affcab8a..b81cc29482d8 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -333,8 +333,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_section *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 f626e7e5f57b..5b3a3d7b4466 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -253,7 +253,7 @@ static int __meminit __add_section(int nid, unsigned long phys_start_pfn, if (pfn_valid(phys_start_pfn)) return -EEXIST; - ret = sparse_add_one_section(NODE_DATA(nid), phys_start_pfn, altmap); + ret = sparse_add_one_section(nid, phys_start_pfn, altmap); if (ret < 0) return ret; diff --git a/mm/sparse.c b/mm/sparse.c index 5825f276485f..a4fdbcb21514 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -662,8 +662,8 @@ static void free_map_bootmem(struct page *memmap) * set. If this is <=0, 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 = pfn_to_section_nr(start_pfn); struct mem_section *ms; @@ -675,11 +675,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 = sparse_index_init(section_nr, pgdat->node_id); + ret = sparse_index_init(section_nr, nid); if (ret < 0 && ret != -EEXIST) return ret; ret = 0; - memmap = kmalloc_section_memmap(section_nr, pgdat->node_id, altmap); + memmap = kmalloc_section_memmap(section_nr, nid, altmap); if (!memmap) return -ENOMEM; usemap = __kmalloc_section_usemap();