From patchwork Thu Nov 29 15:53:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10704839 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 8CB9813AD for ; Thu, 29 Nov 2018 15:53:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D0942C488 for ; Thu, 29 Nov 2018 15:53:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70E332CD12; Thu, 29 Nov 2018 15:53:47 +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 EBDA82C488 for ; Thu, 29 Nov 2018 15:53:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2538E6B535E; Thu, 29 Nov 2018 10:53:46 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1DA566B535F; Thu, 29 Nov 2018 10:53:46 -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 053BF6B5360; Thu, 29 Nov 2018 10:53:45 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by kanga.kvack.org (Postfix) with ESMTP id B902D6B535E for ; Thu, 29 Nov 2018 10:53:45 -0500 (EST) Received: by mail-pl1-f199.google.com with SMTP id o23so1735575pll.0 for ; Thu, 29 Nov 2018 07:53:45 -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=7l3xF0LPzljp6OTUdEBlMAkZSIyZq91E79RFn2x9oxo=; b=FhYzFLbPc8mDihJlHseTqdNIHL2DC9cDrME6FjMYa8F4HJp8ZH5D5gS/nui4JDTw3u RTOldOG1N3VXbS/eXcS/TQMxww+mF4bSAmDtuk+P7I+cIuXd3Aylpu0QrnJjfzBvn/4P sjEc4XbeumkT3ipyqChZ75dov7JLffB2xXzXFQDDDnUUb3gDJJobegWel2giAJ8aySuJ FchXiFK5C8HnCzKKVlI19LUWzO+7D6VdbZ+k39joOhT0lqU9HMZo5uDhvk/buu6bO+PU nQLuOL6jSfK294J4CmwcKORoKbIn9PlOdTDVk23+4wYy/35LbORjr5DvB0nPwuF1FaYw fSMA== X-Gm-Message-State: AA+aEWYmqepwxZ4JLICigxg7zICQ6wvYK4GNLQ1WomQaS7fh+xwC2iMR u/cfBGwewRW+663IvBpGwmzv+RzTgZpxCDtpMv/6joo2HdWnFuNR8Apb1AgMyE10XWm6RTDuMas rWSime3GuRVfJNgXGRSOlJ+6WABH5h1R0sIbUM79Ik68b0E3TGIdy48Tktm302mtu6QSwt7fczI qjK/IorHUe9+FWjbSo3JUDWlNPMmu4OfcmOOVunyKodEAhowWk997MpIl8PBvIyUpEhuuQCJUbt kAI2I7xpYjMEruK2QEc5R9nYZR7cM8a/FI8TUcywe9CACKDf9oshdgYjihZoBwooQs1XiUfFPL5 44kFMffnAtQJ/MYlT1cXOsJaXdijx/NaPJ5GNhkMMhuASaNwhJ2BeYvwo21wutWDzpZc/vYWeSQ E X-Received: by 2002:a63:e001:: with SMTP id e1mr1675916pgh.39.1543506825393; Thu, 29 Nov 2018 07:53:45 -0800 (PST) X-Received: by 2002:a63:e001:: with SMTP id e1mr1675876pgh.39.1543506824576; Thu, 29 Nov 2018 07:53:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543506824; cv=none; d=google.com; s=arc-20160816; b=rs7Rpr0N6VeRM7LEWl16rHJ8LVH4SowhIdc/zkPG+bu8EeDwX3uH9dB0Y7LchMJrC1 IvZusviHYdT2gdenQ1BQIV6oa12QhaOZAwvN748SstjJzcIT/JBPtl2dlASFfdZfy4qn iZ5PzvuX2ibt4TVMZjQ2/5OoFWTL9RpiORuYyw0ESoszbkTeN0js3jTx0Z8vq+4kIo9r Mbn/kLFLataTVb0H1mnKg+MYGAXB3vKnR2Qc2yVgUDFP8mIE97e6+54f1K++sMBJN6oo O6ctP8iS97hnnxrh3feQr+Otx4mCQbj6PtVxJdfLCSg6vD/IsPgKFMDxAVl3Tnbk476o 1qmA== 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=7l3xF0LPzljp6OTUdEBlMAkZSIyZq91E79RFn2x9oxo=; b=Nl/LYqeyf470lZFTR5XFJqx/h9Byg27nyz9LHhgsMIiWGKiySqOdY3LVnu6PHo/Av1 nGMlGeABd3Bh3UeteYZGbVIgfF1hNHVxgv9VORG6gg0WISmla5pjt1FPzC1zOTVBk/7l /IBPfPNbV1I4T2B6VnyggyxfTWV9f2BSpareuNuIn5DGdEOKMMkGYwajeHLPnt93SYgs oi0X9GJspd8Keo3NMxGoKUhu1VdMV0HgSx/iqsKNiJdZG81AFQyoxSqf84zF+ZibA9iZ MWqmQCM0U6LkQiBsPj6qf8FD1Vv814D85WqpkpZFMJOt2bkk1D01jS4MpUHdJkhQihqk aFdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="a//q86L0"; 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 p18sor2852719pgl.33.2018.11.29.07.53.44 for (Google Transport Security); Thu, 29 Nov 2018 07:53:44 -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="a//q86L0"; 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=7l3xF0LPzljp6OTUdEBlMAkZSIyZq91E79RFn2x9oxo=; b=a//q86L01Tb5q8st9NQGNBbsG//L548NAGttpz3uHm+eLFuaTHB/shoKoFI3TNYzbb TAhsgtROKVt3UcX+kPd+JpYpJYMVaVBH5Ly2hkW5Uyn56CaV2UhG0trp8WepUKRXYhDP aURC7+nZOKp05W2QujhhRvDFXylEq5/GZ+u+nOaKlXYbzcWDgAadPyvKcKRbt3tyyb13 +egFcMth913yNx0TE9HLUAjGP0J3W1OUEPBQduzie5acveIOIk7cVDte+EIdWA+pKLYE ASuuBmAALwZFJ38/tsB8QrceHaFs8ZffcZhBfvT24tacUjAB5NSU3MyeFkvp8GXJ6lBP pcDA== X-Google-Smtp-Source: AFSGD/U4uWYtdf8qKhWIWYCEd9HPDPb9REcJopCeM3LTrqxIM4gKnn0AjciU/gF9ppPTGZhnATEIzg== X-Received: by 2002:a63:e20a:: with SMTP id q10mr475052pgh.206.1543506824221; Thu, 29 Nov 2018 07:53:44 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id g3sm8353932pfe.37.2018.11.29.07.53.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 07:53:43 -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 v3 2/2] mm, sparse: pass nid instead of pgdat to sparse_add_one_section() Date: Thu, 29 Nov 2018 23:53:16 +0800 Message-Id: <20181129155316.8174-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20181129155316.8174-1-richard.weiyang@gmail.com> References: <20181128091243.19249-1-richard.weiyang@gmail.com> <20181129155316.8174-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 --- include/linux/memory_hotplug.h | 2 +- mm/memory_hotplug.c | 2 +- mm/sparse.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 45a5affcab8a..3787d4e913e6 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -333,7 +333,7 @@ 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, +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); 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..2472bf23278a 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -662,7 +662,7 @@ 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, +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); @@ -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();