Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2423499rwb; Fri, 16 Dec 2022 01:40:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXt5tDmd/K5y35o2cSf89I9EgRoHRU/9r52Jj6lrCvaKJzGqpQtk1M2df9UZrT7wLPRYj5j6 X-Received: by 2002:a05:6a00:1d84:b0:57e:827a:52ac with SMTP id z4-20020a056a001d8400b0057e827a52acmr4497698pfw.31.1671183635483; Fri, 16 Dec 2022 01:40:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671183635; cv=none; d=google.com; s=arc-20160816; b=hgdaizK7qb/3zV11IpGUyLj/ZpDEt7NxOFe7tsnZ8OyZsZ1nsLLpzk9bAyrEsUB+Wf c/W2IhKod1kkorI2EZ2Sgy/aQOblz0f0Jb7y2sdnOTUlA/WndCb+m3DWJUvG3Xhk1G9U uaGRPuVIaHX2DgLVZc7w+MN75sw3+/UoyKG0AbYikVkMmmh5G+8fSyl4gyyGVwWFZ/uu WWKE9MXudwxhBJ/chPT+GN7j0Glew6qghNsQEeYgN92q/bPHrtZE9DSaMOJP5P3FFYlC LOC4jEqTcp9ehg/1L+Al86PlJxBqam8FeJbLR7Fc30GxNp/QUwOZAtp0w9bFLHRdOfT4 qkaA== 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=3nvimj2ZFEx9YlSQKEbscjAQshU+naWh0RT6szJpxbY=; b=Cj3e4xNQOaud2R4TOPxvPKGWVu/MUCzS4aDY0xzR2YgqNrwFX/+z4mR1clreeqabKJ THrTpydKeXCsaKfhCB4vBe7gj0uR24o64ev6kjIe+0gfUEJ//UJ8t5pw5rm07QvlV7sQ RWL0Dkr1vis1PE8rkMBtUU5+ZCT3N2VKswAK38SXWK3e+4WfoMBF/zf+JKXgajltD4to qbJ6qay18pRfgrUzq2CmNkTnPS8/XyQjE9W5n5Q/A9GCA6GWHvIJpuDVZJ9mwXg0r6NA xrP07CEx6Z5Jf8PDrL5YdSJD2oWxmaQTvJxM7DhRfO3nmVnAwLzQK5TOM+petdqpfq6N tprg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Bw8en1xm; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a056a00194d00b00557a43656c6si1870114pfk.109.2022.12.16.01.40.26; Fri, 16 Dec 2022 01:40:35 -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=@suse.com header.s=susede1 header.b=Bw8en1xm; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229788AbiLPIkj (ORCPT + 68 others); Fri, 16 Dec 2022 03:40:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiLPIkh (ORCPT ); Fri, 16 Dec 2022 03:40:37 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0184E36C50; Fri, 16 Dec 2022 00:40:35 -0800 (PST) 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 A2AD021064; Fri, 16 Dec 2022 08:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1671180034; 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=3nvimj2ZFEx9YlSQKEbscjAQshU+naWh0RT6szJpxbY=; b=Bw8en1xmr0xlc033t59Fmd9xvJ/ey7A/H7JtocX065COY8g9zeA9OnNx20n2Ecsfjj43n/ FWc+JP9gV724C3PypNeuOfBOmHNZKslYtZkGj1Kg9xqrZxwikmlBC/Kr73SRMVPlE6A53h 68JY5QsKr1zGoq1BIgq+jwbjwvzffq0= 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 8F403138FD; Fri, 16 Dec 2022 08:40:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IE7GIQIvnGM2NAAAMHmgww (envelope-from ); Fri, 16 Dec 2022 08:40:34 +0000 Date: Fri, 16 Dec 2022 09:40:34 +0100 From: Michal Hocko To: Wei Xu Cc: Mina Almasry , Johannes Weiner , "Huang, Ying" , Tejun Heo , Zefan Li , Jonathan Corbet , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Yang Shi , Yosry Ahmed , fvdl@google.com, bagasdotme@gmail.com, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3] mm: Add nodes= arg to memory.reclaim Message-ID: References: <20221202223533.1785418-1-almasrymina@google.com> <87k02volwe.fsf@yhuang6-desk2.ccr.corp.intel.com> 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 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 Thu 15-12-22 09:58:12, Wei Xu wrote: > On Wed, Dec 14, 2022 at 2:23 AM Michal Hocko wrote: > > > > On Tue 13-12-22 11:29:45, Mina Almasry wrote: > > > On Tue, Dec 13, 2022 at 6:03 AM Michal Hocko wrote: > > > > > > > > On Tue 13-12-22 14:30:40, Johannes Weiner wrote: > > > > > On Tue, Dec 13, 2022 at 02:30:57PM +0800, Huang, Ying wrote: > > > > [...] > > > > > > After these discussion, I think the solution maybe use different > > > > > > interfaces for "proactive demote" and "proactive reclaim". That is, > > > > > > reconsider "memory.demote". In this way, we will always uncharge the > > > > > > cgroup for "memory.reclaim". This avoid the possible confusion there. > > > > > > And, because demotion is considered aging, we don't need to disable > > > > > > demotion for "memory.reclaim", just don't count it. > > > > > > > > > > Hm, so in summary: > > > > > > > > > > 1) memory.reclaim would demote and reclaim like today, but it would > > > > > change to only count reclaimed pages against the goal. > > > > > > > > > > 2) memory.demote would only demote. > > > > > > > > > > > If the above 2 points are agreeable then yes, this sounds good to me > > > and does address our use case. > > > > > > > > a) What if the demotion targets are full? Would it reclaim or fail? > > > > > > > > > > > Wei will chime in if he disagrees, but I think we _require_ that it > > > fails, not falls back to reclaim. The interface is asking for > > > demotion, and is called memory.demote. For such an interface to fall > > > back to reclaim would be very confusing to userspace and may trigger > > > reclaim on a high priority job that we want to shield from proactive > > > reclaim. > > > > But what should happen if the immediate demotion target is full but > > lower tiers are still usable. Should the first one demote before > > allowing to demote from the top tier? > > In that case, the demotion will fall back to the lower tiers. See > node_get_allowed_targets() and establish_demotion_targets().. I am not talking about an implicit behavior that we do not want to cast into interface. If we want to allow a fine grained control over demotion then the implementation shouldn't rely on the current behavior. [...] > > Is there any strong reason for that? We do not have any interface to > > control NUMA balancing from userspace. Why cannot we use the interface > > for that purpose? > > A demotion interface such as memory.demote will trigger the demotion > code path in the kernel, which depends on multiple memory tiers. Demotion is just a fancy name of a directed migration. There is no realy dependency on the HW nor the technology. > I think what you are getting is a more general page migration > interface for memcg, which will need both source and target nodes as > arguments. I think this can be a great idea. It should be able to > support our demotion use cases as well. yes. -- Michal Hocko SUSE Labs