Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp923509rdb; Wed, 1 Nov 2023 06:47:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMrE8D1ZdkN1LdFIvT8dgCK/LkwG9QFaUlUh7oD2ycZiuwesuvU6lqqpcwoWMMH3mf9fM+ X-Received: by 2002:a05:6a20:e106:b0:128:ffb7:dcfe with SMTP id kr6-20020a056a20e10600b00128ffb7dcfemr8235838pzb.1.1698846475519; Wed, 01 Nov 2023 06:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698846475; cv=none; d=google.com; s=arc-20160816; b=SPg/pNu3p/FC+4DXeYNZ2dyCa2KuISPkAS7V8NuLu4zoe1HlLGIY2X2x8J9M5KnD1d IIwofS9hJsSF9m+Cyp16PMwL4/LhDSYI/WBgw62sSnUyylTvUBm5bu1BTHq1I/tIooZV 9rgtOinltZTHYN+n2NACrMQAgcw8icncfq+ReW8Waj+8MiGJ3kzZvRYalmFlbyGglTK4 IbyMlsGjJu5nIPCmcrxg6N36OFLREWD5xqGLv466Fa6DqinWIvRW5DXX8t7j/JpWmlIA gyGg/Hxqcvr1PD3hc53fqpAYNiaBBz6SjuVwQVqapsH8/fZ7sbJ/F4iuRdS0hlsofpMJ /xwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LtTK0Ve9fvHJNOvzcaEqD249pBo2083iZ5qPSdDbfNg=; fh=69xE6aTFDK8ldYwWkp0RFdPiRhsMoPZOYNUHWFIPs+8=; b=BaBTGhK0dCpTkI5bRWAGuMGPzIeVM8LHWW1x5LNKxUi+iXBGeVVvQxETJooPFw8agd +P2XoprzCIPVuvGLZMJOj3c8rzpm1vEn6kN0mDuBW8x1ue9BiLYo6Wvd/MpWOwY7BO60 xX2ZiXGvFCj74EK66X4O978N5WQN/YIG1Dqrm4lvkrQ0eSlwCuJM8PkpIq2QmwJPHjYa MIE8I3ChO6dqzWDOUA57f/YA6zNb+iKUbEeb96A/hehOZY+BFZkhK7xC7Fc8s6HPs1FF wny7V+ZfkVUAHg4/xf8aNos3nz9DsX+Ac7uPT4dKkLufqfg7vPpdHO9cG0I0S8XHC6hk qOOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cUZLQ1vk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bg27-20020a056a02011b00b005b96cbfacdesi3148339pgb.196.2023.11.01.06.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 06:47:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cUZLQ1vk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4E01480657CC; Wed, 1 Nov 2023 06:46:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231924AbjKANqB (ORCPT + 99 others); Wed, 1 Nov 2023 09:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjKANp7 (ORCPT ); Wed, 1 Nov 2023 09:45:59 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A91983; Wed, 1 Nov 2023 06:45:52 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 915CE1F750; Wed, 1 Nov 2023 13:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1698846351; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LtTK0Ve9fvHJNOvzcaEqD249pBo2083iZ5qPSdDbfNg=; b=cUZLQ1vk/TkzkU7BO5pKe0quxSNG7qmBe1s8JS2/aMYUlbVciyDV+aH9MBvOuPLYGg2mDS LWfrYX3AcMP8ctmtPeBhbRv3H/OdUj7gtHR3Gw9isyYROG/aWdhcIZHGXQnooTUqPl5Hzq KubDIt0MzJvAMAifOl3MRxJOpZ6iMho= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6954713460; Wed, 1 Nov 2023 13:45:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id FdHJF49WQmWPdwAAMHmgww (envelope-from ); Wed, 01 Nov 2023 13:45:51 +0000 Date: Wed, 1 Nov 2023 14:45:50 +0100 From: Michal Hocko To: Gregory Price Cc: Johannes Weiner , Gregory Price , linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, linux-mm@kvack.org, ying.huang@intel.com, akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, weixugc@google.com, apopple@nvidia.com, tim.c.chen@intel.com, dave.hansen@intel.com, shy828301@gmail.com, gregkh@linuxfoundation.org, rafael@kernel.org Subject: Re: [RFC PATCH v3 0/4] Node Weights and Weighted Interleave Message-ID: References: <20231031003810.4532-1-gregory.price@memverge.com> <20231031152142.GA3029315@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 01 Nov 2023 06:46:08 -0700 (PDT) On Tue 31-10-23 00:27:04, Gregory Price wrote: > On Tue, Oct 31, 2023 at 04:56:27PM +0100, Michal Hocko wrote: > > > > This hopefully also explains why it's a global setting. The usecase is > > > different from conventional NUMA interleaving, which is used as a > > > locality measure: spread shared data evenly between compute > > > nodes. This one isn't about locality - the CXL tier doesn't have local > > > compute. Instead, the optimal spread is based on hardware parameters, > > > which is a global property rather than a per-workload one. > > > > Well, I am not convinced about that TBH. Sure it is probably a good fit > > for this specific CXL usecase but it just doesn't fit into many others I > > can think of - e.g. proportional use of those tiers based on the > > workload - you get what you pay for. > > > > Is there any specific reason for not having a new interleave interface > > which defines weights for the nodemask? Is this because the policy > > itself is very dynamic or is this more driven by simplicity of use? > > > > I had originally implemented it this way while experimenting with new > mempolicies. > > https://lore.kernel.org/linux-cxl/20231003002156.740595-5-gregory.price@memverge.com/ > > The downside of doing it in mempolicy is... > 1) mempolicy is not sysfs friendly, and to make it sysfs friendly is a > non-trivial task. It is very "current-task" centric. True. Cpusets is the way to make it less process centric but that comes with its own constains (namely which NUMA policies are supported). > 2) Barring a change to mempolicy to be sysfs friendly, the options for > implementing weights in the mempolicy are either a) new flag and > setting every weight individually in many syscalls, or b) a new > syscall (set_mempolicy2), which is what I demonstrated in the RFC. Yes, that would likely require a new syscall. > 3) mempolicy is also subject to cgroup nodemasks, and as a result you > end up with a rats nest of interactions between mempolicy nodemasks > changing as a result of cgroup migrations, nodes potentially coming > and going (hotplug under CXL), and others I'm probably forgetting. Is this really any different from what you are proposing though? > Basically: If a node leaves the nodemask, should you retain the > weight, or should you reset it? If a new node comes into the node > mask... what weight should you set? I did not have answers to these > questions. I am not really sure I follow you. Are you talking about cpuset nodemask changes or memory hotplug here. > It was recommended to explore placing it in tiers instead, so I took a > crack at it here: > > https://lore.kernel.org/linux-mm/20231009204259.875232-1-gregory.price@memverge.com/ > > This had similar issue with the idea of hotplug nodes: if you give a > tier a weight, and one or more of the nodes goes away/comes back... what > should you do with the weight? Split it up among the remaining nodes? > Rebalance? Etc. How is this any different from node becoming depleted? You cannot really expect that you get memory you are asking for and you can easily end up getting memory from a different node instead. > The result of this discussion lead us to simply say "What if we place > the weights directly in the node". And that lead us to this RFC. Maybe I am missing something really crucial here but I do not see how this fundamentally changes anything. Memory hotremove (or mere node memory depletion) is not really a thing because interleaving is a best effort operation so you have to live with memory not being strictly distributed per your preferences. Memory hotadd will be easier to manage because you just update a single place after node is hotadded rather than gazillions partial policies. But, that requires that interleave policy nodemask is assuming future nodes going online and put them to the mask. > I am not against implementing it in mempolicy (as proof: my first RFC). > I am simply searching for the acceptable way to implement it. > > One of the benefits of having it set as a global setting is that weights > can be automatically generated from HMAT/HMEM information (ACPI tables) > and programs already using MPOL_INTERLEAVE will have a direct benefit. Right. This is understood. My main concern is whether this is outweights the limitations of having a _global_ policy _only_. Historically a single global policy usually led to finding ways how to make that more scoped (usually through cgroups). > I have been considering whether MPOL_WEIGHTED_INTERLEAVE should be added > along side this patch so that MPOL_INTERLEAVE is left entirely alone. > > Happy to discuss more, > ~Gregory -- Michal Hocko SUSE Labs