From patchwork Thu Oct 19 07:36:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13428412 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 DE3D3CDB465 for ; Thu, 19 Oct 2023 07:38:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D5958D0173; Thu, 19 Oct 2023 03:38:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 659AC8D0110; Thu, 19 Oct 2023 03:38:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F9428D0173; Thu, 19 Oct 2023 03:38:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3AC268D0110 for ; Thu, 19 Oct 2023 03:38:21 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 07CB312119E for ; Thu, 19 Oct 2023 07:38:21 +0000 (UTC) X-FDA: 81361408002.15.A63D1ED Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf17.hostedemail.com (Postfix) with ESMTP id 3AFFB40008 for ; Thu, 19 Oct 2023 07:38:19 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Nm6Wv32D; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf17.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697701099; a=rsa-sha256; cv=none; b=mGaqVOYXBZjZvloTg+KW3OST6U7cgOi4NsZbrgKoy0YN7TuRGqQcRFlHg9PGRhnFi6RZ8k 0yD8jHMl1pzVLLCbaRkI3T86cdWIXFE7iC6OQx8/+6qbQNxD0vG6UF38SCPGK1gN6GQhM3 IhJJ5Gixgr2T7jJtfdQiT5rjNlSR9jI= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Nm6Wv32D; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf17.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697701099; 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=6cxQgxjhn9SWJh0Wr98V4tbQtLJu0AylqKOEAskAE6c=; b=voNde+KMyISHzC3jwfIhDZCBOpjT0+AJIPVpRuWmPB+nJKsyErYa64bIxvv0eBw7EvXps1 p/68NvmFZFpUFE28nJgS3UDnfLERW34sYp4iwW6SI/zglTC2L9RkM+KpwkQx4EaTxgNktW 8pwBgr/WhPKrkuv2ohBp5MDgfONmBeg= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1ca79b731f1so8971735ad.0 for ; Thu, 19 Oct 2023 00:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1697701098; x=1698305898; darn=kvack.org; 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=6cxQgxjhn9SWJh0Wr98V4tbQtLJu0AylqKOEAskAE6c=; b=Nm6Wv32Dsq0tTOk4a8HrQLvMfuOaEMZyznZiWg6C5AQu7MqR9DWt+g+bKhVTK4d7ul cTqgLRRXrvAh46n6QoHSX3Ba4BvpPdLyu6UcG3IdPO+J+iFHIKtW1AfoO3m5ah3f9IMf C6GPltoeBJW4nAWmRHjv9RTZdXFXb+vCMnz7KbN2cuBzLiOPnTHaukDrge/hdtk/lFaF xJ4Knj/o1mVTX+t4krqAgnwBpd8z4IlNYQxB1Um/tN76HH1HC8zqEhf7BPMvpxfc3TId KDWzUVOqAol4oCh4ofnau5eKIRtRTEiAuPLlYH68nq/LOWtzdvm21/sEv6I3xAsuy/ZR uguQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697701098; x=1698305898; 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=6cxQgxjhn9SWJh0Wr98V4tbQtLJu0AylqKOEAskAE6c=; b=VwfsI5ktwQI3URUQcicNJdSHwuq6h/hclcLhr0nSyNvjVZeHq47y3vAQnDNLVA3MOI vzA/lBwhqo0i9948WdGv3//f8v20idDYFQ221vUtJSCZgFa1+K5r47tWRu2aerGwEmLE HkishC92VzzZzX/jKWVgUzLmdLROqoftKK3cTubsmqhr1mZEHE22N2GZUV7q85fv5/sa pJfj9RpbD7RRhJB8nJEDYpzzI4RaMtKeVIkEIBhYrcaRcrKKGXWCM4uiDR349muBvuLV q4rsEyuQyUwVBZI0X3VN/0geEhKb0f80DFtmFnvG0VU7JJ0ieKy7A/AczOMUcqG0iyCH 32nw== X-Gm-Message-State: AOJu0Yzxy2i/vFF3TdY0NwLNlzwN+rxRRkUsq/WOzF0pXbu9xT2gno3H +RgoaLIRTzvwuUj+vnJIH8bT8g== X-Google-Smtp-Source: AGHT+IGvwXjKO2gI3oQizjHqmOSqlFdkK+0M6Y0XsSvKGyl352MhRurSwVqrutcSYvAcfs/K9fOVcg== X-Received: by 2002:a17:903:705:b0:1ca:273d:232 with SMTP id kk5-20020a170903070500b001ca273d0232mr1566517plb.0.1697701098152; Thu, 19 Oct 2023 00:38:18 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id d9-20020a170902854900b001c5d09e9437sm1194306plo.25.2023.10.19.00.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 00:38:17 -0700 (PDT) From: Qi Zheng To: akpm@linux-foundation.org, rppt@kernel.org, david@redhat.com, vbabka@suse.cz, mhocko@suse.com Cc: willy@infradead.org, mgorman@techsingularity.net, mingo@kernel.org, aneesh.kumar@linux.ibm.com, ying.huang@intel.com, hannes@cmpxchg.org, osalvador@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Qi Zheng Subject: [PATCH v2 2/2] mm: memory_hotplug: drop memoryless node from fallback lists Date: Thu, 19 Oct 2023 15:36:27 +0800 Message-Id: <32c12381941f347ebafb9cb5bc9f0a4a535ff646.1697687357.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3AFFB40008 X-Stat-Signature: ge17b4nwzdn453rjcnez59btffc4t73x X-HE-Tag: 1697701099-701091 X-HE-Meta: U2FsdGVkX18ypUrCV7lixmX2vpMWCdExWPRGO9ZJ4au6OG4dXK4eprXRARdrykzNUnolgVeSUhGFCBG/dbqMFGs3mvu2WDHuBAl45pHGUt99rFB7v7O/HUk3KW5L69ymw8beT1gHcI84pmykAolea1TuSneMSRHOK45zzVcmylgO5J67caDRIlTg2If0stNhHWTFMFuizpvELRPfOOv4bgSKWEXQBrGgdXAOM878xLNAwq6F2Y1yfBCxsFYjohbMnYYzHeiYnmbbD4lJAJuGIFA+4oSY9TSPlDGgvA8FzAIXKCjx+DPVd4qXDLXwdxYUbF6b9jQorndzs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IPvjSq7gYkK+nfUZxPgF4FX0H9ZaTtVXqDd+TVLGmFzuWQ== 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 offline_pages(), if a node becomes memoryless, we will clear its N_MEMORY state by calling node_states_clear_node(). But we do this after rebuilding the zonelists by calling build_all_zonelists(), which will cause this memoryless node to still be in the fallback list of other nodes. This will incur some runtime overhead. To drop memoryless node from fallback lists in this case, just call node_states_clear_node() before calling build_all_zonelists(). Signed-off-by: Qi Zheng Acked-by: David Hildenbrand --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index d4a364fdaf8f..18af399627f0 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -2036,12 +2036,12 @@ int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages, /* reinitialise watermarks and update pcp limits */ init_per_zone_wmark_min(); + node_states_clear_node(node, &arg); if (!populated_zone(zone)) { zone_pcp_reset(zone); build_all_zonelists(NULL); } - node_states_clear_node(node, &arg); if (arg.status_change_nid >= 0) { kcompactd_stop(node); kswapd_stop(node);