From patchwork Fri Jul 5 04:15:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 11031997 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 6C664112C for ; Fri, 5 Jul 2019 04:16:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51CBC289F2 for ; Fri, 5 Jul 2019 04:16:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44B5C28A5E; Fri, 5 Jul 2019 04:16:33 +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 7FED2289F2 for ; Fri, 5 Jul 2019 04:16:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 975C56B0003; Fri, 5 Jul 2019 00:16:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 924748E0003; Fri, 5 Jul 2019 00:16:30 -0400 (EDT) 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 7EC4B8E0001; Fri, 5 Jul 2019 00:16:30 -0400 (EDT) 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 4D0056B0003 for ; Fri, 5 Jul 2019 00:16:30 -0400 (EDT) Received: by mail-pl1-f199.google.com with SMTP id d6so1020249pls.17 for ; Thu, 04 Jul 2019 21:16:30 -0700 (PDT) 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; bh=DIVzl05bCmHqAQSTOF3kZ/Ym5AufpX9dq9JbDFqM6xA=; b=PEtiGeTw/WJHsg07xxMXgt+GhyW9IEtFa37FnCVh7WpGrPsCvtDZDlGBxcaWrPVkb+ V6fWshGJmnM6wLpuMxJo99EfrN0wYbg6WJrU5Exx8BPiiNxlhOYLhRs7NirJYWlrhMzT P4dhhYNj1OmQxbmaUBhJiDuYm1JZmaoslEPWNhP9H8kwkLMJimXwpqNhtnUtX8pcKHE1 oy2fUF7GFZw6ji8IU8WhXyTI9m/CAc/hv2QK1wR1+uEscGDnUziOzGn+YSHKyH6yMhcc VSJBUTL/d+PC90olmVZtzAR69jNkGwxs4JFtbo5rqU6Vt8tNvPguvrmooJK46UD1KG/z CgXg== X-Gm-Message-State: APjAAAXsMCnTxImhXwia5APdETl+sI9LcKAFLjVh11ZlKu+gXOz7kuk6 w/TDPsuq1NiOz8wHL8G7O3wJYff4GUS/7Fwr5qr1mXx7APMZcgvkri7E2P1SRJwhpVt8K+2BGkX 9Z39YKfoUPCkp6d0nT7IaXkQ0bOPDzghc+EY3FVCmI6FrHFdFBOqXIryPch8i3WU2yw== X-Received: by 2002:a63:3ec7:: with SMTP id l190mr2392195pga.334.1562300189753; Thu, 04 Jul 2019 21:16:29 -0700 (PDT) X-Received: by 2002:a63:3ec7:: with SMTP id l190mr2392137pga.334.1562300188726; Thu, 04 Jul 2019 21:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562300188; cv=none; d=google.com; s=arc-20160816; b=PeBMi1Zc0Y6fVNRWInEsCAGmNfqA7v+ikY6rJ9nlWn/VEC61QT6KPK0duWrYgBcOZt 1QZC31NrxSYjSgCo0ECPRMfcdwbYK1bX/QHuir+DgfhdlCL3TlcfPwPxsy8Iubjm1F+F i5SKPJurxoJQw1Xfu87NntCVsBhHwt2q7ZajvV6jvLFX1tazsxSaneHqIP9jj36Nri/b upla5PlTWHovd3c6kgqgDSoc6kCJOiWPuDcqfa2TnQ0+2D81syNN6qY8cSiTVR+Nf/0Y s68HiTlpmD9ko4KiakcNrvvs2kjXmsEs3ex6rNzlKVKLQPbx2JIXk3OepYTQVSSFMeU+ D+lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=DIVzl05bCmHqAQSTOF3kZ/Ym5AufpX9dq9JbDFqM6xA=; b=R4mm/InJbe04rebRN8UDL2YL+91hZMBPR7KY9tQVl/cWknAcA5lPcu6UfLLO+CV4CI 1SByHZDaOKNnhxg7mHhXqNL4ZVWiqPi7z1ZHdVMWOOE/TnrRh7Is82lzzOQ838Xn+Xht qWcz1tNGGcxSF+T9JJLml1Osj+TOR6BZbjZNdRN3bHmWuoXzznTnItkLElEvZVmEIiPG 0a3lv+qaEqNZr/zL0JUI7SAyn1mrAj64b4FxAOiLrFD9CCe99X463lMNCwJ2/TtU+8/p IyNB5J+mrATB0IMiNE3V2gvh3iQadIx03wWRLDxhXHKS8ilRI/pSm39nSIuSWyJN560d F/YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=irbfu9qA; spf=pass (google.com: domain of kernelfans@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=kernelfans@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 n11sor8977611plg.68.2019.07.04.21.16.28 for (Google Transport Security); Thu, 04 Jul 2019 21:16:28 -0700 (PDT) Received-SPF: pass (google.com: domain of kernelfans@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=irbfu9qA; spf=pass (google.com: domain of kernelfans@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=kernelfans@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; bh=DIVzl05bCmHqAQSTOF3kZ/Ym5AufpX9dq9JbDFqM6xA=; b=irbfu9qArbablvA6nbNLTjhMKotjU5R09Zqx9DqYYzjYZz6fd5+MPt/5WZbfkukptH ModvZovWGiIEr+b3EIj5ZiICW7ImUrh3nRwJTahq1LWKcCom1ky/dNd/YJtqmVepFxZ8 7AsjoiTxjhRx2Aj53GHp3t5fLh2hoojsAcpKPqb0LR381CH/haWPEyvmmHBz2cAivW99 WVXDORQ9Wr97G+nOp9RqBFcimlQK4ne9s+s2+ZgyW2brfU8QICXkVIuoj+gkRZdHXC3l ZmGrtQLaXCzMowk6ehabqxUsVefUs7+VLbWuol4DwWq9rU1zsWApq87yWvwdSTmkzzeM C6nw== X-Google-Smtp-Source: APXvYqzI9ZcBsR33Wj69OYxhz8Fl3uU52XOagYXuFn3y1+rHU7l+0to8zenOnZia6VzGeJ1Wmt9bLQ== X-Received: by 2002:a17:902:f204:: with SMTP id gn4mr2206522plb.3.1562300188420; Thu, 04 Jul 2019 21:16:28 -0700 (PDT) Received: from mylaptop.redhat.com ([2408:8207:7821:9e80:eaf2:5f81:4c66:c3d0]) by smtp.gmail.com with ESMTPSA id l68sm16328638pjb.8.2019.07.04.21.16.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jul 2019 21:16:27 -0700 (PDT) From: Pingfan Liu To: x86@kernel.org Cc: Pingfan Liu , Michal Hocko , Dave Hansen , Mike Rapoport , Tony Luck , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andrew Morton , Vlastimil Babka , Oscar Salvador , Pavel Tatashin , Mel Gorman , Benjamin Herrenschmidt , Michael Ellerman , Stephen Rothwell , Qian Cai , Barret Rhoden , Bjorn Helgaas , David Rientjes , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] x86/numa: carve node online semantics out of alloc_node_data() Date: Fri, 5 Jul 2019 12:15:42 +0800 Message-Id: <1562300143-11671-1-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.5 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 Node online means either memory online or cpu online. But there is requirement to instance a pglist_data, which has neither cpu nor memory online (refer to [2/2]). So carve out the online semantics, and call node_set_online() where either memory or cpu is online. Signed-off-by: Pingfan Liu Cc: Michal Hocko Cc: Dave Hansen Cc: Mike Rapoport Cc: Tony Luck Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Andrew Morton Cc: Michal Hocko Cc: Vlastimil Babka Cc: Oscar Salvador Cc: Pavel Tatashin Cc: Mel Gorman Cc: Benjamin Herrenschmidt Cc: Michael Ellerman Cc: Stephen Rothwell Cc: Qian Cai Cc: Barret Rhoden Cc: Bjorn Helgaas Cc: David Rientjes Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- arch/x86/mm/numa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index e6dad60..b48d507 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -213,8 +213,6 @@ static void __init alloc_node_data(int nid) node_data[nid] = nd; memset(NODE_DATA(nid), 0, sizeof(pg_data_t)); - - node_set_online(nid); } /** @@ -589,6 +587,7 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) continue; alloc_node_data(nid); + node_set_online(nid); } /* Dump memblock with node info and return. */ @@ -760,8 +759,10 @@ void __init init_cpu_to_node(void) if (node == NUMA_NO_NODE) continue; - if (!node_online(node)) + if (!node_online(node)) { init_memory_less_node(node); + node_set_online(nid); + } numa_set_node(cpu, node); }