Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3073880rwb; Fri, 2 Dec 2022 21:31:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ByuZovSZza45jGva1ePvylIs8WMkD5wPXUXHgravW2FeZSRtYJ/nSJ60O5rWyds8JUqR1 X-Received: by 2002:a17:902:e313:b0:189:aee3:a185 with SMTP id q19-20020a170902e31300b00189aee3a185mr13859617plc.21.1670045482819; Fri, 02 Dec 2022 21:31:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670045482; cv=none; d=google.com; s=arc-20160816; b=jsvemZvZviQ3lhEofOuqETYnRCGLYHEJlj54fbbH6Q3+enGzocX3U3N/70bFtYjhUu qaiNEjIFM3q+EuR9qy+X4E2mMfOx6DQM7o3/KcPKqlEIILABPgIO2IRKr8osT445ELTW mMHlS1064yiNLZrOrLm9hjyjrtQY5xmR1TO/OWp1omDgSFXdtQgLpm4LxTc2YpMPvIBU 8iUvCsOFXbVCzxpiL+s+Ip2iLuE30E5ApUfMIuVmxKpg0+ttj80h3Au5cjgwLA2LgzR4 csQuYWtx+bSa9Lp/f0CTh3ZVZYkFykCTAWEIeOo0pkmRfHXlhd/InJWNqSjIkTVdhsaI QQnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qi0pNA3Q5CNsznnROY2eCNx9atd8tn83Rm2Xt6waJfY=; b=UzbSwL+6nXhGkWkK8eL3OR7crckwJD7GcyZnMt5/JoqG3+PApit2tEDmIyd5tyVuyA ULHLlqJHhrSTrDZ6jz7ugtk1XG3BpYIk0fqa1u1v0ZVoqYdEienWxrKYWBNnSLVfvq/m DbpNzt57U439mDafLZC7DzDWCfiO/OOMB6WpPvriBMG9AvutkKfeK187J1/tY1QZB4Z1 ZQCCjRzZ1glt6ZjR26tanwyI5zhSG7WcrlttQNny3/339D9+NCVChvtroQuYYKAUr3Nx o8UNXZsvlw+7k4UT/hm9oSxx8/0CZTUQrXirCFk4zq+8RT4w2bw7BDvSzZqMdTSuDZvk 3WrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=C2GhGcqY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h9-20020a63f909000000b0046ffe3fea86si9043345pgi.97.2022.12.02.21.31.06; Fri, 02 Dec 2022 21:31:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=C2GhGcqY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230169AbiLCDpA (ORCPT + 82 others); Fri, 2 Dec 2022 22:45:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbiLCDo5 (ORCPT ); Fri, 2 Dec 2022 22:44:57 -0500 Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71A576147 for ; Fri, 2 Dec 2022 19:44:52 -0800 (PST) Received: by mail-vs1-xe2a.google.com with SMTP id b189so518813vsc.10 for ; Fri, 02 Dec 2022 19:44:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qi0pNA3Q5CNsznnROY2eCNx9atd8tn83Rm2Xt6waJfY=; b=C2GhGcqYBjF714vnbg1onPOwrgYHVSpsbk635fMwpnqLm6VP0p/V+npp5R6vbns98e 4llUvnvOVWjfBETWEzATzIZG/BSUjxGmJzIwXFZNFPvUndPB6c4JCLAa6QGKXPpKPbZP R7emqZFmQ+yLFRV/QyK4FBM3YwYVCnnG5SGW6QizjITY9EeNuxc3Upj9df79II2Ysyts Rjv/UMDEstas1y05v63jaGYLUeRWJ53wWM5TD4JPVyCeVyvGR5nUOVNzRb3bM9nSzyZa rCIMovzMprz1zqwG2s1BNdwhZPfi2s/ARxa1ZB06AN/DeYKvD6q+bTRpzTOutO42se9r wAsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qi0pNA3Q5CNsznnROY2eCNx9atd8tn83Rm2Xt6waJfY=; b=TowG+7qOV82z9k3za8NYBZih2GxaF10zr3YX3PVRc4FV8rTgM0TD0lOl0cU5e28bCu 9mNCwJ7RdJGhuu37x4xNr915NTBVarX7GBHEAYoxJJ+ZBnEmRFXTdCCIy+w2WVrFjMFu mJTfh/Fvm6Ri+W2aitKbOC5YnekbX+MD5jG/QIIK7NRgoHeSYQAJrcm5xDZiFlG15Wz+ SY6d7Au9bjyY719v56pezau+fJB1zyGs+cseuuSyQTVQH7iAX9RZTSArl506tGwR6v2d vlypUKI1p/n3+iQ78h8f3KToSMv4d+MR3fXiIA7Lehi8Mt69ANw5HIBaOI7EmaW/5Dlp R3Iw== X-Gm-Message-State: ANoB5plv5jibAy4Vqu2idlCq8ETzZqYQImMOLdQdY6snBTjTblSg+Gyx LNvL3mBEBa+MP0Yo38TlMoXYYQ/3xrD46FOn9R95Eptf8k1nuA== X-Received: by 2002:a05:6102:54a5:b0:3b0:7462:a88c with SMTP id bk37-20020a05610254a500b003b07462a88cmr26789718vsb.49.1670039091500; Fri, 02 Dec 2022 19:44:51 -0800 (PST) MIME-Version: 1.0 References: <20221202141630.41220-1-tcm1030@163.com> <20221202115954.a226f8ef3051266d04caff54@linux-foundation.org> In-Reply-To: <20221202115954.a226f8ef3051266d04caff54@linux-foundation.org> From: Mina Almasry Date: Fri, 2 Dec 2022 19:44:40 -0800 Message-ID: Subject: Re: [PATCH] mm/mempolicy: failed to disable numa balancing To: Andrew Morton Cc: tzm , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mel Gorman Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 2, 2022 at 12:00 PM Andrew Morton wrote: > > On Fri, 2 Dec 2022 22:16:30 +0800 tzm wrote: > > > It will be failed to disable numa balancing policy permanently by passing > > to boot cmdline parameters. > > The numabalancing_override variable is int and 1 for enable -1 for disable. > > So, !enumabalancing_override will always be true, which cause this bug. > > That's really old code! > > > --- a/mm/mempolicy.c > > +++ b/mm/mempolicy.c > > @@ -2865,7 +2865,7 @@ static void __init check_numabalancing_enable(void) > > if (numabalancing_override) > > set_numabalancing_state(numabalancing_override == 1); > > > > - if (num_online_nodes() > 1 && !numabalancing_override) { > > + if (num_online_nodes() > 1 && (numabalancing_override == 1)) { > > pr_info("%s automatic NUMA balancing. Configure with numa_balancing= or the kernel.numa_balancing sysctl\n", > > numabalancing_default ? "Enabling" : "Disabling"); > > set_numabalancing_state(numabalancing_default); > > Looks right to me. Mel? > Maybe I'm missing something, but it looks wrong to me? numabalancing_override is default initialized to 0, I think, indicating that no override exists. numabalancing_override == 1 indicates it has been overridden to true. numabalancing_override == -1 indicates that it has been overridden to false. The above code reads to me: if (override_exists) set_numabalancing_state(override_value) if (num_online_nodes() > ! && !override_exists) set_numabalancing_state(numabalancing_default) A more clear fix for readability would be an early return between these 2 if statements I think. > After eight years, I wonder if we actually need this. >