From patchwork Sun Feb 24 12:34:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 10827873 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 BA0811390 for ; Sun, 24 Feb 2019 12:34:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8A9029EA4 for ; Sun, 24 Feb 2019 12:34:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B9252B7CD; Sun, 24 Feb 2019 12:34:38 +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 0A44729EA4 for ; Sun, 24 Feb 2019 12:34:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 171FD8E015F; Sun, 24 Feb 2019 07:34:37 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0F9B38E015B; Sun, 24 Feb 2019 07:34:37 -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 F036D8E015F; Sun, 24 Feb 2019 07:34:36 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id ACB6F8E015B for ; Sun, 24 Feb 2019 07:34:36 -0500 (EST) Received: by mail-pg1-f198.google.com with SMTP id f6so326410pgo.15 for ; Sun, 24 Feb 2019 04:34:36 -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=Z3yLpMlCMDsuGaB02cG1XH8xADN3ETXn1vX/kUyoKIQ=; b=CsOIH9yVpbBJoHWfoFbBukWglrI6d9Wflw8omg2vS7+hq5qKUPzpXpRitvfl62iENO wCN3Ky+DoQQsUl/C4f92mwezgCWFenbogFbgsZTdQ33Id3B3pAJLeO8HvLwXAJE+JKb0 sYQHb+6iACqrQFCFUcHNa/gp7a/9z1P5jlc6nH1hpcxHCGPsfhVLYikYjAPsNdq5zPty uPVskU6+iN6m18SCiewEW2MzSHLKxQo8XYXdrQ+iOzTDy0+KgD8sPR0hYjHrNUc6VOX7 8PrSozpWg+U7I5EeEbW9A9cHEKNwpNVeLxQUceUf3vLG653cqUoCGIotHCDmEeazMrBL 3x1A== X-Gm-Message-State: AHQUAuZ8zqcOmT0C0L+mPPWo8d3ebSYXatmmUgERJ5wqk+FJ573DUl7O dy5eYrdqMDB6SjCOyJtR1PB4nQaOhtw/mZGzS+stnumLQEmc9Gz+UayaivjHsH5+RUQMjDTp4sE f7Z7vvXGZdrfI/8ZtqIneCmRrTznYrweK1m693EFzagQ14+Ze8MptsXr/mY1AP37dHu3ANnAldO riOkN90V/Zg/+sG72etNpz1tYi0PmH7kme5XYqlMro9EOqnRENy0TL1x2NeHCeJpmtqL5d1FNGO ayn98TaciVMso7XTMeQfNn3NrllkrAen+ON3Po/8VIHh2L0Mx6QaBN5PXgaS9tDg2WlZqOCedfE bbWRj05sq9oIEf3Xz+4tVAI2dLn/qQw2jSdMeWdgFY2zYkVdawkwcHdh8N3lujSl8lQFHVwP0jD m X-Received: by 2002:a63:7c07:: with SMTP id x7mr12998538pgc.284.1551011676376; Sun, 24 Feb 2019 04:34:36 -0800 (PST) X-Received: by 2002:a63:7c07:: with SMTP id x7mr12998420pgc.284.1551011675076; Sun, 24 Feb 2019 04:34:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551011675; cv=none; d=google.com; s=arc-20160816; b=p9MQGfxJpDihkuo0hAuUMmJ76Wm17XcbsFTKUI5qlS4FPnlPK37Kk12vtjKkgisyOl vszgEghA1puoQxyCGrF2sjl3QyIpfJSSfxLpErA2IHfE8PZgaWfpll3J8pibVThKRU5F LdELnh+oFrC71OeOVkNPfLRQyXns32mymn7tvQGbw7tqtwcKm3zmATl9KjOqODI7SIXg krInXzYVGAj+hbadzjz0PmB2btlf7VBS9FNa5KAenSfIdYWxOYb3mpoWkOEK8qHFMuRe iSF/vJ5J6fIKDY/3MULpy1zn3j5RCgCcSvl/OW6seixq0ct/DZOQlj5dvrbPfdOQs8CB rQgQ== 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=Z3yLpMlCMDsuGaB02cG1XH8xADN3ETXn1vX/kUyoKIQ=; b=GpamsqmWZcG3npeOX4MibwUjxPbnc9uEgag2oVGRk2wiYIbOIeHv5ihWC6CuoP/7d8 AERS/De7wk5Dbpu3niPUnYKdCbzBR3PnUF8/W7LSGatNFjbS/fZzkwZjANlGDowGkgHi ubkKfXc5vidiEMd9mnT0LhscV6e310cP2l8Ejlzmy5jr25E+BSQD03ZvmZGG2KX2TYP3 B7opBd2qq0wRQVfbKQjsDbhpKDhmaxsSN7TS+h/RKrmnQJ/rCQ2Hx4aS9Ah20CBwtOwi gQeaYaVaFD5t+5EK2Xrbz+pVjIF9H8JvkcPw9XShcY2ih+j4YSxUSMeZFNI5m2s0iWwj gVaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZgJwtGqu; 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 142sor4590673pfb.41.2019.02.24.04.34.34 for (Google Transport Security); Sun, 24 Feb 2019 04:34:35 -0800 (PST) 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=ZgJwtGqu; 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:in-reply-to:references; bh=Z3yLpMlCMDsuGaB02cG1XH8xADN3ETXn1vX/kUyoKIQ=; b=ZgJwtGqu+tpzE0Sxv2rBnzGQOgVnCbdTJWs6MlhjOmVcjzel2NnOzxLme2jKbjJeWe xK0/5o0ecLLOWPHsXZKzSd6zgbi7Ayk+jVC1UbUyutgKRnaFKMBtok7NFkgjPNZ/voKE 6/XH+Rjq9TG++FECnruQColXNmEGsflDw1NKZgJO7HaQsR/mQK++9vNVs4r6xkvqACoE oB8bw1zJBJWrwL/fuz09qFJxdRjB7yZPwM4HlkNs2M3SXI+eTm5+mzL7Rp1hEkECGZj5 ens5fMQO1UEowLbb2bvLHeJoDvWDbG457M+NyhXmt+9+0nZvp6Z7WOOWsKQHrNWtJAWG tpaQ== X-Google-Smtp-Source: AHgI3IYYsWafgP2p4U1Cc1O2opO2btKPmB4WsQkz1bQsdyYsJYn8g6ToK1eA9OuugrJ1Yvpy3NyY5w== X-Received: by 2002:a62:ee03:: with SMTP id e3mr13962942pfi.241.1551011674749; Sun, 24 Feb 2019 04:34:34 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id v6sm9524634pgb.2.2019.02.24.04.34.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Feb 2019 04:34:34 -0800 (PST) From: Pingfan Liu To: x86@kernel.org, linux-mm@kvack.org Cc: Pingfan Liu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Vlastimil Babka , Mike Rapoport , Andrew Morton , Mel Gorman , Joonsoo Kim , Andy Lutomirski , Andi Kleen , Petr Tesarik , Michal Hocko , Stephen Rothwell , Jonathan Corbet , Nicholas Piggin , Daniel Vacek , linux-kernel@vger.kernel.org Subject: [PATCH 1/6] mm/numa: extract the code of building node fall back list Date: Sun, 24 Feb 2019 20:34:04 +0800 Message-Id: <1551011649-30103-2-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551011649-30103-1-git-send-email-kernelfans@gmail.com> References: <1551011649-30103-1-git-send-email-kernelfans@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 In coming patch, memblock allocator also utilizes node fall back list info. Hence extracting the related code for reusing. Signed-off-by: Pingfan Liu CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: "H. Peter Anvin" CC: Dave Hansen CC: Vlastimil Babka CC: Mike Rapoport CC: Andrew Morton CC: Mel Gorman CC: Joonsoo Kim CC: Andy Lutomirski CC: Andi Kleen CC: Petr Tesarik CC: Michal Hocko CC: Stephen Rothwell CC: Jonathan Corbet CC: Nicholas Piggin CC: Daniel Vacek CC: linux-kernel@vger.kernel.org --- mm/page_alloc.c | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 35fdde0..a6967a1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5380,6 +5380,32 @@ static void build_thisnode_zonelists(pg_data_t *pgdat) zonerefs->zone_idx = 0; } +int build_node_order(int *node_oder_array, int sz, + int local_node, nodemask_t *used_mask) +{ + int node, nr_nodes = 0; + int prev_node = local_node; + int load = nr_online_nodes; + + + while ((node = find_next_best_node(local_node, used_mask)) >= 0 + && nr_nodes < sz) { + /* + * We don't want to pressure a particular node. + * So adding penalty to the first node in same + * distance group to make it round-robin. + */ + if (node_distance(local_node, node) != + node_distance(local_node, prev_node)) + node_load[node] = load; + + node_oder_array[nr_nodes++] = node; + prev_node = node; + load--; + } + return nr_nodes; +} + /* * Build zonelists ordered by zone and nodes within zones. * This results in conserving DMA zone[s] until all Normal memory is @@ -5390,32 +5416,16 @@ static void build_thisnode_zonelists(pg_data_t *pgdat) static void build_zonelists(pg_data_t *pgdat) { static int node_order[MAX_NUMNODES]; - int node, load, nr_nodes = 0; + int local_node, nr_nodes = 0; nodemask_t used_mask; - int local_node, prev_node; /* NUMA-aware ordering of nodes */ local_node = pgdat->node_id; - load = nr_online_nodes; - prev_node = local_node; nodes_clear(used_mask); memset(node_order, 0, sizeof(node_order)); - while ((node = find_next_best_node(local_node, &used_mask)) >= 0) { - /* - * We don't want to pressure a particular node. - * So adding penalty to the first node in same - * distance group to make it round-robin. - */ - if (node_distance(local_node, node) != - node_distance(local_node, prev_node)) - node_load[node] = load; - - node_order[nr_nodes++] = node; - prev_node = node; - load--; - } - + nr_nodes = build_node_order(node_order, MAX_NUMNODES, + local_node, &used_mask); build_zonelists_in_node_order(pgdat, node_order, nr_nodes); build_thisnode_zonelists(pgdat); } From patchwork Sun Feb 24 12:34:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 10827875 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 BF2321390 for ; Sun, 24 Feb 2019 12:34:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACD8E29EA4 for ; Sun, 24 Feb 2019 12:34:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A05D62B7CD; Sun, 24 Feb 2019 12:34:46 +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 F0F5629EA4 for ; Sun, 24 Feb 2019 12:34:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 010EF8E0160; Sun, 24 Feb 2019 07:34:45 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EDB8F8E015B; Sun, 24 Feb 2019 07:34:44 -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 D7DBE8E0160; Sun, 24 Feb 2019 07:34:44 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id 91CEA8E015B for ; Sun, 24 Feb 2019 07:34:44 -0500 (EST) Received: by mail-pg1-f197.google.com with SMTP id 23so5011293pgr.11 for ; Sun, 24 Feb 2019 04:34:44 -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=Ugvldidm8y8s0n/p3Bwr6/2IroSyDjrqAPqWfyI4hQA=; b=ZEXh0cLmOZ10ztkUXNdHothFQMp23WP5j5OqGyH4sg+hmJrzdPKiEE1kMfkffvdtYb 63VgEc84S6YMB0vofL8DB42rL1EdpwFwVjV/Ygr2YYN7y4psrm0FfugwCdZPNx+9EVJC TtbSEmfp0ew2K/6x35k7sLTGovj9ReRl8cyxhQRzHCfD4tD+q5vOYJNf9j8LYulzbTzk jYdxo0QqVi1s7Kc4SXRBxYajQQUVzo1D0eJwGqM7orkCKcsEe5e6FNKpVELbM0JIAAfx CO6AOX2zC/HXugaZ/8MvO2EZs42OnFWom8AMdAkX+pv28MA8IEXufVdG9IquLjBIeP3q NUmg== X-Gm-Message-State: AHQUAuZiZPg4skNFUbYfzDy6FwsyXMiMpQUpMFv+Z0oh6AyQtbWHwJ50 iEfV31kOFrCdPXuBeESMeF7/GIx/7TiPWuqvuxtSWnR+bVEVLs0u7X0w9uwhQHPWjq0TREI+UyB Qgz9kabTWAXffMNerx72VLYbcCZ/ADFjIu6vXvNmtQj6R3p8szNgWRyaemtxMBYeFzb5CAe4xsu N16nR3mFVFIOf2nNF+lR+0xyO4UQ97Z2rgTBmB5/6xUO9puqC+0udW2mnQchfhuD1dAvLrRNYiE LAiCBQsnZcRSOth3Z8xrSixrrpQSvPWJBev1BpyH9MnupMCW94TEWDawGU24tmDMKzRdVrQsKyB vhZKdEKVdXHIc6ShGPQt2zT/l3cBbsCEpR8yf/6EfaB9mKAcDYK0Yh1WbvAXAUFnHWwkCK4tS3f O X-Received: by 2002:a63:535c:: with SMTP id t28mr12970319pgl.128.1551011684194; Sun, 24 Feb 2019 04:34:44 -0800 (PST) X-Received: by 2002:a63:535c:: with SMTP id t28mr12970188pgl.128.1551011682765; Sun, 24 Feb 2019 04:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551011682; cv=none; d=google.com; s=arc-20160816; b=u+z5eViYrxtncG8OB74y8SwNqCKlatq7+Ekj46BZfnhQSYzI67yRdodTCVfDxN4SZm JMiXriFe6aRYNyp7t03TjxIZu9B6bloNEfBkOSF5JW1o0H7BIc40hKRNC4dfiA6Tqdcb GpRhoEbomrF1TXtytdxrX/zIRxO+IV9tjLFRoXlnpApyxZk+NOY7Fxv1xAn02b2R9JdD QxkN1+iKHAFNYdobyFmgjlHfsg8DNOsUz+fMpVGERrxcM22z8ZGkpIQvdckT4TT8kq9F Ynp0lSP30NPGwdabUivuJz4oak8c9r4Fk962fjuICoa8uU1gbep3MZ8OqRcAoJ5bG1Aw Cd1g== 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=Ugvldidm8y8s0n/p3Bwr6/2IroSyDjrqAPqWfyI4hQA=; b=GQeJtB0xjGBzcxf/oKyqF+R0EicPkOz8aFhq+Z4WtuYdITukDP4MGdQLQfmeMlzgwi pI1u0NHaDcUpuKIdJ9MroDjpcLnSSLonRoWjF7tCKV7318O2dTQRRcZiogvfujPvJRTB sbGmnfUAo1n8gpqP+pSq2XOutHAFsFboPz1e26Xazuo4YJHcNE9xMoJ82RasqO6IfZKY zIYN3sVYzLeD/SHbTYkHUn4DMfxft0BDjv69Fl+k5DV1A/XMpZJHTDpK/70gIp7wMt49 DZSqvQQKpAjsh88rZn0YitzoDHJlpslXF4KYMIyazmmqw8xk0eV45WBzHrWMqKHRGaMf CcmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="cMZn/ghO"; 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 h29sor4317627pgh.11.2019.02.24.04.34.42 for (Google Transport Security); Sun, 24 Feb 2019 04:34:42 -0800 (PST) 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="cMZn/ghO"; 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:in-reply-to:references; bh=Ugvldidm8y8s0n/p3Bwr6/2IroSyDjrqAPqWfyI4hQA=; b=cMZn/ghOVis+vQJBy5AyjcvJO3oUfeQIhP/N8EAe5khMGJLUnJ+pjcDuzDLz+77iE7 aWkDKpgMy/nlXiTbdrmuB9fIm4Ulcc+WaLgKqzpLLuLjyy7adnT1otiz0O80y9Qp5gkr 64AuxOzb044cSeNVLuNT8+PnPENYfap1nbA4WIqkumt3WD/TKn9xSI0XPYa8QAZUUHb8 7gEo3nyyRcMjcMj9EMTsHQyRmZVdkXL8Mw2JPXtaixFJUDJ8SKW2IFfrRThZVIQ7JBX4 RX5icrMFScd68STF3eajyPao2v2fhVB66P+xRmZRrrg68vwv+2vf4WZ/r+H/k4VUVG3g UeOw== X-Google-Smtp-Source: AHgI3IaaMGmFqz42VyRjWubPjFaekxnIRYmn3Cp9WJ7o4X5kSGWGaI22WGXOUXgvJaO05xTxZx5sAw== X-Received: by 2002:a63:4346:: with SMTP id q67mr12530406pga.92.1551011682473; Sun, 24 Feb 2019 04:34:42 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id v6sm9524634pgb.2.2019.02.24.04.34.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Feb 2019 04:34:41 -0800 (PST) From: Pingfan Liu To: x86@kernel.org, linux-mm@kvack.org Cc: Pingfan Liu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Vlastimil Babka , Mike Rapoport , Andrew Morton , Mel Gorman , Joonsoo Kim , Andy Lutomirski , Andi Kleen , Petr Tesarik , Michal Hocko , Stephen Rothwell , Jonathan Corbet , Nicholas Piggin , Daniel Vacek , linux-kernel@vger.kernel.org Subject: [PATCH 2/6] mm/memblock: make full utilization of numa info Date: Sun, 24 Feb 2019 20:34:05 +0800 Message-Id: <1551011649-30103-3-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551011649-30103-1-git-send-email-kernelfans@gmail.com> References: <1551011649-30103-1-git-send-email-kernelfans@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 There are numa machines with memory-less node. When allocating memory for the memory-less node, memblock allocator falls back to 'Node 0' without fully utilizing the nearest node. This hurts the performance, especially for per cpu section. Suppressing this defect by building the full node fall back info for memblock allocator, like what we have done for page allocator. Signed-off-by: Pingfan Liu CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: "H. Peter Anvin" CC: Dave Hansen CC: Vlastimil Babka CC: Mike Rapoport CC: Andrew Morton CC: Mel Gorman CC: Joonsoo Kim CC: Andy Lutomirski CC: Andi Kleen CC: Petr Tesarik CC: Michal Hocko CC: Stephen Rothwell CC: Jonathan Corbet CC: Nicholas Piggin CC: Daniel Vacek CC: linux-kernel@vger.kernel.org --- include/linux/memblock.h | 3 +++ mm/memblock.c | 68 ++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 64c41cf..ee999c5 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -342,6 +342,9 @@ void *memblock_alloc_try_nid_nopanic(phys_addr_t size, phys_addr_t align, void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, phys_addr_t min_addr, phys_addr_t max_addr, int nid); +extern int build_node_order(int *node_oder_array, int sz, + int local_node, nodemask_t *used_mask); +void memblock_build_node_order(void); static inline void * __init memblock_alloc(phys_addr_t size, phys_addr_t align) { diff --git a/mm/memblock.c b/mm/memblock.c index 022d4cb..cf78850 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1338,6 +1338,47 @@ phys_addr_t __init memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t ali return memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE); } +static int **node_fallback __initdata; + +/* + * build_node_order() relies on cpumask_of_node(), hence arch should set up + * cpumask before calling this func. + */ +void __init memblock_build_node_order(void) +{ + int nid, i; + nodemask_t used_mask; + + node_fallback = memblock_alloc(MAX_NUMNODES * sizeof(int *), + sizeof(int *)); + for_each_online_node(nid) { + node_fallback[nid] = memblock_alloc( + num_online_nodes() * sizeof(int), sizeof(int)); + for (i = 0; i < num_online_nodes(); i++) + node_fallback[nid][i] = NUMA_NO_NODE; + } + + for_each_online_node(nid) { + nodes_clear(used_mask); + node_set(nid, used_mask); + build_node_order(node_fallback[nid], num_online_nodes(), + nid, &used_mask); + } +} + +static void __init memblock_free_node_order(void) +{ + int nid; + + if (!node_fallback) + return; + for_each_online_node(nid) + memblock_free(__pa(node_fallback[nid]), + num_online_nodes() * sizeof(int)); + memblock_free(__pa(node_fallback), MAX_NUMNODES * sizeof(int *)); + node_fallback = NULL; +} + /** * memblock_alloc_internal - allocate boot memory block * @size: size of memory block to be allocated in bytes @@ -1370,6 +1411,7 @@ static void * __init memblock_alloc_internal( { phys_addr_t alloc; void *ptr; + int node; enum memblock_flags flags = choose_memblock_flags(); if (WARN_ONCE(nid == MAX_NUMNODES, "Usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE instead\n")) @@ -1397,11 +1439,26 @@ static void * __init memblock_alloc_internal( goto done; if (nid != NUMA_NO_NODE) { - alloc = memblock_find_in_range_node(size, align, min_addr, - max_addr, NUMA_NO_NODE, - flags); - if (alloc && !memblock_reserve(alloc, size)) - goto done; + if (!node_fallback) { + alloc = memblock_find_in_range_node(size, align, + min_addr, max_addr, + NUMA_NO_NODE, flags); + if (alloc && !memblock_reserve(alloc, size)) + goto done; + } else { + int i; + for (i = 0; i < num_online_nodes(); i++) { + node = node_fallback[nid][i]; + /* fallback list has all memory nodes */ + if (node == NUMA_NO_NODE) + break; + alloc = memblock_find_in_range_node(size, + align, min_addr, max_addr, + node, flags); + if (alloc && !memblock_reserve(alloc, size)) + goto done; + } + } } if (min_addr) { @@ -1969,6 +2026,7 @@ unsigned long __init memblock_free_all(void) reset_all_zones_managed_pages(); + memblock_free_node_order(); pages = free_low_memory_core_early(); totalram_pages_add(pages); From patchwork Sun Feb 24 12:34:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 10827877 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 83CED922 for ; Sun, 24 Feb 2019 12:34:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71C4E29EA4 for ; Sun, 24 Feb 2019 12:34:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65DCD2B7CD; Sun, 24 Feb 2019 12:34:54 +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 E636529EA4 for ; Sun, 24 Feb 2019 12:34:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E40B78E0161; Sun, 24 Feb 2019 07:34:52 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DCA268E015B; Sun, 24 Feb 2019 07:34:52 -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 C6C0A8E0161; Sun, 24 Feb 2019 07:34:52 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id 810208E015B for ; Sun, 24 Feb 2019 07:34:52 -0500 (EST) Received: by mail-pf1-f198.google.com with SMTP id h15so5522817pfj.22 for ; Sun, 24 Feb 2019 04:34:52 -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=6zZP7jJIxHvkxThoQW962w7WsAbjwnHfV/pBRova8jw=; b=hQ2oipgAp+XRMyzBUa0yPAe3X8ZVr/4rmEOHh2zQ/S2IzuTBkeQsOEDu6eMrEmZ3pr VVBVEg6CoKF/iOaO9lUYozKwqEc+0o2F6z3fuI9PK8fTFfuMaVXS7TecpySMxWe2vt3i phd1LZsnii7Q3m8liYRp4USeXCjgmxvai1MeCppsnRVcfwWrALFoBNIeq4U5nd6SQC41 nDrHlqAjFoOJ2WXqlijW8qGksqVgLa5W1H90OxjoBQPq5y4XKiD/VNEkUqp67ICmoxvW 5Wsqjjr5gdhXH7Es5NWy2k9VBmFdd1Gpj0zKv5/kKCwOJ7rqzd9ngrpWcK2NEurhzhIG 1kfA== X-Gm-Message-State: AHQUAuYzgYdTYMWL2syvKUHbmyU+V4/oH4TDt6dCnzbYXCIt/nIspvcx WahTCUWCFUW3GqHkdicuQDiDC6UP8QzMn4Lnvw0ESsxScbFwYRyKeftJy5J7aXPh0I8B/rIfnFB qJAZK6Qh5rpjvOKisGhyrQQccBOKx4lkySF1NLDQrZd5llw+5DxVj891DQwqBI2aD9Ledw+9J5B HiL1cB7H7drZsZiO0hf322sbhPCgbXYs40oH6d0vOwBUJK0gOP4Cj3X6p/wTIgXR/mXyLqdh/tj wEhRg9p4yZklS31vjAlIMkwJmThHteI+AKN3zgCJd7Tlg0sNigUy2XlGtZszxPah/mDLZ8i0fQ7 b/PudvPVWsLmC9necFLUj5MTzsZX1DazFo7De0BlzIAnlTjzm+Nl5gMfHFHUm1tARASd0drJV2m w X-Received: by 2002:a63:81c1:: with SMTP id t184mr12447541pgd.228.1551011692200; Sun, 24 Feb 2019 04:34:52 -0800 (PST) X-Received: by 2002:a63:81c1:: with SMTP id t184mr12447435pgd.228.1551011691024; Sun, 24 Feb 2019 04:34:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551011691; cv=none; d=google.com; s=arc-20160816; b=TLefgWNPSCntLSCwOrjsY16Kzega75IZiuf04c8Fl+bpkA27LPK7rOCX4fLrdm5oFg 231jYOLsH23V6CLTZ6uhK3VZUejz4l7ns44wCjFRCNl22XiiDw05Wkjj20ASOInlqn4P bhAuIVE6x3UBhgVAoXt21I/8ngNcypgHA6nDvH2aoufl8u7sGCAwTV0CZNrLF6qzlgvR I3wXxBTkUFdpm2Sud1+FLH+jP5mVQAM26aBH5ZCS6lAcQU2TU8w93Mj8ZV4ZRkVAF9He iIWVCh5WC2KlH8UbNYWnI9be4l88/IXPpXcyFW2nnVpYgrtiiQ57RbDL2+CV0a8SAXYt Q9Qg== 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=6zZP7jJIxHvkxThoQW962w7WsAbjwnHfV/pBRova8jw=; b=SDPda2KXL+Tk91JRBqQkigVxmF/lkJBvgFN8UHOuR+JpGKfz3IKbWQdWMrq1+F1O6Q 5pg4xXwLhX3j0HuGWE/sugisBMpTvDGmDAS2E5GXLE8SErOO0COT/zB+QivMQyXlagQC uvgrlObsutOdjwqG4oujm0QUjlQkGxuD/yGNmgUadjJ+1ioH8ucqTXECnfri5r961ynt 5aUgtqIAq4gewg/H/e48+fhSoT6M+fcwf3Au0z/DH0U096vxzGVCErXMAdqOebiT9DyV 3Es0Q1TY8wCXrrcDVDKKnsrBl8OA8ngpejNRGwuKMuQLX4DIq4TtAePQWcgRcnrXpLTm lWHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=d2Y9Cztq; 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 p85sor10741149pfi.13.2019.02.24.04.34.50 for (Google Transport Security); Sun, 24 Feb 2019 04:34:51 -0800 (PST) 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=d2Y9Cztq; 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:in-reply-to:references; bh=6zZP7jJIxHvkxThoQW962w7WsAbjwnHfV/pBRova8jw=; b=d2Y9CztqZjtQy4UJJ2JLeCM2Nx1Rp0TIqG0sLvJJYN5BBmdxAbZAT0PO0MGPvOBgPJ cFZu9aubJse8xqxOe5l1Xl2/EALdbw0IPYh+iY2GImLvNo17BST6hP7RynsjNDzhyddH qhfJhKoAKpiJWnJVa0Oi8kx8W14Zsu9Ye++4TnFw3j7YP0wdp7mEHEnsoSYRSFEJBAq8 R17q+wTIJus3kgWzBtoUF3/LA8pksbAMFTZIRJqyk3BMnu+WvqepNntYMwrzyM8gA9Lz nVlGBNhhPVlsG25Vr3nRF3eng/nAEOfwSucaWWiO2sKlf5YFM0rt/ikuWtVDmVvfA7tO Q3cw== X-Google-Smtp-Source: AHgI3Ia8g+BD78ii73yBVfLkrh2EIZUmMEN2tSL9/vXwv/TCm70uYK4mRBtcqN5KpkpAfPfIcCdM4w== X-Received: by 2002:a62:6e07:: with SMTP id j7mr13978322pfc.135.1551011690757; Sun, 24 Feb 2019 04:34:50 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id v6sm9524634pgb.2.2019.02.24.04.34.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Feb 2019 04:34:50 -0800 (PST) From: Pingfan Liu To: x86@kernel.org, linux-mm@kvack.org Cc: Pingfan Liu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Vlastimil Babka , Mike Rapoport , Andrew Morton , Mel Gorman , Joonsoo Kim , Andy Lutomirski , Andi Kleen , Petr Tesarik , Michal Hocko , Stephen Rothwell , Jonathan Corbet , Nicholas Piggin , Daniel Vacek , linux-kernel@vger.kernel.org Subject: [PATCH 3/6] x86/numa: define numa_init_array() conditional on CONFIG_NUMA Date: Sun, 24 Feb 2019 20:34:06 +0800 Message-Id: <1551011649-30103-4-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551011649-30103-1-git-send-email-kernelfans@gmail.com> References: <1551011649-30103-1-git-send-email-kernelfans@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 For non-NUMA, it turns out that numa_init_array() has no operations. Make separated definition for non-NUMA and NUMA, so later they can be combined into their counterpart init_cpu_to_node(). Signed-off-by: Pingfan Liu CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: "H. Peter Anvin" CC: Dave Hansen CC: Vlastimil Babka CC: Mike Rapoport CC: Andrew Morton CC: Mel Gorman CC: Joonsoo Kim CC: Andy Lutomirski CC: Andi Kleen CC: Petr Tesarik CC: Michal Hocko CC: Stephen Rothwell CC: Jonathan Corbet CC: Nicholas Piggin CC: Daniel Vacek CC: linux-kernel@vger.kernel.org --- arch/x86/mm/numa.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 1308f54..bfe6732 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -599,6 +599,7 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) return 0; } +#ifdef CONFIG_NUMA /* * There are unfortunately some poorly designed mainboards around that * only connect memory to a single CPU. This breaks the 1:1 cpu->node @@ -618,6 +619,9 @@ static void __init numa_init_array(void) rr = next_node_in(rr, node_online_map); } } +#else +static void __init numa_init_array(void) {} +#endif static int __init numa_init(int (*init_func)(void)) { From patchwork Sun Feb 24 12:34:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 10827879 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 3E1BD922 for ; Sun, 24 Feb 2019 12:35:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A35029EA4 for ; Sun, 24 Feb 2019 12:35:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 192292B7CD; Sun, 24 Feb 2019 12:35:03 +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 7357B29EA4 for ; Sun, 24 Feb 2019 12:35:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 454838E0162; Sun, 24 Feb 2019 07:35:01 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 404A88E015B; Sun, 24 Feb 2019 07:35:01 -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 2A72A8E0162; Sun, 24 Feb 2019 07:35:01 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id D53688E015B for ; Sun, 24 Feb 2019 07:35:00 -0500 (EST) Received: by mail-pg1-f199.google.com with SMTP id f10so5021237pgp.13 for ; Sun, 24 Feb 2019 04:35:00 -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=VUSACWx8owSCA/d69ivl0fhPuKN1EhNSteFOcIuEGZ0=; b=huF1uVMaH/FHH4MNc56nPvS/Vjk6iiVW170tZZpFzHO+J9z/ebIVMsx+FHY7A6uC31 UTP3c/jBcM9n5016P1GK7RXswmZsxx431oB5BmmM3vX3Q6dwbFiTc4VA8NGcMqkryMQS NM+Nk13dv5eShXUCUq8QpG7jnyf7cR0Rmnaz3YT+vGzqiXtVPMRbaCRrsKxxGsquc+7l 7Ld+lwhoqlmxHTB4516SXlA09ehCedQWkOzWRDKaXmJ1lzCYktBnQ8lcteQTkZO2y1Z9 uLFZLmfEPmC5B4Wu67LnFURQvCQUCnQ9fuEd1NdmYE20Utq5h6OT5IWOWGksdvR7eyt0 3bqw== X-Gm-Message-State: AHQUAuZkmeJUFevqswA2i9AMkoAG5eyXRjGRxPK/SQcyNHWmKTp29JFy /qn10XlC8aGP8mTWEKEt701RbNV0zWtMniMkWCGjz//YpxolosDH4e2KTY0GTJ75JsoYQnh7+WW qm33Dq79py0dNCbgT7sMoQkurTKQxI31OcngEhrWZIERHhWE7gDOCO0+cdVf9l4Cfx//xsnDYkw 846oVFfLJ9tzBO5gQ69qogMUq4JdsG+Ja0VEjSo0woBcJuTflpuO5cKJDzx37glZe9Ukx6TTOZh hW/GkzsS/+CuI8A9cCltzF6hwznQuREIvM4vc+aUJLp+zCW7is6dwI6vT8Kw+ECOpn0RSFmGxLY aZPwmtEKLzxLBVIaLsau4Sg7gFjGCNmi0F9isNQS5U9jmepP3MUBQs0vURpQr8Xr3fPZsPDnV+m D X-Received: by 2002:a62:e204:: with SMTP id a4mr12697307pfi.225.1551011700467; Sun, 24 Feb 2019 04:35:00 -0800 (PST) X-Received: by 2002:a62:e204:: with SMTP id a4mr12697186pfi.225.1551011699258; Sun, 24 Feb 2019 04:34:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551011699; cv=none; d=google.com; s=arc-20160816; b=G8wuJFLzZjiBusv75ZsMU2T/G18KjNLEjQQmdvjJsPwR2gANiJCO2UWVYf54gyXJ0S nkKSfc4D/Ux0EWAM5H2tX0ryFFk0vBPrUxX/0BxsKAwrdANdHNaMylAISQlhxPWKezKe tk/rpCkKDF9ow8iJ0XcqRMDJuS+t6nFm+tDzHRpkhm+hb5T7+INFbKtKevt2/wCZDQaK CMqvp/Bx2yEqe227A8DE5eYbici5Pux4N0F7+uir57gjVnMv1yArlO4G18gjJqzoAKex eyKGtcvORBUOFlW5oAf0w1X94DsE7QP94+B27+72H8HQ7H9AJmZzAwtyq3JNRN/D1L2A N8Fw== 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=VUSACWx8owSCA/d69ivl0fhPuKN1EhNSteFOcIuEGZ0=; b=PKveg7zSZ2mn3zFK0qz7iMQ+qs2qrKYrokyu6ZFFUPABCQdfJgqDDFCIqCcgG1nY8W NV3Ofk1zriVqULU+ogrzP+YgGPD7GXkFlXTdQM2JnGuvRhQJvYEWI/akWtN+BeK7o2+m PVQxsA1IvZV34dc1mEH9IEHuRgJyEtye5BwrQlHLCIpp5nJN+uzvvIiKhZ0m8dvOaX9F o9bXxEpaJGlZpfXeaGjHl9NSwsyGmuuOYPRSAZR5DuduDsFPLGFsG1+CDppvbUB6WW/5 k23KI+8VZ2ZWZjcYz40GlqWDin+Fe3AR2jWx8Gg1PwI3Sqp0scuJ2vCRPs8n4pPakb4J 7GnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lsZNpX90; 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 s76sor10687754pfa.68.2019.02.24.04.34.59 for (Google Transport Security); Sun, 24 Feb 2019 04:34:59 -0800 (PST) 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=lsZNpX90; 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:in-reply-to:references; bh=VUSACWx8owSCA/d69ivl0fhPuKN1EhNSteFOcIuEGZ0=; b=lsZNpX90ShPlWQ2zhfCCGLs4i3irzO/qGpdGtyiAVLlwhyAM9bJBwH1VpoF5hjkhUd 8EUw47B2VpHPlhkSiDW/2Aqy47CseX4XJEnfPB8suhAPn4E9PESpAclo8hmmoUf1/T1g PrwAKcR6kJXWz4z7/qi+m31N9ImyTGhf5MdYqOZGPpeRwD/M0cvl+lZm7cLWMOZUwhdw 5miumxFV+4Y0Zwjui1NQfNcIczbjE0QoMSvg8smGI+VZ6rCei0hywyQi4dC+iLKOn7da vVtpQ1jmIK8mo6jkDkO0Gf9ToiAbrWv9SUSRbzXqbxZuWck6rc+HUwYfsGRG2RnYWdQe +rYQ== X-Google-Smtp-Source: AHgI3IZ+KhDfYa4kZE1/ENHjM5rMoFfQUz/8SRp5zyphLnw8+HWtaHY6Dz/ZQLwOtrZah70pozY1yQ== X-Received: by 2002:a62:b508:: with SMTP id y8mr13857223pfe.140.1551011699044; Sun, 24 Feb 2019 04:34:59 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id v6sm9524634pgb.2.2019.02.24.04.34.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Feb 2019 04:34:58 -0800 (PST) From: Pingfan Liu To: x86@kernel.org, linux-mm@kvack.org Cc: Pingfan Liu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Vlastimil Babka , Mike Rapoport , Andrew Morton , Mel Gorman , Joonsoo Kim , Andy Lutomirski , Andi Kleen , Petr Tesarik , Michal Hocko , Stephen Rothwell , Jonathan Corbet , Nicholas Piggin , Daniel Vacek , linux-kernel@vger.kernel.org Subject: [PATCH 4/6] x86/numa: concentrate the code of setting cpu to node map Date: Sun, 24 Feb 2019 20:34:07 +0800 Message-Id: <1551011649-30103-5-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551011649-30103-1-git-send-email-kernelfans@gmail.com> References: <1551011649-30103-1-git-send-email-kernelfans@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 Both numa_init_array() and init_cpu_to_node() aim at setting up the cpu to node map, so combining them. And the coming patch will set up node to cpumask map in the combined function. Signed-off-by: Pingfan Liu CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: "H. Peter Anvin" CC: Dave Hansen CC: Vlastimil Babka CC: Mike Rapoport CC: Andrew Morton CC: Mel Gorman CC: Joonsoo Kim CC: Andy Lutomirski CC: Andi Kleen CC: Petr Tesarik CC: Michal Hocko CC: Stephen Rothwell CC: Jonathan Corbet CC: Nicholas Piggin CC: Daniel Vacek CC: linux-kernel@vger.kernel.org --- arch/x86/mm/numa.c | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index bfe6732..c8dd7af 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -599,30 +599,6 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) return 0; } -#ifdef CONFIG_NUMA -/* - * There are unfortunately some poorly designed mainboards around that - * only connect memory to a single CPU. This breaks the 1:1 cpu->node - * mapping. To avoid this fill in the mapping for all possible CPUs, - * as the number of CPUs is not known yet. We round robin the existing - * nodes. - */ -static void __init numa_init_array(void) -{ - int rr, i; - - rr = first_node(node_online_map); - for (i = 0; i < nr_cpu_ids; i++) { - if (early_cpu_to_node(i) != NUMA_NO_NODE) - continue; - numa_set_node(i, rr); - rr = next_node_in(rr, node_online_map); - } -} -#else -static void __init numa_init_array(void) {} -#endif - static int __init numa_init(int (*init_func)(void)) { int i; @@ -675,7 +651,6 @@ static int __init numa_init(int (*init_func)(void)) if (!node_online(nid)) numa_clear_node(i); } - numa_init_array(); return 0; } @@ -758,14 +733,26 @@ void __init init_cpu_to_node(void) { int cpu; u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid); + int rr; BUG_ON(cpu_to_apicid == NULL); + rr = first_node(node_online_map); for_each_possible_cpu(cpu) { int node = numa_cpu_node(cpu); - if (node == NUMA_NO_NODE) + /* + * There are unfortunately some poorly designed mainboards + * around that only connect memory to a single CPU. This + * breaks the 1:1 cpu->node mapping. To avoid this fill in + * the mapping for all possible CPUs, as the number of CPUs + * is not known yet. We round robin the existing nodes. + */ + if (node == NUMA_NO_NODE) { + numa_set_node(cpu, rr); + rr = next_node_in(rr, node_online_map); continue; + } if (!node_online(node)) init_memory_less_node(node); From patchwork Sun Feb 24 12:34:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 10827881 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 317981390 for ; Sun, 24 Feb 2019 12:35:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E0C72B655 for ; Sun, 24 Feb 2019 12:35:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FE782B7DB; Sun, 24 Feb 2019 12:35:11 +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 6B0A22B655 for ; Sun, 24 Feb 2019 12:35:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 149B08E0163; Sun, 24 Feb 2019 07:35:09 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0D2868E015B; Sun, 24 Feb 2019 07:35:09 -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 EDDD78E0163; Sun, 24 Feb 2019 07:35:08 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id AA6788E015B for ; Sun, 24 Feb 2019 07:35:08 -0500 (EST) Received: by mail-pg1-f199.google.com with SMTP id y8so5038545pgk.2 for ; Sun, 24 Feb 2019 04:35:08 -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=0NMCKN566TqKrSROT1OL4y1pVAJFuioGBAgJ45OiBK4=; b=XarrJZHyy/y1+dSYeddp7SoSf/D/Wc6lRqYL234m9qr3isR+ri7qx7Bn9H7Tz5X2dU Xplps9YlGWPS+Q8CeWqMThwSOju/Yki83bNbDJhw+D2NnbCi4ZUePCH5vtwdORienaN7 FPP64aigF7bNgCEDqfqdwyNZlbgZRw8fY32Bk/TnujarhBTsn6EJn2EFWKcT/zYsldKv 1cgULRQb3Fy9HGzrOGQDeDi31S8IOLlXjMlQ+wtilX0oXs4u6WXWVDPiA3eoPdBMeYt9 dhHWHjw8vSaU+5B/5SyqivmQtJ7Ow5RTW5WB6Hlp5Rcd9XtLh0u3ilRq1M3X8qfDgQSX L1vA== X-Gm-Message-State: AHQUAuZWJh+UjbauvVTg7xS1NEF70tupCUgXzBsy3rEJTkK71Q3t7bbj B1ioyyMadrA2iY9tmP6QU4v3ZzvKKnOF0+LIKxGMBw5+6x1goSIYXOREFy99rXO7bA/3DXh1zI3 cwbRlH5/RF/JEjbYA9xJtgP+jisVu59gUka1TEFM9B9luuc+drxiwaegWBPcvQ5od6UfnxRyNhv AcT9PHX5khre23f7bYTITpMFrRkrZ03HwICRpUUDiIqQ4fgMWxxK6H3IM8sdO6Qp7q/smJ1f/yl 5IERjwXFVX1x9u9qimhKgl3uWxKmrG0jvwKX7dq0RedR/2zifNS7gzs+ScuzOCz0A93lp+FwKRW 9Q7m7BvMqbrymk9AdQPP6vsn0NtC/zZPUO2iitkQLUlZsrGGjvjT9Y1NxxiMuOHFOmS8pncWRC7 n X-Received: by 2002:a63:dc54:: with SMTP id f20mr12941757pgj.410.1551011708362; Sun, 24 Feb 2019 04:35:08 -0800 (PST) X-Received: by 2002:a63:dc54:: with SMTP id f20mr12941628pgj.410.1551011707060; Sun, 24 Feb 2019 04:35:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551011707; cv=none; d=google.com; s=arc-20160816; b=cO3erMlHc3MXkKAA7HuA4sVF05Z6B3iRPx6X6R0EGilFYon1PDaO7zojq5w6UIV+V0 v8FmyZjprq5ffaMFTH9VJ8qOJwy5kNQZbLwvoKzBqzyCjTNlPzRe5NwmgS8rM7Cyczw9 ZDMwhqrpSmCsjqYZyicW7HzqH2PANWzY6b+LNAK5++3Y+moMhZtmTbGwYdRpguFgq108 fTe2gBAgUmGwd0zPGb3VJMECXsrIIJGABfMFjWxSj+ZbuJbodWJ5kgDhOlLTmQg9nyW4 A9+IXoNLOatgDPXD/+DS5UGEm9SfWsPEcfoqLBSLrZ+AWpAdgTUcG1E/xK7WB70xaWdf lF3g== 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=0NMCKN566TqKrSROT1OL4y1pVAJFuioGBAgJ45OiBK4=; b=Sil0US3Z6J8WndL/F7m+wsJy35Eqdq+Vgc5JEFOOtps2ULZLstYyFP27LHHQAIPYdR hHF5Bq36Zv82ld2xpefWFJyiqk5hhDfFZoJm8eXYIQbqRbFwTlsHS5QMSlMmEb7s1vjo BtRG1EWV5ozIuE4tXozz2uaMx/8AFK5UsEsRXFEUMyrYNthMq3o4LAOJdSeuiVrYhtVe cPWdHohf4JbXIkWxrkF7Bh6z4F3kMHrRwvcs/nL1On5gnfkzwjfrfKI8tmm/+2Y82cE/ o3+vnWfHdstvOL6fuW6K+6wIo6tDHxRXwk5NQVAWPFBa0q0d3OC7QzAH4syyP3MwvJ9c ZLVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iY5qksCI; 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 r14sor9815696pgf.79.2019.02.24.04.35.06 for (Google Transport Security); Sun, 24 Feb 2019 04:35:07 -0800 (PST) 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=iY5qksCI; 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:in-reply-to:references; bh=0NMCKN566TqKrSROT1OL4y1pVAJFuioGBAgJ45OiBK4=; b=iY5qksCIMpNU389QUSs7IU3yhYB8G0qeGuofPuj7VOiuoUKF3lEIfU0EIj4vIyZGxy lfGuvV+dKLpk9vmJOA8iGOZeVGx1R5OoJTYMgUmJp3746nRHEl0S2MLvX5k033Nv//84 mDo14vacdwcpGP4nPjXiBuFbH4AHdrcqN6IsJBRmpNv+fK1FORzwuFvX/wZKblimKkQP H9XH3K4Eom4q4IXXZbXjw3E4kEAZerpxutrYN0lNUcpo3BsJCUHJTK9TcTLXrimeAne8 2Oy7y5IfhCi+Y+NMgXPpNQ304JNgsNYrJ6xo/gzm0wA6P/YV5Mayp/k+DBLWEA96+TmJ 7LjQ== X-Google-Smtp-Source: AHgI3IYKZHrDENP+56CRPPar4fsatj4I/ajY/II4jFQQaKk4J3r7faH8maH7gEv4Z3POa7YL/eMOUg== X-Received: by 2002:a63:d814:: with SMTP id b20mr13029128pgh.312.1551011706824; Sun, 24 Feb 2019 04:35:06 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id v6sm9524634pgb.2.2019.02.24.04.34.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Feb 2019 04:35:06 -0800 (PST) From: Pingfan Liu To: x86@kernel.org, linux-mm@kvack.org Cc: Pingfan Liu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Vlastimil Babka , Mike Rapoport , Andrew Morton , Mel Gorman , Joonsoo Kim , Andy Lutomirski , Andi Kleen , Petr Tesarik , Michal Hocko , Stephen Rothwell , Jonathan Corbet , Nicholas Piggin , Daniel Vacek , linux-kernel@vger.kernel.org Subject: [PATCH 5/6] x86/numa: push forward the setup of node to cpumask map Date: Sun, 24 Feb 2019 20:34:08 +0800 Message-Id: <1551011649-30103-6-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551011649-30103-1-git-send-email-kernelfans@gmail.com> References: <1551011649-30103-1-git-send-email-kernelfans@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 At present the node to cpumask map is set up until the secondary cpu boot up. But it is too late for the purpose of building node fall back list at early boot stage. Considering that init_cpu_to_node() already owns cpu to node map, it is a good place to set up node to cpumask map too. So do it by calling numa_add_cpu(cpu) in init_cpu_to_node(). Signed-off-by: Pingfan Liu CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: "H. Peter Anvin" CC: Dave Hansen CC: Vlastimil Babka CC: Mike Rapoport CC: Andrew Morton CC: Mel Gorman CC: Joonsoo Kim CC: Andy Lutomirski CC: Andi Kleen CC: Petr Tesarik CC: Michal Hocko CC: Stephen Rothwell CC: Jonathan Corbet CC: Nicholas Piggin CC: Daniel Vacek CC: linux-kernel@vger.kernel.org --- arch/x86/include/asm/topology.h | 4 ---- arch/x86/kernel/setup_percpu.c | 3 --- arch/x86/mm/numa.c | 5 ++++- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 453cf38..fad77c7 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -73,8 +73,6 @@ static inline const struct cpumask *cpumask_of_node(int node) } #endif -extern void setup_node_to_cpumask_map(void); - #define pcibus_to_node(bus) __pcibus_to_node(bus) extern int __node_distance(int, int); @@ -96,8 +94,6 @@ static inline int early_cpu_to_node(int cpu) return 0; } -static inline void setup_node_to_cpumask_map(void) { } - #endif #include diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index e8796fc..206fa43 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c @@ -283,9 +283,6 @@ void __init setup_per_cpu_areas(void) early_per_cpu_ptr(x86_cpu_to_node_map) = NULL; #endif - /* Setup node to cpumask map */ - setup_node_to_cpumask_map(); - /* Setup cpu initialized, callin, callout masks */ setup_cpu_local_masks(); diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index c8dd7af..8d73e2273 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -110,7 +110,7 @@ void numa_clear_node(int cpu) * Note: cpumask_of_node() is not valid until after this is done. * (Use CONFIG_DEBUG_PER_CPU_MAPS to check this.) */ -void __init setup_node_to_cpumask_map(void) +static void __init setup_node_to_cpumask_map(void) { unsigned int node; @@ -738,6 +738,7 @@ void __init init_cpu_to_node(void) BUG_ON(cpu_to_apicid == NULL); rr = first_node(node_online_map); + setup_node_to_cpumask_map(); for_each_possible_cpu(cpu) { int node = numa_cpu_node(cpu); @@ -750,6 +751,7 @@ void __init init_cpu_to_node(void) */ if (node == NUMA_NO_NODE) { numa_set_node(cpu, rr); + numa_add_cpu(cpu); rr = next_node_in(rr, node_online_map); continue; } @@ -758,6 +760,7 @@ void __init init_cpu_to_node(void) init_memory_less_node(node); numa_set_node(cpu, node); + numa_add_cpu(cpu); } } From patchwork Sun Feb 24 12:34:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 10827883 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 E7DCD922 for ; Sun, 24 Feb 2019 12:35:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D639A2B655 for ; Sun, 24 Feb 2019 12:35:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA0712B7DA; Sun, 24 Feb 2019 12:35:18 +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 4E78D2B655 for ; Sun, 24 Feb 2019 12:35:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 013028E0164; Sun, 24 Feb 2019 07:35:17 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F03138E015B; Sun, 24 Feb 2019 07:35:16 -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 D7D8B8E0164; Sun, 24 Feb 2019 07:35:16 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 91C108E015B for ; Sun, 24 Feb 2019 07:35:16 -0500 (EST) Received: by mail-pg1-f198.google.com with SMTP id y1so5047501pgo.0 for ; Sun, 24 Feb 2019 04:35:16 -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=eww4YGVNqaj9wRyOutY/EPgdrl5kM4y1BOCar4JSDOY=; b=HuX+3YsVseV7IVwiUlzO6ZccRqn630ICH5lm1WHgwb3bvAn6J/1HpX+rz4smgqTBrH gIpIjvo4elecrobzgTp0ulwi81OQAWt94r5bPJ0e6oknMf4iOib/aY/7TUAV23IBUl0z GsVtcu0XFCZcDPxzyetsFZ5y0CQyeX1I+M/Ku+gseMlk1WYTqQWFQSV9DYsy12cpUbtm DbEcrto7c9EV4LSgjrSm+sIGQmmQzySWC6165rj2DOCPAPNru6A6Ad5VM+9syAXEaRRf hbsntEdFJptpitS0Uxun6N3SpKTToH5yOMG1u/Frlxb3JcjZUWu0I7pFFL+mYKCcElAV KQRQ== X-Gm-Message-State: AHQUAuala+VwX4aI/mkni2NmE3AQ1TJQSjdjLZfKCZdybE7MgWJr8mYZ lGySzuJRUe7FnoDtGr6szI6UhfzxvdKXpBbZyIAgwN43B/iBGA7osiDnLPAnW1zkeSUQMKii/gA IhOph1GMFsIc9t7popr02qfjyeFx7btRfX/C2LJG/RVvczQBWX3VrVMTh1a4u08LVRZbQXPCcsU wY0pT/xDOGJgm5qd+l5C7DS9EZ1hjSTIfk52Wro7IDoQyv8UoR4XstUGeulm/94xXE8qIvRSMsb HVkUJrwEEn8rMy5YEwUCQEwy1f0HRx/sVc8UTg1g9hHMaOLP/mYqHW2SiiNpVnLGKOdZC4TdX1j cHWu56SIx586RKeA1Nw6uC99JHIVvlEbRiJjIRT4T4V2MHx95MoDhnM56V76ekmtxzJ64hOuO4O c X-Received: by 2002:a62:7042:: with SMTP id l63mr13555122pfc.1.1551011716267; Sun, 24 Feb 2019 04:35:16 -0800 (PST) X-Received: by 2002:a62:7042:: with SMTP id l63mr13555028pfc.1.1551011715244; Sun, 24 Feb 2019 04:35:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551011715; cv=none; d=google.com; s=arc-20160816; b=nqal2r0QEJ+fnM2rcmLkh0HHUGOxuUJF+KijHEVtB2ooOn0l3nxq/NtuPHAkjowOqf zXBNqeZVTFZyFEZcIbhXA9Asjc5KUuOwRW/lfA2OJn8nSLHv5Q5xZ4lsoUJCItMsz8M+ PFyQTbU+TihkfrtqRhewqOO8cQX8K+admBz7P3YtR18U+dKEluWPA3erSOP4ltszG05A Nt3lzZeLvXjCo/nbV0ztNAWe044x2vHRP2iHskxHAqVCZkTxids153UMUY8UAIUG1XSu JiHvzcRiEaqBVa9ZO4uZ7uluAiOV1JnFy2KBlYQhgS4Y7onzEqNSvTqL6tvDNzYfF/o5 l+Gw== 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=eww4YGVNqaj9wRyOutY/EPgdrl5kM4y1BOCar4JSDOY=; b=yWkIGSLpP2Wx76ue9JLME5lbfXFc1+2NaJxegqdqDHi+aNexuS7DF3BT29gZ//8IzZ 0/+FcUzHsoYBNhl0x9faES1LFZeCyFfEDnHScsuQcJ1mxA42yUkHYyYYF38IHpWUlKKV f3RZnMeKHbh3h839Rvgk6WOujjwcIVBneGbYSTwiY4fG/CZD0VaXroulKlBOZF0M+rpZ cuZYLKBz9flB2thQRSImQAIwANF6lL07cW/T72eDMArcAZeP4iwSPUulB4gJk/L4tdOX fz44POlGuQNl5vhexqES9HtYggtcU6Ujz12PnGrBuSLhD6NxASR5/Ry0HjN6PiX6M3/A fnZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="jxyl5I/2"; 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 s2sor9934344plq.22.2019.02.24.04.35.15 for (Google Transport Security); Sun, 24 Feb 2019 04:35:15 -0800 (PST) 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="jxyl5I/2"; 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:in-reply-to:references; bh=eww4YGVNqaj9wRyOutY/EPgdrl5kM4y1BOCar4JSDOY=; b=jxyl5I/2HwfMWNaGOrGaBhrL0uom2+tVm75LY7sjNFlCLVt1Go95qKPHLyi+GivV/u /sy5MtB0kqC+sTReLVH7GmkIel6oG0y1x6r1Lmhc1EoQh+cg/uF+sJresUakl6SVRV/1 cTXRXIIBjjf9mRXZI0M+YNTQayY5rZ2b6BpxoBR50Nia9aEr6CBuDB5fWfCuSgYt6IW+ PdxNFA4nMAKZ0cT+jBGYPINhrJX9eqoryn3YxU/a2AxGLEhkAiKEPXJhKkJoYqpYIC3b C3mEcaPRCcbof5Eb6rM7kyW/QctbaiggK2iK8lp9FmvWRo1miJ4jRP4yDJ6PLJNQOI1N 8zCQ== X-Google-Smtp-Source: AHgI3IYnsiekbeLSFtIgzri2SnnfjeNt2qRN/KWI9yLMZxIuOKs3/2jqj0gP3wC81SLZ/uMG63ce5A== X-Received: by 2002:a17:902:f24:: with SMTP id 33mr13818923ply.65.1551011715029; Sun, 24 Feb 2019 04:35:15 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id v6sm9524634pgb.2.2019.02.24.04.35.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Feb 2019 04:35:14 -0800 (PST) From: Pingfan Liu To: x86@kernel.org, linux-mm@kvack.org Cc: Pingfan Liu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Vlastimil Babka , Mike Rapoport , Andrew Morton , Mel Gorman , Joonsoo Kim , Andy Lutomirski , Andi Kleen , Petr Tesarik , Michal Hocko , Stephen Rothwell , Jonathan Corbet , Nicholas Piggin , Daniel Vacek , linux-kernel@vger.kernel.org Subject: [PATCH 6/6] x86/numa: build node fallback info after setting up node to cpumask map Date: Sun, 24 Feb 2019 20:34:09 +0800 Message-Id: <1551011649-30103-7-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551011649-30103-1-git-send-email-kernelfans@gmail.com> References: <1551011649-30103-1-git-send-email-kernelfans@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 After the previous patches, on x86, it is safe to call memblock_build_node_order() after init_cpu_to_node(), which has set up node to cpumask map. So calling memblock_build_node_order() to feed memblock with numa node fall back info. Signed-off-by: Pingfan Liu CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: "H. Peter Anvin" CC: Dave Hansen CC: Vlastimil Babka CC: Mike Rapoport CC: Andrew Morton CC: Mel Gorman CC: Joonsoo Kim CC: Andy Lutomirski CC: Andi Kleen CC: Petr Tesarik CC: Michal Hocko CC: Stephen Rothwell CC: Jonathan Corbet CC: Nicholas Piggin CC: Daniel Vacek CC: linux-kernel@vger.kernel.org --- arch/x86/kernel/setup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 3d872a5..3ec1a6e 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1245,6 +1245,8 @@ void __init setup_arch(char **cmdline_p) prefill_possible_map(); init_cpu_to_node(); + /* node to cpumask map is ready */ + memblock_build_node_order(); io_apic_init_mappings();