Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2781224rdb; Mon, 4 Dec 2023 07:23:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3aTRz+6EjsYtHHzPMNuhy2H9TM4Tb4C4OY2zL8sDtX4NO+nApK8U88tyz2PG3QcahHtva X-Received: by 2002:a05:6a20:914f:b0:18f:9c4:d332 with SMTP id x15-20020a056a20914f00b0018f09c4d332mr4661994pzc.34.1701703437876; Mon, 04 Dec 2023 07:23:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701703437; cv=none; d=google.com; s=arc-20160816; b=tObe1iIGF52vIKGMg0ygMvdTmy7N7sAPSYR6x0aqukbNSOkvSALwAG8KuXj7Y5GH4R kCBf1eLhbrQG2v8mcNHHvcThivkW0rlnuSDBtio2gy1ZD+ubJYv3XvGhTXYxTcEvYqEH 5nrfYt4ApSZNR06szCSZNyKP0XC+gM68nhkUnrZ6vTXAUvPxrSPAtUr9Ldv5X2hwpx/u 7lWpyiVkX3LWNe6NoDa03/OCB/EFR4PUFX77tuZsiVg5YEwE+AXGKoOrTqFWOFMPduz+ dwiUFd3jNEJUoPQEZ4LHblYqA2vAPZv43cfSlFuFWBIrlJt7d26vHTbI7vNGblMQQUHj oVcA== 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=MSfuO+OQqjKaU4tpQqlga4ZTtzNlctSschnkLgDRivg=; fh=w1rAr3qunbi6Q7l0H9ltPvT9IwmlSPr09EZ/VXRyRlk=; b=wIHGBaGI3qmk15yuSi7vJyRrNqFHu9V4orX9yju7G9jggCMTbu0ied+ErN8QMYLBJ4 Dx8sMycr3CrU/ihQe0wgwn6GbsdhCULliHmtDEBTsBOqdalhskdNNKzM/gdbFUY8Gu88 +fypBfM29gfZma8I3B0DvSMzIOHLo9buHLQT5HZ3jmLwhv3OrUY8YaGZEhqM647ea/U0 Rxl5RGLcYGtuluYMRACf+6tpKnwwimBbuWtHNdGn7ZNe7G6LbXki3z6rH5Sqv/R9HpGD aHGa/NHv58ZZSJ2jTbXOvda/B/rR0QGpU5v2Wpc4ldDleQDYMf2A7iOMlN00lCPB9sFp odSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="Qx435/8a"; 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 p188-20020a6342c5000000b005be2508ce03si8078580pga.569.2023.12.04.07.23.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 07:23:57 -0800 (PST) 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="Qx435/8a"; 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 F2E51804E83A; Mon, 4 Dec 2023 07:23:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234516AbjLDPXq (ORCPT + 99 others); Mon, 4 Dec 2023 10:23:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234119AbjLDPXo (ORCPT ); Mon, 4 Dec 2023 10:23:44 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2954CF2; Mon, 4 Dec 2023 07:23:50 -0800 (PST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6BC34220D8; Mon, 4 Dec 2023 15:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1701703428; 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=MSfuO+OQqjKaU4tpQqlga4ZTtzNlctSschnkLgDRivg=; b=Qx435/8aK+ZnOG7Hv2GM0J7AuyqsexLTDkphaopr7hyK/MeSQAylHN/RuGGYI0Te8D27OP TkCVr4PXQ502a7kEIJzauKJeTbOclWyNnnLMWI36eLvPhBGvBOCtJ9Z0C5BJZs6lf2EcWG FPRBE2s7R4YBMPA2g78KYOvPnbo+vFw= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 427FA1398A; Mon, 4 Dec 2023 15:23:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id feo9DATvbWUMUgAAD6G6ig (envelope-from ); Mon, 04 Dec 2023 15:23:48 +0000 Date: Mon, 4 Dec 2023 16:23:47 +0100 From: Michal Hocko To: Johannes Weiner Cc: Dan Schatzberg , Roman Gushchin , Yosry Ahmed , Huan Yang , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt , Muchun Song , Andrew Morton , David Hildenbrand , Matthew Wilcox , Huang Ying , Kefeng Wang , Peter Xu , "Vishal Moola (Oracle)" , Yue Zhao , Hugh Dickins Subject: Re: [PATCH 0/1] Add swappiness argument to memory.reclaim Message-ID: References: <20231130153658.527556-1-schatzberg.dan@gmail.com> <20231130165642.GA386439@cmpxchg.org> <20231201170955.GA694615@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231201170955.GA694615@cmpxchg.org> Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spamd-Result: default: False [-2.30 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-3.00)[100.00%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_TWELVE(0.00)[19]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_CC(0.00)[gmail.com,linux.dev,google.com,vivo.com,vger.kernel.org,kvack.org,linux-foundation.org,redhat.com,infradead.org,intel.com,huawei.com]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Score: -2.30 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 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]); Mon, 04 Dec 2023 07:23:56 -0800 (PST) On Fri 01-12-23 12:09:55, Johannes Weiner wrote: > On Fri, Dec 01, 2023 at 10:33:01AM +0100, Michal Hocko wrote: > > On Thu 30-11-23 11:56:42, Johannes Weiner wrote: > > [...] > > > So I wouldn't say it's merely a reclaim hint. It controls a very > > > concrete and influential factor in VM decision making. And since the > > > global swappiness is long-established ABI, I don't expect its meaning > > > to change significantly any time soon. > > > > As I've said I am more worried about potential future changes which > > would modify existing, reduce or add more corner cases which would be > > seen as a change of behavior from the user space POV. That means that we > > would have to be really explicit about the fact that the reclaim is free > > to override the swappiness provided by user. So essentially a best > > effort interface without any actual guarantees. That surely makes it > > harder to use. Is it still useable? > > But it's not free to override the setting as it pleases. I wrote a > detailed list of the current exceptions, and why the user wouldn't > have strong expectations of swappiness being respected in those > cases. Having reasonable limitations is not the same as everything > being up for grabs. Well, I was not suggesting that future changes would be intentionally breaking swappiness. But look at the history, we've had times when swappiness was ignored most of the time due to heavy page cache bias. Now it is really hard to assume future reclaim changes but I can easily imagine that IO refault cost to balance file vs. anon lrus would be in future reclaim improvements and extensions. > Again, the swappiness setting is ABI, and people would definitely > complain if we ignored their request in an unexpected situation and > regressed their workloads. > > I'm not against documenting the exceptions and limitations. Not just > for proactive reclaim, but for swappiness in general. But I don't > think it's fair to say that there are NO rules and NO userspace > contract around this parameter (and I'm the one who wrote most of the > balancing code that implements the swappiness control). Right, but the behavior might change considerably between different kernel versions and that is something to be really careful about. One think I would really like to avoid is to provide any guarantee that swappiness X and nr_to_reclaim has an exact anon/file pages reclaimed or this is a regression because $VER-1 behaved that way. There might be very ligitimate reasons to use different heuristics in the memory reclaim. Another option would be drop any heuristics when swappiness is provided for the memory.reclaim interface which would be much more predictable but it would also diverge from the normal reclaim and that is quite bad IMHO. -- Michal Hocko SUSE Labs