From patchwork Wed Feb 15 15:24:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13141809 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C210C64EC4 for ; Wed, 15 Feb 2023 15:24:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B31B76B0078; Wed, 15 Feb 2023 10:24:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE3216B0075; Wed, 15 Feb 2023 10:24:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 982846B0078; Wed, 15 Feb 2023 10:24:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 849096B0074 for ; Wed, 15 Feb 2023 10:24:34 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3407E1405C9 for ; Wed, 15 Feb 2023 15:24:34 +0000 (UTC) X-FDA: 80469898068.05.174F419 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf29.hostedemail.com (Postfix) with ESMTP id 6112F12001D for ; Wed, 15 Feb 2023 15:24:32 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=W9zKzHIS; spf=pass (imf29.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676474672; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Lr8xw0GpgSDinfISjaWLMj9pTWMR4/E0MtCDDZjeQGc=; b=R7SYswvgYCsJEIckWSTyXHeqG/hVl2NT2n+31EqOtTvdcDJ2O9jf4c+IuGY8E2kgYjMBle GZsCMTjZBUELKUWjRZiDGZwPIuQU2ypVjjJhl9dgTLdx7KkmBTXvwt+LWowp0EnIDAm+uz i6wpdxJWHLsk1Eqg3PryuLpNyWW1Ix0= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=W9zKzHIS; spf=pass (imf29.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676474672; a=rsa-sha256; cv=none; b=QbnYYiw1PtsruZiTbMynp1JPiyxuEeXigbtuTirvRKLORfnWDOTeA3xbAjuppP8fxoqKMC J2+8g89JMLmFY1VMzygAwDUhXp+5tFHtSdSMZfZYNDnFWnLxTQRa2trdQh1rYpBJinroDI 2Yl48Vg5pUyuby/7UBllFSUyDXTwPhc= Received: by mail-pl1-f178.google.com with SMTP id r8so20591553pls.2 for ; Wed, 15 Feb 2023 07:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; t=1676474669; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Lr8xw0GpgSDinfISjaWLMj9pTWMR4/E0MtCDDZjeQGc=; b=W9zKzHISha0iYW/fT1pEEv3c0rpU7JwDYPQqj5Akevx4weqg5i6aiGnqqnQoAB6sNL 9HN+vOpU5Hy6HvbWyAlxSHfCP2/0FaxcOL6NC7aJfvpF6axDLBki7tSl6RSQKT9NxUUW ki7COyGU4H5z1EaEwwYDNKXJDrAstXSTb4PH9en1C+htebAMcr5DxxKAyWk7n8ZP6p46 BzZb5k31PveTQfRF7eqxggtZeDvzTTtS8Vi71Jl9hQDH5vnIulvSl7/HUczeBhArpIv0 uJT01WDmpsNnKlqQMP/L6ijRF60B2MzUPcPnGRNBB4twji16iGLuI1Eb+8CSBsl9CcvP pzYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1676474669; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lr8xw0GpgSDinfISjaWLMj9pTWMR4/E0MtCDDZjeQGc=; b=KNC89ToThER0V1dDQSHBZLrODCdOKvo+T6aWB9YbCbLnaXUCyI4tKBQkN4sdVQqYcf 5+lBdaFD8P2XmD/B2GpqrpStQIdw7ZUrCGvpRnUIUQqLyJQmcFpKzjaz3hzQc4gBQLmB hQAVVND586P2Nk8cGOLB1pJDiiQPsutIX3qVXv191ycj0Bh6UbeXA60fgtk4IX0Aw+AS 8r2o8dKFNK6I17WdKSiHArfOShi0FtkHH0cHtIdh2cN9RJKIDwJX9P3XRfuf2+0ODHUf x5zcVuwzlrHkS6gyr3n4ubvfr1/GVHOa9UHlGyvGqnXfbUmWaW3Hw8YsTimnDBggGpvd GXGw== X-Gm-Message-State: AO0yUKXUAV9M33uInzVq9KxuFHBwqi0aY32brWzyRZazbKlv94KYnJjP Bch6JP8XM0XIYSb5NpECYTtn1A== X-Google-Smtp-Source: AK7set+RUAUcoLYSoBP/GpqNloklYT61Pcwdm3S6pccP6ySG9Lt6wUWax8Gho7oJN897Iy82IushWw== X-Received: by 2002:a17:903:41cc:b0:19a:9269:7d1 with SMTP id u12-20020a17090341cc00b0019a926907d1mr2937874ple.4.1676474669132; Wed, 15 Feb 2023 07:24:29 -0800 (PST) Received: from localhost.localdomain ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id jh12-20020a170903328c00b0019682e27995sm6176997plb.223.2023.02.15.07.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 07:24:28 -0800 (PST) From: Qi Zheng To: akpm@linux-foundation.org, vbabka@suse.cz, david@redhat.com, rppt@kernel.org, mhocko@suse.com Cc: willy@infradead.org, mgorman@techsingularity.net, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [PATCH 1/2] mm: page_alloc: skip memoryless nodes entirely Date: Wed, 15 Feb 2023 23:24:11 +0800 Message-Id: <20230215152412.13368-2-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230215152412.13368-1-zhengqi.arch@bytedance.com> References: <20230215152412.13368-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 6112F12001D X-Stat-Signature: 1z7sj6bffowccb7apiwn5sw3bqgte9pw X-HE-Tag: 1676474672-247939 X-HE-Meta: U2FsdGVkX1/FSdLOs1QGR3+pcRk6F1m8qnTpirHiCUHgVkdZHCegF97URVb2juUx7PAZo0c3TwIKyu7fV+tyNprAERSVBBm2GXN0AwbClDxjdUrLs9PoRcr90jqus3gAWYG4w5Zk0zi3bQiwU58cEs1Xrdu0IRwOPTzFLlwbncHw5fM5Tt6K8/4N+ZjsVNelNQq15E8e1yNrsimSrCQvzoiMf/VunED3lv804tLD4Fn/P+bc+lRMnXhQisryrMu3uW17ZSrv3VL7yRzzTxPzC8o9NjrVeU+iWsIXg2FC/vZxPbpyNuXnfdyeayYj1DL5OsTSFOI2yz5y+E8xINBi5GfcSEeVR4Gmf5QC++APm8mGltJe7NJSPZMK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2TmUOWZDQAplx72HO1uqpv/y+Ebca04eD/5LzIwphVJl07pEwxvr0g7bm7uf9pVgiNid66mfAXgLG1ytw== 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: In find_next_best_node(), We skipped the memoryless nodes when building the zonelists of other normal nodes (N_NORMAL), but did not skip the memoryless node itself when building the zonelist. This will cause it to be traversed at runtime. For example, say we have node0 and node1, node0 is memoryless node, then the fallback order of node0 and node1 as follows: [ 0.153005] Fallback order for Node 0: 0 1 [ 0.153564] Fallback order for Node 1: 1 After this patch, we skip memoryless node0 entirely, then the fallback order of node0 and node1 as follows: [ 0.155236] Fallback order for Node 0: 1 [ 0.155806] Fallback order for Node 1: 1 So it becomes completely invisible, which will reduce runtime overhead. Signed-off-by: Qi Zheng --- mm/page_alloc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0745aedebb37..f0b17dd71bec 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6377,8 +6377,11 @@ int find_next_best_node(int node, nodemask_t *used_node_mask) int min_val = INT_MAX; int best_node = NUMA_NO_NODE; - /* Use the local node if we haven't already */ - if (!node_isset(node, *used_node_mask)) { + /* + * Use the local node if we haven't already. But for memoryless local + * node, we should skip it and fallback to other nodes. + */ + if (!node_isset(node, *used_node_mask) && node_state(node, N_MEMORY)) { node_set(node, *used_node_mask); return node; }