Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1689728pxb; Fri, 26 Feb 2021 19:11:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3qPiV6EQ80lZR3I8MTFAhKL67OcRPmK0qfHjc7BR7IMjBKPCsC5OpIGUvyKabPZTjMqNq X-Received: by 2002:a17:906:4f02:: with SMTP id t2mr6374622eju.121.1614395464528; Fri, 26 Feb 2021 19:11:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614395464; cv=none; d=google.com; s=arc-20160816; b=IrS4RXY/d+qshgt9slcGQXhhB3CtEgEqVLhsHzOMJtzHw7JKkKVmcGsKDHQEwAmYgO kPY3gKQVdJVx4hAsoFpcfRELvPfCYDQDxaPTplZ1y0n7c9V4jxugLdPkz1l+l3bahUYp U3JC0aAIhtStGH9sjjiW3wCt0vnX5e30f+UDx5YRrGkpEr1+X/OTG6koWBE31yQPPVvG HK0Ru2LJIVtPqWwJnNqwaI7lqlw4swNrjCjv59v79zwqQjYWwixQzRf4tcvvouJIyE9w bU79cNaPqhS9LPBGsbtPCA/KsN15YIEtWunIKt7h5MAmWeSToe9Xf/zMRjQn2MUpLenc 4KxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:cc:content-transfer-encoding :mime-version:message-id:in-reply-to:subject:date:dkim-signature; bh=CErTn4OA/0ZhE2vq/HB1zN/NVtPl48RSykIsKZFvFZQ=; b=rfsZ9i+EBs6Ujw4tUtP+xKQDFZjQHEKp565MWIGrBZJ0uhem8W3CnkS32VCR0TSod7 oy24D0Y5MkfuCS/yL1wW9Z5wTuoClmzhGrq+8D83+/bkp0wGAsDDJbwduaImp2F02w9/ o38IM8nfqVceTPM/bFdob2I0mKNkp+OqBaf1K3Ai7SIwk9wjMCBGAvBvknSGsrH+KMcl g1FEe5BIKxhk7QjwVUyGjSZq1ZfOWzZc/dAfivEhxNKCCsxNeoqU/5UE1KmG46bnRI5s D6/6v0KBacAMKFr4NwjPpX90oZ6fpKSsMUg9ffufJjFt4diSxsjlp/zURbqkxk7xzS7+ Heig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=z8KY6PvL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q23si8006038edb.379.2021.02.26.19.10.42; Fri, 26 Feb 2021 19:11:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20150623.gappssmtp.com header.s=20150623 header.b=z8KY6PvL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbhB0DG1 (ORCPT + 99 others); Fri, 26 Feb 2021 22:06:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbhB0DGZ (ORCPT ); Fri, 26 Feb 2021 22:06:25 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2FBBC06174A for ; Fri, 26 Feb 2021 19:05:44 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id 17so6280220pli.10 for ; Fri, 26 Feb 2021 19:05:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20150623.gappssmtp.com; s=20150623; h=date:subject:in-reply-to:message-id:mime-version :content-transfer-encoding:cc:from:to; bh=CErTn4OA/0ZhE2vq/HB1zN/NVtPl48RSykIsKZFvFZQ=; b=z8KY6PvLZ5e2O8z3iDTzzfY7WlI/SjutcIjnorrbmHPIdXe5XqnJPxjg7nJcRCsNsW tGtmMpfr3Yvid44eWaBicqP8k7/ZgZ3BMMmWLsyBPn+OYkRlmxAOm8NWflTJWAEapWvH z8OKrar/3yErQxPQGu3342K3kmhrlWpok95Awh1z7WDi6n4FCC6/giCkF0HlvrUG3QPs 3N0Id0+WPrfvky+CAbEwIgHWJg59M5JqbpONJihiCvh5gHB4Xpl9m4CFjWw2E4f5IXPS uT74A/oP605z378Qt70h7SmfR2NC35CAZ3tP/z/sdmaJ/aX8lDx7n62EtLefWiKhiMvW q7Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:message-id:mime-version :content-transfer-encoding:cc:from:to; bh=CErTn4OA/0ZhE2vq/HB1zN/NVtPl48RSykIsKZFvFZQ=; b=ltkfErTBZgMBDUka/rMz01WKa46nkr6+uQght0Cqp8ASGxpcbxD4tm4kKXV/RRRBk7 4bMlHkcEoPYgT1RfKtWjeYr4Sgix0WXdk/WdHIJLj1M0a1x/2LAazt8qbcGk7zC2Ovi3 eIsNOgpe5cywE042U8ys138XPpeyviiJwEK/rTpW/kfH9FmKlEiPf0/8+b/QpQ/egaYb nDENhgut0AbNWanvp9ds58s3tCfnnGzqJOnaBpm+4bj3phNr3UI1Hn5EEmZdsb26Fp2e WTtG4vzedsVBKTrBLjDDgWqpLngHVtyJFrx2OocOSKd4BVU9WGv3+RR7bTXpLQuW49Cy TIkA== X-Gm-Message-State: AOAM531CIEx5Jc0NYN1GyZceMpyhgjAIhqazr4CsHu7yCslG/Zhymg0s /AOauch4FKyF7MwVQj8I0lxv1Q== X-Received: by 2002:a17:90a:e2cb:: with SMTP id fr11mr6489864pjb.2.1614395143997; Fri, 26 Feb 2021 19:05:43 -0800 (PST) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id e129sm11103372pfh.87.2021.02.26.19.05.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 19:05:43 -0800 (PST) Date: Fri, 26 Feb 2021 19:05:43 -0800 (PST) X-Google-Original-Date: Fri, 26 Feb 2021 19:05:09 PST (-0800) Subject: Re: [PATCH 1/2] mm: Guard a use of node_reclaim_distance with CONFIFG_NUMA In-Reply-To: Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit CC: akpm@linux-foundation.org, atishp@atishpatra.org, peterz@infradead.org, srikar@linux.vnet.ibm.com, valentin.schneider@arm.com, vbabka@suse.cz, mpe@ellerman.id.au, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@android.com, kirill.shutemov@linux.intel.com From: Palmer Dabbelt To: hughd@google.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Feb 2021 17:31:40 PST (-0800), hughd@google.com wrote: > On Fri, 26 Feb 2021, Andrew Morton wrote: >> On Fri, 26 Feb 2021 12:17:20 -0800 Palmer Dabbelt wrote: >> > From: Palmer Dabbelt >> > >> > This is only useful under CONFIG_NUMA. IIUC skipping the check is the >> > right thing to do here, as without CONFIG_NUMA there will never be any >> > large node distances on non-NUMA systems. >> > >> > I expected this to manifest as a link failure under (!CONFIG_NUMA && >> > CONFIG_TRANSPARENT_HUGE_PAGES), but I'm not actually seeing that. I >> > think the reference is just getting pruned before it's checked, but I >> > didn't get that from reading the code so I'm worried I'm missing >> > something. >> > >> > Either way, this is necessary to guard the definition of >> > node_reclaim_distance with CONFIG_NUMA. >> > >> > Signed-off-by: Palmer Dabbelt >> > --- >> > mm/khugepaged.c | 2 ++ >> > 1 file changed, 2 insertions(+) >> > >> > diff --git a/mm/khugepaged.c b/mm/khugepaged.c >> > index a7d6cb912b05..b1bf191c3a54 100644 >> > --- a/mm/khugepaged.c >> > +++ b/mm/khugepaged.c >> > @@ -819,8 +819,10 @@ static bool khugepaged_scan_abort(int nid) >> > for (i = 0; i < MAX_NUMNODES; i++) { >> > if (!khugepaged_node_load[i]) >> > continue; >> > +#ifdef CONFIG_NUMA >> > if (node_distance(nid, i) > node_reclaim_distance) >> > return true; >> > +#endif >> > } >> > return false; >> > } >> >> This makes the entire loop a no-op. Perhaps Kirill can help take a >> look at removing unnecessary code in khugepaged.c when CONFIG_NUMA=n? > > First lines of khugepaged_scan_abort() say > if (!node_reclaim_mode) > return false; > > And include/linux/swap.h says > #ifdef CONFIG_NUMA > extern int node_reclaim_mode; > extern int sysctl_min_unmapped_ratio; > extern int sysctl_min_slab_ratio; > #else > #define node_reclaim_mode 0 > #endif > > So, no need for an #ifdef CONFIG_NUMA inside khugepaged_scan_abort(). Ah, thanks, I hadn't seen that. That certainly explains the lack of an undefined reference. That said: do we generally rely on DCE to prune references to undefined symbols? This particular one seems like it'd get reliably deleted, but it seems like a fragile thing to do in general. This kind of stuff would certainly make some code easier to write, though. I don't really care all that much, though, as I was just sending this along due to some build failure report from a user that I couldn't reproduce. It looked like they had some out-of-tree stuff, so in this case I'm fine on fixing this being their problem.