From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 677D1CDB465 for ; Thu, 12 Oct 2023 02:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=rMUOpHKQDBNbzguS4kFa41DvoQTQuMYHiph6UwbkGoM=; b=mDMyMvx7hXCakI VvwbKakfyQp6+yB+dUMWSgy9qGJgU02L/Z8MhCQzAqieKIx5BgbPMFgn1xXh6uIKWYTNSikxFwUMH eqlOL4ruch/QoCZPqlEUZb3NGjsXcUDYYLeqxVhbonSHN9/fofpYHimT9UN3X3az64fIcXVW9U1/W K7SyhVH0TW1blcdnqwGrnYZd6hkGd7vSiLRyVUze12SPBKjJy5jdkHzPbusLqNK391iYslqqelTiE JvfAiS09vFue+BuqpImNYpHWNa7Ov04eabiQNTSUZiEl1N4d2Ph3AZGtRdt0VBnkJOBHiiSdE2yfI 9VIZDJW0XfD1v0kjk6iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqll5-00HDqW-0N; Thu, 12 Oct 2023 02:49:07 +0000 Received: from out30-119.freemail.mail.aliyun.com ([115.124.30.119]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqlkw-00HDjj-1t for linux-arm-kernel@lists.infradead.org; Thu, 12 Oct 2023 02:49:00 +0000 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=rongwei.wang@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0VtykMeL_1697078924; Received: from localhost.localdomain(mailfrom:rongwei.wang@linux.alibaba.com fp:SMTPD_---0VtykMeL_1697078924) by smtp.aliyun-inc.com; Thu, 12 Oct 2023 10:48:47 +0800 From: Rongwei Wang To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, tj@kernel.org, mingo@redhat.com Subject: [PATCH RFC 0/5] support NUMA emulation for arm64 Date: Thu, 12 Oct 2023 10:48:37 +0800 Message-Id: <20231012024842.99703-1-rongwei.wang@linux.alibaba.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231011_194858_865153_854E2F23 X-CRM114-Status: UNSURE ( 9.83 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A brief introduction ==================== The NUMA emulation can fake more node base on a single node system, e.g. one node system: [root@localhost ~]# numactl -H available: 1 nodes (0) node 0 cpus: 0 1 2 3 4 5 6 7 node 0 size: 31788 MB node 0 free: 31446 MB node distances: node 0 0: 10 add numa=fake=2 (fake 2 node on each origin node): [root@localhost ~]# numactl -H available: 2 nodes (0-1) node 0 cpus: 0 1 2 3 4 5 6 7 node 0 size: 15806 MB node 0 free: 15451 MB node 1 cpus: 0 1 2 3 4 5 6 7 node 1 size: 16029 MB node 1 free: 15989 MB node distances: node 0 1 0: 10 10 1: 10 10 As above shown, a new node has been faked. As cpus, the realization of x86 NUMA emulation is kept. Maybe each node should has 4 cores is better (not sure, next to do if so). Why do this =========== It seems has following reasons: (1) In x86 host, apply NUMA emulation can fake more nodes environment to test or verify some performance stuff, but arm64 only has one method that modify ACPI table to do this. It's troublesome more or less. (2) Reduce competition for some locks. Here an example we found: will-it-scale/tlb_flush1_processes -t 96 -s 10, it shows obvious hotspot on lruvec->lock when test in single environment. What's more, The performance improved greatly if test in two more nodes system. The data shows below (more is better): --------------------------------------------------------------------- threads/process | 1 | 12 | 24 | 48 | 96 --------------------------------------------------------------------- one node | 14 1122 | 110 5372 | 111 2615 | 79 7084 | 72 4516 --------------------------------------------------------------------- numa=fake=2 | 14 1168 | 144 4848 | 215 9070 | 157 0412 | 142 3968 --------------------------------------------------------------------- | For concurrency 12, no lruvec->lock hotspot. For 24, hotspot | one node has 24% hotspot on lruvec->lock, but | two nodes env hasn't. --------------------------------------------------------------------- As for risks (e.g. numa balance...), they need to be discussed here. Lastly, this just is a draft, I can improve next if it's acceptable. Thanks! Rongwei Wang (5): mm/numa: move numa emulation APIs into generic files mm: percpu: fix variable type of cpu arch_numa: remove __init in early_cpu_to_node() mm/numa: support CONFIG_NUMA_EMU for arm64 mm/numa: migrate leftover numa emulation into mm/numa.c arch/x86/Kconfig | 8 - arch/x86/include/asm/numa.h | 3 - arch/x86/mm/Makefile | 1 - arch/x86/mm/numa.c | 216 +------------- arch/x86/mm/numa_internal.h | 14 +- drivers/base/arch_numa.c | 7 +- include/asm-generic/numa.h | 33 +++ include/linux/percpu.h | 2 +- mm/Kconfig | 8 + mm/Makefile | 1 + arch/x86/mm/numa_emulation.c => mm/numa.c | 333 +++++++++++++++++++++- 11 files changed, 373 insertions(+), 253 deletions(-) rename arch/x86/mm/numa_emulation.c => mm/numa.c (63%) -- 2.32.0.3.gf3a3e56d6 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel