From patchwork Thu Apr 25 01:21:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Du, Fan" X-Patchwork-Id: 10915953 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 E30401515 for ; Thu, 25 Apr 2019 01:42:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D719C28B61 for ; Thu, 25 Apr 2019 01:42:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAFAB28BFE; Thu, 25 Apr 2019 01:42: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=-2.9 required=2.0 tests=BAYES_00,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 67AE128B61 for ; Thu, 25 Apr 2019 01:42:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5092F6B0006; Wed, 24 Apr 2019 21:42:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3A47A6B0007; Wed, 24 Apr 2019 21:42:45 -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 2BC216B0008; Wed, 24 Apr 2019 21:42:45 -0400 (EDT) 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 E72356B0006 for ; Wed, 24 Apr 2019 21:42:44 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id g1so13000151pfo.2 for ; Wed, 24 Apr 2019 18:42:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=0yqiQlK/8S9jDfOWBw0HKH7+HNI4EnlVsdp6B0GH1hI=; b=CLhar1HQDlBra7vyNCAJQqaJErNkRC3sOFnwyMoQPFpxtDQ5hbHnLc2EnaXPg6NWkb gvUmUrO2+vFE8zwJl5e8ojc1uHBCzLa+X2n1QJm1yIoe2yH/LJjbxqaq+h9TpDuHzJtV /d/k9c3/VwY4mabZhEmWXTjVCGdaosBacKH2kx52qhhu/7KANIy0UiNytfhb/JUXKiH1 jknooz+85T/w+EgiL+dWNU6UlayLMk5o8oV+aPZUk2Fu9MliSDEnt/CdO0ywJIS1n8rW ySTEYFll+anMHVCqa/Kar1UBoJOMme5JyJpTj015Xn82BtOeVJPevMl6NBgxhbRPvvk4 RjwA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APjAAAVas0cKErDljNs1R3+t4S52dAks1adSLIL5Esx6Zn6XodxpEdkz +YYDNGqGWonH4kKBFQhOjm5+rMeM3astd/D6g7MHPdH597VIwvfr7hVggLIe4mH1aeXs+AjvsH5 2LaPV6h7EZljntIIKgpQz7TzdJnc646KitTkAoPZvmn9r04P1NnwsRsVifMThaCi1lQ== X-Received: by 2002:a17:902:be12:: with SMTP id r18mr19220232pls.11.1556156564639; Wed, 24 Apr 2019 18:42:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYTLqyQ5vmw/pfTxog3MShb+qCKhi4nSix5K7NThssNwJ+MsZQVq0bk9MYG79yz9orbNNQ X-Received: by 2002:a17:902:be12:: with SMTP id r18mr19220180pls.11.1556156563922; Wed, 24 Apr 2019 18:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556156563; cv=none; d=google.com; s=arc-20160816; b=vPrd2XKBevWe2UERm5JRN4e2IggPlEpHafhGVCxF5cyXa2g/n66tAqtIXAND3gaj+S +J0AGc5+DLIludIsqKFeVV4a46uOVDdVa9kbGLuxijI3S/o1sSGVEmfPbgxE9DU01qkz BCITgR4Gr416szTyYLjdf5im01AEvTdwMO9jnggaMp1aqMyntaxrVxjyWYIsr6CcVaft Tv1T3gyS5V85OID5nq3ysCgaxZU4hv1LAUdPiS/bjLOjiR9OoejX2KwZTvQNuamsT7mY bd0Tov13DIOIwQjveuRe17S2Rlg6EiHysJzuWxJ6ACPqIQd9EdklU8v/XnMRs579H9U4 TYpw== 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; bh=0yqiQlK/8S9jDfOWBw0HKH7+HNI4EnlVsdp6B0GH1hI=; b=D2LhsONwX2p7+MUpdKEwJ7eI2kzMBF71ZddbCu5FMYxKg2C5MOBswrInEa4axDOXTh iXO2p+kr6kKOsXAiD/p0phrz25Dbmuxp5YUo1NpeTQgHByAjKtqcJ0q6/9rTiROxhMSJ 15KZDp89WaX4j0j4sQRLZu6zOXv1/S8ygz6A4283H2CiN2uPyxD04vvGL5dXiPz4mXkK nLopsAHepqQAxuPoJMgeFvzpg9oKYzaV+il221fcftCZL1fT5FYE9xT1R1nYjT9cwDTq rst0wByN0jne7SH8N5aaSqMetCbjB+mQr8kwA71PiqJdjgytn19/TvCdCODOXdztgKCx rPfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga05.intel.com (mga05.intel.com. [192.55.52.43]) by mx.google.com with ESMTPS id d3si21134661pfc.278.2019.04.24.18.42.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 18:42:43 -0700 (PDT) Received-SPF: pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) client-ip=192.55.52.43; Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2019 18:42:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,391,1549958400"; d="scan'208";a="152134215" Received: from zz23f_aep_wp03.sh.intel.com ([10.239.85.39]) by FMSMGA003.fm.intel.com with ESMTP; 24 Apr 2019 18:42:42 -0700 From: Fan Du To: akpm@linux-foundation.org, mhocko@suse.com, fengguang.wu@intel.com, dan.j.williams@intel.com, dave.hansen@intel.com, xishi.qiuxishi@alibaba-inc.com, ying.huang@intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Fan Du Subject: [RFC PATCH 1/5] acpi/numa: memorize NUMA node type from SRAT table Date: Thu, 25 Apr 2019 09:21:31 +0800 Message-Id: <1556155295-77723-2-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1556155295-77723-1-git-send-email-fan.du@intel.com> References: <1556155295-77723-1-git-send-email-fan.du@intel.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 Mark NUMA node as DRAM or PMEM. This could happen in boot up state (see the e820 pmem type override patch), or on fly when bind devdax device with kmem driver. It depends on BIOS supplying PMEM NUMA proximity in SRAT table, that's current production BIOS does. Signed-off-by: Fan Du --- arch/x86/include/asm/numa.h | 2 ++ arch/x86/mm/numa.c | 2 ++ drivers/acpi/numa.c | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index bbfde3d..5191198 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -30,6 +30,8 @@ */ extern s16 __apicid_to_node[MAX_LOCAL_APIC]; extern nodemask_t numa_nodes_parsed __initdata; +extern nodemask_t numa_nodes_pmem; +extern nodemask_t numa_nodes_dram; extern int __init numa_add_memblk(int nodeid, u64 start, u64 end); extern void __init numa_set_distance(int from, int to, int distance); diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index dfb6c4d..3c3a1f5 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -20,6 +20,8 @@ int numa_off; nodemask_t numa_nodes_parsed __initdata; +nodemask_t numa_nodes_pmem; +nodemask_t numa_nodes_dram; struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; EXPORT_SYMBOL(node_data); diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 867f6e3..ec4b7a7e 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -298,6 +298,11 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit) node_set(node, numa_nodes_parsed); + if (ma->flags & ACPI_SRAT_MEM_NON_VOLATILE) + node_set(node, numa_nodes_pmem); + else + node_set(node, numa_nodes_dram); + pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n", node, pxm, (unsigned long long) start, (unsigned long long) end - 1, From patchwork Thu Apr 25 01:21:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Du, Fan" X-Patchwork-Id: 10915955 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 412661515 for ; Thu, 25 Apr 2019 01:42:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3443628B61 for ; Thu, 25 Apr 2019 01:42:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27B4D28BFE; Thu, 25 Apr 2019 01:42:50 +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=-2.9 required=2.0 tests=BAYES_00,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 B979E28B61 for ; Thu, 25 Apr 2019 01:42:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F7696B0007; Wed, 24 Apr 2019 21:42:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1AE1B6B0008; Wed, 24 Apr 2019 21:42:47 -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 023E36B000A; Wed, 24 Apr 2019 21:42:46 -0400 (EDT) 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 CF7AC6B0007 for ; Wed, 24 Apr 2019 21:42:46 -0400 (EDT) Received: by mail-pg1-f199.google.com with SMTP id v9so13243691pgg.8 for ; Wed, 24 Apr 2019 18:42:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=QleL8CAONDSgNNXma3dxkm0/dQm/tc84zMmGS22JMXc=; b=PtCFwEbQldCedX70WqR6cJR+8+Aq3E00cWbBlMRgMJwe1mlrtFTtextu4GJ2gTziDp +xMxWkQMgF5cUdpMckujUZRmxlXzfwjsjPc218XjX1kbtKGO9nDQJsmlhLHFqRB/AdV8 SX68jWM3/mVWg7saTBZSKm9KIaYa1HDozeYZk+EXl8wIfARFkzJir4pfkPy/x9yTqePx w1YlX/g05oOG6b/oHEthzUXL7jL2WXnRqa8kfrsbhhCJN0EzsaJnRhsg152cIidq/67X qWnxHJ6V4/0oXUtxXADsTCv+ypYnrsIfGB5byhLCoyKmWKFqHm75UGL61CajXX7NTV4j b3TA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APjAAAVnigoKKUtZcMhRzU7J2733DxWCbnVlCy6cFQc2x00iT8sjuurc kyfZtynonJr336PwZ0XkOzVOEX4iSz9gFzvC1LAn1jnHIyxyaj3MvejKAfdUXxtjocXAtNECb6h vWajDVQmr1RmzlgIFmZzdeVEyhuFDpdAL/Ne/IiapfAWjgbmgNBKpC/YEFse7cXWujA== X-Received: by 2002:a63:fc5a:: with SMTP id r26mr31855761pgk.97.1556156566529; Wed, 24 Apr 2019 18:42:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/sqK2Vtep0oeGfwD4pr/9Uykez4MffWcwKYD4CKuzjuRaZg+l9FfOQxhyeBB31yGUWJHd X-Received: by 2002:a63:fc5a:: with SMTP id r26mr31855698pgk.97.1556156565591; Wed, 24 Apr 2019 18:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556156565; cv=none; d=google.com; s=arc-20160816; b=RQUu8fzkcSleuFi3XGtjhduH4GBUw9nDEAlaEDHI9ow7tVStoNLd+2Yc5Evic94zPM L40VIzOZuX+zRTQQt6ALtFKVgbUO3JSWw0Pdh5RUnlzRepmVee9SyDcICCqpRX0JUgcS 0GFMs3PLSvBuNkHkiaBA1R6TOoRcXZzAz8GB+haVjV8HoZDvytaMs9Ptpgo6JqapqdN5 QObukXMGf/fQrR8Z0K6Fxt/PVHSLYotVilbBLrdielLAwlRm+gA3PPtWmqvVB1s01Z4W 4KKtQBJVIqzgbDbx6PnnDkfCnFpqJ3V0G8KYXJ1ye8RX130/vVaiT4OOS8dhDNxC+HaQ UNUw== 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; bh=QleL8CAONDSgNNXma3dxkm0/dQm/tc84zMmGS22JMXc=; b=z22yH1bwVp74WY1ICjGvp/TrtTda/0vAyIl0PIj0WoRjUXMCI+DwKXAirB0YNmHlfB GrFkNqzWSBjAF/f692mUOFh35Biz2mohGuR2lBHdaBiL/FG4YsfUUFhbRkwcg4OkjFy3 HU3XqIP8Lt5m0jX4NozTtHf+KAIsfNk2MUc3Rczjp8oMZkhohw+4o8OUbwxqVJ7C/bqo +7pZDbhIQg0M8IFIk830UdKwPvj/FX0tu2CBxVD8mNmJsSztH2V6pY3/UL8Obdarv41x 3s+phVGKk0PufRB3nQd+Nq1DfpjIslnJRqwwGy5/LN0xNAOFwIJVwXWc6zlhRqlpQwLj y2SA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga05.intel.com (mga05.intel.com. [192.55.52.43]) by mx.google.com with ESMTPS id d3si21134661pfc.278.2019.04.24.18.42.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 18:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) client-ip=192.55.52.43; Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2019 18:42:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,391,1549958400"; d="scan'208";a="152134221" Received: from zz23f_aep_wp03.sh.intel.com ([10.239.85.39]) by FMSMGA003.fm.intel.com with ESMTP; 24 Apr 2019 18:42:43 -0700 From: Fan Du To: akpm@linux-foundation.org, mhocko@suse.com, fengguang.wu@intel.com, dan.j.williams@intel.com, dave.hansen@intel.com, xishi.qiuxishi@alibaba-inc.com, ying.huang@intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Fan Du Subject: [RFC PATCH 2/5] mmzone: new pgdat flags for DRAM and PMEM Date: Thu, 25 Apr 2019 09:21:32 +0800 Message-Id: <1556155295-77723-3-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1556155295-77723-1-git-send-email-fan.du@intel.com> References: <1556155295-77723-1-git-send-email-fan.du@intel.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 One system with DRAM and PMEM, we need new flag to tag pgdat is made of DRAM or peristent memory. This patch serves as preparetion one for follow up patch. Signed-off-by: Fan Du --- include/linux/mmzone.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index fba7741..d3ee9f9 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -520,6 +520,8 @@ enum pgdat_flags { * many pages under writeback */ PGDAT_RECLAIM_LOCKED, /* prevents concurrent reclaim */ + PGDAT_DRAM, /* Volatile DRAM memory node */ + PGDAT_PMEM, /* Persistent memory node */ }; enum zone_flags { @@ -923,6 +925,30 @@ extern int numa_zonelist_order_handler(struct ctl_table *, int, #endif /* !CONFIG_NEED_MULTIPLE_NODES */ +static inline int is_node_pmem(int nid) +{ + pg_data_t *pgdat = NODE_DATA(nid); + + return test_bit(PGDAT_PMEM, &pgdat->flags); +} + +static inline int is_node_dram(int nid) +{ + pg_data_t *pgdat = NODE_DATA(nid); + + return test_bit(PGDAT_DRAM, &pgdat->flags); +} + +static inline void set_node_type(int nid) +{ + pg_data_t *pgdat = NODE_DATA(nid); + + if (node_isset(nid, numa_nodes_pmem)) + set_bit(PGDAT_PMEM, &pgdat->flags); + else + set_bit(PGDAT_DRAM, &pgdat->flags); +} + extern struct pglist_data *first_online_pgdat(void); extern struct pglist_data *next_online_pgdat(struct pglist_data *pgdat); extern struct zone *next_zone(struct zone *zone); From patchwork Thu Apr 25 01:21:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Du, Fan" X-Patchwork-Id: 10915957 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 313801515 for ; Thu, 25 Apr 2019 01:42:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2599D28B61 for ; Thu, 25 Apr 2019 01:42:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1981728BFE; Thu, 25 Apr 2019 01:42:52 +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=-2.9 required=2.0 tests=BAYES_00,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 BE34528B61 for ; Thu, 25 Apr 2019 01:42:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F4FF6B0008; Wed, 24 Apr 2019 21:42:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8FBC86B000A; Wed, 24 Apr 2019 21:42:48 -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 751766B000C; Wed, 24 Apr 2019 21:42:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id 4AEB76B0008 for ; Wed, 24 Apr 2019 21:42:48 -0400 (EDT) Received: by mail-pg1-f200.google.com with SMTP id 33so13228566pgv.17 for ; Wed, 24 Apr 2019 18:42:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=cjRxgUuUWVSMsnI9DqRNDNjwymo67GiiFEu+mWS/lr8=; b=uDOTYa8BHsWoiuCpzEeZ2Ca1dSHB0QfNKsQTE6iXwNU1g0m1bumxO24O5Oz24MlUt7 BH1SgAoYhm/scVAfBPIb4+0N3N844K7ztZzePOW+nkjIImBf/tkI8gqS12E/w6Ct5i9L TTG0g6cUfH6Oa9DPCpM8yfwpKvk6JOapZnVltig4ma4Z3sQMxkY4r4X/hLXN4w42RtuR L83cmuwkfHLdGVxvV7y7PtAsT70CSFQ0rQJZkxocNwk53lbU8fI4b0LEjlLEDjDiMCQb vUp8GDgdTj0uNgvkvl8iGXVK/CXeUNkBHg6a0/CwOtCDKuw0gHnBUpq8W7gREcALaOVd JjqA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APjAAAWPj0Vz088GLlSbsqKwVrRx22KSnr4XyVry7eJJwkS9Ply8YY+q JNMQm5e+RM+ol9Lz0edSHwpZ4XBtf0dmOPdC6kWLulSgcckROiRmXB00wTsBaP6jWldqW9JYzkb sGaaVjNifr8mMwaRBjuj53CuZz3S366mCQUiO+KfQBE5vJxE2Ln+YDM50A9qDgZidlw== X-Received: by 2002:a63:8f49:: with SMTP id r9mr27464321pgn.306.1556156568000; Wed, 24 Apr 2019 18:42:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhTKYUdlB4UjZkpJnC0T5NI9ZpVvTwxByF1enImVVYduHKiV+MWIbvrIOns2KpsGINl5CG X-Received: by 2002:a63:8f49:: with SMTP id r9mr27464268pgn.306.1556156567197; Wed, 24 Apr 2019 18:42:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556156567; cv=none; d=google.com; s=arc-20160816; b=YI+bPT8PPjp53+LJu3jp/V/3qv2lXlcTN8KLv1Fa4l1roa9C9VbeACzzwun1wxkBh9 D2fHGxj+v0KNDWLVIPpYcgDiS51qPeon+KuvBeErpAGtE36loGnE5Ax9F1DaIQik1L3n hYUYFo1BOAa8rGVsMFgYTCKdlOojOwKZAkwayegCgdV7159vAOk5yDc6Qc5BGG/cFcwP 6BQtEiL7eX490spNvCpSHmNflRkSYjeeJRC6YlA8HTx5RGBCwm5nFJ3IaysykThi6Djy KHvzqOQCvKGviUAfaHZLKXPTX3GHKtJVZ1xQxT/qxHjdsvtV+fmim49bRHsbu04h05rt AwPA== 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; bh=cjRxgUuUWVSMsnI9DqRNDNjwymo67GiiFEu+mWS/lr8=; b=TrQWAIoKta4vk+7NFP4hN99D+Irk3rE89Hr9t9XSyA4E0fQmE6usJww3bxpFD6zi01 ltGTbNnMfh7HR8fzN7kOcw5A24psZ+qNibrmxDedr7WvRLPwDRCepQ+7CBX1nzi/kPrL 0B9ZAovJsDg6lrcGkdeyqD04LnpodGaQrlNzgeSkFKF5uSswNxPOux+VYzComfegOUM1 D6exdhvktoPSPNqvpRCo2J4UL5a4V0p/bzLwrq8tgr3NUb+SRPK3iYMw9GKlyqmXtFdh 9XE/xbaR5tGbs+I3A+qzzqI7t6b1HzL0nFTl3J3cIGtSS1Dgy6Hr7LqPBZjvGxo8VH06 evbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga05.intel.com (mga05.intel.com. [192.55.52.43]) by mx.google.com with ESMTPS id d3si21134661pfc.278.2019.04.24.18.42.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 18:42:47 -0700 (PDT) Received-SPF: pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) client-ip=192.55.52.43; Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2019 18:42:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,391,1549958400"; d="scan'208";a="152134226" Received: from zz23f_aep_wp03.sh.intel.com ([10.239.85.39]) by FMSMGA003.fm.intel.com with ESMTP; 24 Apr 2019 18:42:45 -0700 From: Fan Du To: akpm@linux-foundation.org, mhocko@suse.com, fengguang.wu@intel.com, dan.j.williams@intel.com, dave.hansen@intel.com, xishi.qiuxishi@alibaba-inc.com, ying.huang@intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Fan Du Subject: [RFC PATCH 3/5] x86,numa: update numa node type Date: Thu, 25 Apr 2019 09:21:33 +0800 Message-Id: <1556155295-77723-4-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1556155295-77723-1-git-send-email-fan.du@intel.com> References: <1556155295-77723-1-git-send-email-fan.du@intel.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 Give the newly created node a type per SRAT attribution. Signed-off-by: Fan Du --- arch/x86/mm/numa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 3c3a1f5..ff8ad63 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -590,6 +590,7 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) continue; alloc_node_data(nid); + set_node_type(nid); } /* Dump memblock with node info and return. */ From patchwork Thu Apr 25 01:21:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Du, Fan" X-Patchwork-Id: 10915959 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 8EBD71515 for ; Thu, 25 Apr 2019 01:42:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81A4728B61 for ; Thu, 25 Apr 2019 01:42:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7311E28BFE; Thu, 25 Apr 2019 01:42: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=-2.9 required=2.0 tests=BAYES_00,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 DF35C28B61 for ; Thu, 25 Apr 2019 01:42:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72B5E6B000A; Wed, 24 Apr 2019 21:42:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6D7C06B000C; Wed, 24 Apr 2019 21:42:50 -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 5C7FE6B000D; Wed, 24 Apr 2019 21:42:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id 2737E6B000A for ; Wed, 24 Apr 2019 21:42:50 -0400 (EDT) Received: by mail-pg1-f200.google.com with SMTP id m9so8815534pge.7 for ; Wed, 24 Apr 2019 18:42:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=hqI7L/58NB/51uxAiM/Mz2T2sXjRz7XBu7fn1ORtLXQ=; b=Jh1nEv9LofZxXYK7gGZHIx24ND9wBPOJNkvx1JP/JywCiY0/UldPyBwDM/L1KjQfCK Z3Nzc6JWpJbT+fUSxfZx24RHLNQmB+UCaGq26b7fSRbbcvYXV/6uyQMYiW59vnhcoOuc U3znePHzTwgeXR7Kl6uINUyJ6g1PjBuqA5SzjP0+H8FAdXY/b+lHE6pNI3lKieLsW5He bT0cusOlBBUqX9CaP7rg67dBJekhtHkH7Ob5c54LC9y0aBu+sjyoLnhyPsOAVKTji8E7 GO59SD+4NTuYXLT/Z/2xMKAeEk5kMAR5i9EZ9tjf9S7wglupbmP2jl9fA0eAYVg2T6TC //JA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APjAAAW8Vjvm3oGsFmv4map5Z4DnNm7rkzKHyNtB6l8xyFUrvDex2L5U JZeGi20T0WqOo+TXN3LEujh6wvpZDqkVXIKPDphkH37QQUqKckgpJ6VNO9Pumovfg4r0d4LiFW5 EUoVY8A/rB8TpQ4yVxgpQx2ZZMn72jC6qsH5NTdJokvop0Dv/AvVG+8OtG1LO9Z4ivg== X-Received: by 2002:a62:69c2:: with SMTP id e185mr36812635pfc.119.1556156569845; Wed, 24 Apr 2019 18:42:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnVkowwsN/iBepU+5eH74P4VT5GKWE9KJtYPAtVETdeTlarPQd+HoePrKTk8j+9K03/yEY X-Received: by 2002:a62:69c2:: with SMTP id e185mr36812577pfc.119.1556156568983; Wed, 24 Apr 2019 18:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556156568; cv=none; d=google.com; s=arc-20160816; b=kndx0T6QlVq6oaRrvAoxLwuZ/e+pxsxL9+BE05OA2fyB7vpqchNLD/DPM6mx0NCVKj rke0Av4XZayhsFLV4ZyHCPlRuDgVLnoPQ8/H/QwlhY0MtSUGeClGBzEoMP7gRbl9/4hd IDr9gJdrcp0+fuD4pD2VwY1ubh9guH3KHnWbMDf9FaBZMQn4fnZLMYClZ1aeDdb3UpjO 4H5kRLkQ4T5tKV7SOxRaULo7JFtQtr3tJhLG+UvF+IAv3XdwFLlVoxOiC+bw1Gs49/FE BLTkGPsZhWo3EIQdlhL93MLogU285WyZG4zbYh9Vre13bu72HL053FevQ+CLNtbvFu1Z JgpQ== 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; bh=hqI7L/58NB/51uxAiM/Mz2T2sXjRz7XBu7fn1ORtLXQ=; b=0JJ9ULzc3n0IuNY9y8gGf3vUyZoZkBlydWG5YeJEXw/DqHRyM66exoAVAhhLJkC3dX daD93koMJQkrwQwWvr2PBQw3GBeHg9/3IM0rr4hDQ2Xs0DBU4KedwrGKgjgrCJZXIwqq Gn5cXa70JlmUKuDFVxUO6nzhpG6nes/+HfgJECH6FXvfJNvKv1lWjUm7xfxrwfNFBWVO Xc0PHhUi4Qi3iec+Umholmj+l99D2Sa0uGO65uNCahzN2kVm1D94/50rTiIym5mxvsE0 7DgQ0FQYl+pV2OUSyx5ZWyv7qc/tfAKpzjO0GvML847OTcUFs9o3C8DuHJSGQ4wHvdbB 5S5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga05.intel.com (mga05.intel.com. [192.55.52.43]) by mx.google.com with ESMTPS id d3si21134661pfc.278.2019.04.24.18.42.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 18:42:48 -0700 (PDT) Received-SPF: pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) client-ip=192.55.52.43; Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2019 18:42:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,391,1549958400"; d="scan'208";a="152134236" Received: from zz23f_aep_wp03.sh.intel.com ([10.239.85.39]) by FMSMGA003.fm.intel.com with ESMTP; 24 Apr 2019 18:42:47 -0700 From: Fan Du To: akpm@linux-foundation.org, mhocko@suse.com, fengguang.wu@intel.com, dan.j.williams@intel.com, dave.hansen@intel.com, xishi.qiuxishi@alibaba-inc.com, ying.huang@intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Fan Du Subject: [RFC PATCH 4/5] mm, page alloc: build fallback list on per node type basis Date: Thu, 25 Apr 2019 09:21:34 +0800 Message-Id: <1556155295-77723-5-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1556155295-77723-1-git-send-email-fan.du@intel.com> References: <1556155295-77723-1-git-send-email-fan.du@intel.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 On box with both DRAM and PMEM managed by mm system, Usually node 0, 1 are DRAM nodes, nodes 2, 3 are PMEM nodes. nofallback list are same as before, fallback list are not redesigned to be arranged by node type basis, iow, allocation request of DRAM page start from node 0 will go through node0->node1->node2->node3 zonelists. Signed-off-by: Fan Du --- include/linux/mmzone.h | 8 ++++++++ mm/page_alloc.c | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index d3ee9f9..8c37e1c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -939,6 +939,14 @@ static inline int is_node_dram(int nid) return test_bit(PGDAT_DRAM, &pgdat->flags); } +static inline int is_node_same_type(int nida, int nidb) +{ + if (node_isset(nida, numa_nodes_pmem)) + return node_isset(nidb, numa_nodes_pmem); + else + return node_isset(nidb, numa_nodes_dram); +} + static inline void set_node_type(int nid) { pg_data_t *pgdat = NODE_DATA(nid); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c6ce20a..a408a91 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5372,7 +5372,7 @@ int numa_zonelist_order_handler(struct ctl_table *table, int write, * * Return: node id of the found node or %NUMA_NO_NODE if no node is found. */ -static int find_next_best_node(int node, nodemask_t *used_node_mask) +static int find_next_best_node(int node, nodemask_t *used_node_mask, int need_same_type) { int n, val; int min_val = INT_MAX; @@ -5380,7 +5380,7 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask) const struct cpumask *tmp = cpumask_of_node(0); /* Use the local node if we haven't already */ - if (!node_isset(node, *used_node_mask)) { + if (need_same_type && !node_isset(node, *used_node_mask)) { node_set(node, *used_node_mask); return node; } @@ -5391,6 +5391,12 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask) if (node_isset(n, *used_node_mask)) continue; + if (need_same_type && !is_node_same_type(node, n)) + continue; + + if (!need_same_type && is_node_same_type(node, n)) + continue; + /* Use the distance array to find the distance */ val = node_distance(node, n); @@ -5472,31 +5478,35 @@ static void build_zonelists(pg_data_t *pgdat) int node, load, nr_nodes = 0; nodemask_t used_mask; int local_node, prev_node; + int need_same_type; /* 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; + for (need_same_type = 1; need_same_type >= 0; need_same_type--) { + nodes_clear(used_mask); + while ((node = find_next_best_node(local_node, &used_mask, + need_same_type)) >= 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--; + node_order[nr_nodes++] = node; + prev_node = node; + load--; + } } - build_zonelists_in_node_order(pgdat, node_order, nr_nodes); build_thisnode_zonelists(pgdat); + } #ifdef CONFIG_HAVE_MEMORYLESS_NODES From patchwork Thu Apr 25 01:21:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Du, Fan" X-Patchwork-Id: 10915961 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 A331B1575 for ; Thu, 25 Apr 2019 01:42:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9576F28B61 for ; Thu, 25 Apr 2019 01:42:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89A8328C0B; Thu, 25 Apr 2019 01:42:56 +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=-2.9 required=2.0 tests=BAYES_00,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 0A7EA28B61 for ; Thu, 25 Apr 2019 01:42:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81C446B000C; Wed, 24 Apr 2019 21:42:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7274F6B000D; Wed, 24 Apr 2019 21:42:52 -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 556DE6B000E; Wed, 24 Apr 2019 21:42:52 -0400 (EDT) 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 1DF536B000C for ; Wed, 24 Apr 2019 21:42:52 -0400 (EDT) Received: by mail-pg1-f197.google.com with SMTP id r5so6856852pgb.11 for ; Wed, 24 Apr 2019 18:42:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=R8qhdg+2AWOPlfSzyMslwEMBF9euYTiSJ41K7L0E3wQ=; b=dq+L2wGHCpyOKlO0EvNVoDpswapmk2DgM/W1CZHB3m+yjKrjC9z7+iMBMEVVkXyiAz R6zLkKjwjCmSroW92SSNK8g8nsSCdMCEcL4+Le8olL8j5tTg1bJd2qwLuFg1ouObvarB Q8TqBFuEDLi8GtAJyrB2QY64VQvjqlMfNyo90SZPvFU8F+bX3pyKn6MUwKwMSeOxeC2e 2INntPRgOUvFBPV5QIfT7Kh9nIjFMNaN9W31nt240uidPxSwWbkh7OSV/iJPIJEazbzn x7QEEezrGEb1x7q3CcOQ0x8G77YhOY56sF/Sz6hTRLQQbHijkMIPFLycgqvNJEvKk8H2 twGg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: APjAAAWzU7l+/cILIqCVfy2XKTgevMywqgkZlB4mPRUVjXSEt5U2rpXH iC4u+SrTBXZeQXyrp+8shvg8PYsjK47qUHQFJM06t/2ntzThc6pJfwGEcG8DysCGeQk+w07j9fJ XPNMHGaso85Px1snDGMa17HqjWRrP3gT6h9vaHqjgjCN3LKAdNchYV4wksPwaHh2RcA== X-Received: by 2002:a63:c54a:: with SMTP id g10mr10468829pgd.71.1556156571761; Wed, 24 Apr 2019 18:42:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRw9+kkPK85Rt2LCnz9xxehq4NV8zhocSVdEC/M/b1gMJORbTsXCwGIznDbSKeDu6R+UEj X-Received: by 2002:a63:c54a:: with SMTP id g10mr10468756pgd.71.1556156570712; Wed, 24 Apr 2019 18:42:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556156570; cv=none; d=google.com; s=arc-20160816; b=y6sB7pnpyJWHVfO4rlu5R/rjAxrMGU6u4E5Magu6JlB/anykIBChIelo/os1af/AcW VegDtIBHU2fw+MFldrBYIBERZ86dldmJS5xQ79qC0CFjEnin5DsCp17EnpmGhmeU7WxZ S1GT4eKmnnHx1ZqIp596864SCRGu/77ldkrHAqzhPBL0P9NnZ23gAAUAK3lvHb8gLnmR fIYb1a8m6yhJuSUMP48eJ7DatNtomv4dGDLt3jbn0jvE/IMM8H01nRV2uHu3h6zE+dT4 vXUDCO1/wEaY6z6aF+EXH6TcqSf0eXYoS8Em9QPPGJs4RCDPFZN3kuGa9Mr6h1t/me2e KVhw== 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; bh=R8qhdg+2AWOPlfSzyMslwEMBF9euYTiSJ41K7L0E3wQ=; b=tqXCPINkNh5nILy03ayHKb9U54iHRpqUgM9UQB7N94/nmcirHoPvcHFapNRK6Q8+wr j8qXCFvC+Miq7eyojI7BJkfFkAsjQD0fzRMaj2dVrau4IaVV58n0lIyV7G6k7FTMmf67 6jEI1aHmnant5ARrjNn3f0wHLqhia07soXvvxqE7LZDAfuiwhqyGcHHGP5Lxl3BhO7UZ dSm0f62xuq8q8xGk9cPimT4HBhif0dczE9F+HKQ+UWY/6EZ/+cjZEmSarN91TmRRoiUw LEfF0I/DhEiGVMlEQKSXMRkzLA2OyZCXj0ypudr542n3fIaIKUuxVF6zen596LCeAG0L 0GZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga05.intel.com (mga05.intel.com. [192.55.52.43]) by mx.google.com with ESMTPS id d3si21134661pfc.278.2019.04.24.18.42.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 18:42:50 -0700 (PDT) Received-SPF: pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) client-ip=192.55.52.43; Authentication-Results: mx.google.com; spf=pass (google.com: domain of fan.du@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=fan.du@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2019 18:42:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,391,1549958400"; d="scan'208";a="152134261" Received: from zz23f_aep_wp03.sh.intel.com ([10.239.85.39]) by FMSMGA003.fm.intel.com with ESMTP; 24 Apr 2019 18:42:48 -0700 From: Fan Du To: akpm@linux-foundation.org, mhocko@suse.com, fengguang.wu@intel.com, dan.j.williams@intel.com, dave.hansen@intel.com, xishi.qiuxishi@alibaba-inc.com, ying.huang@intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Fan Du Subject: [RFC PATCH 5/5] mm, page_alloc: Introduce ZONELIST_FALLBACK_SAME_TYPE fallback list Date: Thu, 25 Apr 2019 09:21:35 +0800 Message-Id: <1556155295-77723-6-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1556155295-77723-1-git-send-email-fan.du@intel.com> References: <1556155295-77723-1-git-send-email-fan.du@intel.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 On system with heterogeneous memory, reasonable fall back lists woul be: a. No fall back, stick to current running node. b. Fall back to other nodes of the same type or different type e.g. DRAM node 0 -> DRAM node 1 -> PMEM node 2 -> PMEM node 3 c. Fall back to other nodes of the same type only. e.g. DRAM node 0 -> DRAM node 1 a. is already in place, previous patch implement b. providing way to satisfy memory request as best effort by default. And this patch of writing build c. to fallback to the same node type when user specify GFP_SAME_NODE_TYPE only. Signed-off-by: Fan Du --- include/linux/gfp.h | 7 +++++++ include/linux/mmzone.h | 1 + mm/page_alloc.c | 15 +++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index fdab7de..ca5fdfc 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -44,6 +44,8 @@ #else #define ___GFP_NOLOCKDEP 0 #endif +#define ___GFP_SAME_NODE_TYPE 0x1000000u + /* If the above are modified, __GFP_BITS_SHIFT may need updating */ /* @@ -215,6 +217,7 @@ /* Disable lockdep for GFP context tracking */ #define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP) +#define __GFP_SAME_NODE_TYPE ((__force gfp_t)___GFP_SAME_NODE_TYPE) /* Room for N __GFP_FOO bits */ #define __GFP_BITS_SHIFT (23 + IS_ENABLED(CONFIG_LOCKDEP)) @@ -301,6 +304,8 @@ __GFP_NOMEMALLOC | __GFP_NOWARN) & ~__GFP_RECLAIM) #define GFP_TRANSHUGE (GFP_TRANSHUGE_LIGHT | __GFP_DIRECT_RECLAIM) +#define GFP_SAME_NODE_TYPE (__GFP_SAME_NODE_TYPE) + /* Convert GFP flags to their corresponding migrate type */ #define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE) #define GFP_MOVABLE_SHIFT 3 @@ -438,6 +443,8 @@ static inline int gfp_zonelist(gfp_t flags) #ifdef CONFIG_NUMA if (unlikely(flags & __GFP_THISNODE)) return ZONELIST_NOFALLBACK; + if (unlikely(flags & __GFP_SAME_NODE_TYPE)) + return ZONELIST_FALLBACK_SAME_TYPE; #endif return ZONELIST_FALLBACK; } diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 8c37e1c..2f8603e 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -583,6 +583,7 @@ static inline bool zone_intersects(struct zone *zone, enum { ZONELIST_FALLBACK, /* zonelist with fallback */ + ZONELIST_FALLBACK_SAME_TYPE, /* zonelist with fallback to the same type node */ #ifdef CONFIG_NUMA /* * The NUMA zonelists are doubled because we need zonelists that diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a408a91..de797921 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5448,6 +5448,21 @@ static void build_zonelists_in_node_order(pg_data_t *pgdat, int *node_order, } zonerefs->zone = NULL; zonerefs->zone_idx = 0; + + zonerefs = pgdat->node_zonelists[ZONELIST_FALLBACK_SAME_TYPE]._zonerefs; + + for (i = 0; i < nr_nodes; i++) { + int nr_zones; + + pg_data_t *node = NODE_DATA(node_order[i]); + + if (!is_node_same_type(node->node_id, pgdat->node_id)) + continue; + nr_zones = build_zonerefs_node(node, zonerefs); + zonerefs += nr_zones; + } + zonerefs->zone = NULL; + zonerefs->zone_idx = 0; } /*