From patchwork Wed Dec 26 13:14:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 10743129 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 D76BB91E for ; Wed, 26 Dec 2018 13:38:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C27A27E5A for ; Wed, 26 Dec 2018 13:38:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59C6F27F89; Wed, 26 Dec 2018 13:38:44 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 088BA28495 for ; Wed, 26 Dec 2018 13:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727218AbeLZNi1 (ORCPT ); Wed, 26 Dec 2018 08:38:27 -0500 Received: from mga12.intel.com ([192.55.52.136]:31975 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726966AbeLZNhH (ORCPT ); Wed, 26 Dec 2018 08:37:07 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Dec 2018 05:37:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,400,1539673200"; d="scan'208";a="113358933" Received: from wangdan1-mobl1.ccr.corp.intel.com (HELO wfg-t570.sh.intel.com) ([10.254.210.154]) by orsmga003.jf.intel.com with ESMTP; 26 Dec 2018 05:37:02 -0800 Received: from wfg by wfg-t570.sh.intel.com with local (Exim 4.89) (envelope-from ) id 1gc9Mr-0005OY-D7; Wed, 26 Dec 2018 21:37:01 +0800 Message-Id: <20181226133351.579378360@intel.com> User-Agent: quilt/0.65 Date: Wed, 26 Dec 2018 21:14:55 +0800 From: Fengguang Wu To: Andrew Morton cc: Linux Memory Management List , Fengguang Wu cc: kvm@vger.kernel.org Cc: LKML cc: Fan Du cc: Yao Yuan cc: Peng Dong cc: Huang Ying CC: Liu Jingqi cc: Dong Eddie cc: Dave Hansen cc: Zhang Yi cc: Dan Williams Subject: [RFC][PATCH v2 09/21] mm: avoid duplicate peer target node References: <20181226131446.330864849@intel.com> MIME-Version: 1.0 Content-Disposition: inline; filename=0020-page_alloc-avoid-duplicate-peer-target-node.patch Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To ensure 1:1 peer node mapping on broken BIOS node distances: node 0 1 2 3 0: 10 21 20 20 1: 21 10 20 20 2: 20 20 10 20 3: 20 20 20 10 or with numa=fake=4U node distances: node 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0: 10 10 10 10 21 21 21 21 17 17 17 17 28 28 28 28 1: 10 10 10 10 21 21 21 21 17 17 17 17 28 28 28 28 2: 10 10 10 10 21 21 21 21 17 17 17 17 28 28 28 28 3: 10 10 10 10 21 21 21 21 17 17 17 17 28 28 28 28 4: 21 21 21 21 10 10 10 10 28 28 28 28 17 17 17 17 5: 21 21 21 21 10 10 10 10 28 28 28 28 17 17 17 17 6: 21 21 21 21 10 10 10 10 28 28 28 28 17 17 17 17 7: 21 21 21 21 10 10 10 10 28 28 28 28 17 17 17 17 8: 17 17 17 17 28 28 28 28 10 10 10 10 28 28 28 28 9: 17 17 17 17 28 28 28 28 10 10 10 10 28 28 28 28 10: 17 17 17 17 28 28 28 28 10 10 10 10 28 28 28 28 11: 17 17 17 17 28 28 28 28 10 10 10 10 28 28 28 28 12: 28 28 28 28 17 17 17 17 28 28 28 28 10 10 10 10 13: 28 28 28 28 17 17 17 17 28 28 28 28 10 10 10 10 14: 28 28 28 28 17 17 17 17 28 28 28 28 10 10 10 10 15: 28 28 28 28 17 17 17 17 28 28 28 28 10 10 10 10 Signed-off-by: Fengguang Wu --- mm/page_alloc.c | 6 ++++++ 1 file changed, 6 insertions(+) --- linux.orig/mm/page_alloc.c 2018-12-23 19:48:27.366110325 +0800 +++ linux/mm/page_alloc.c 2018-12-23 19:48:27.362110332 +0800 @@ -6941,16 +6941,22 @@ static int find_best_peer_node(int nid) int n, val; int min_val = INT_MAX; int peer = NUMA_NO_NODE; + static nodemask_t target_nodes = NODE_MASK_NONE; for_each_online_node(n) { if (n == nid) continue; val = node_distance(nid, n); + if (val == LOCAL_DISTANCE) + continue; + if (node_isset(n, target_nodes)) + continue; if (val < min_val) { min_val = val; peer = n; } } + node_set(peer, target_nodes); return peer; }