Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1191379rdb; Fri, 1 Dec 2023 09:11:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+737caH5kpYzIpQQR4PGAdqJMKfmH2+QfVDR0iHV6FY7R/MbfPTAPWNL70hHdc0bubJCZ X-Received: by 2002:a05:6a20:7493:b0:18b:9031:81a4 with SMTP id p19-20020a056a20749300b0018b903181a4mr26776592pzd.47.1701450669669; Fri, 01 Dec 2023 09:11:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701450669; cv=none; d=google.com; s=arc-20160816; b=GpYfh/xZaGHDHLT1GKQ+eWGrdjHRM+tjWcVk7bWaZrHbjQ8GQufCe1+eG+J0iV1HQi 5K3+zn6hvbyh9qQZJ7tjJdz81zuRzS/zlnIRa43hVLCr9It2U/hunqYy8/SFXpCSyGkE HxnhRAAvd8Oq9rQezb5I3x+saJ8ohF3Fk+M9KtO+tsZ6k5pP8YrGusZT6FByTJ5y1CQf 816lmcbxwGbuqerXDTC8qUhkrFO/T9GuoJnEDZBkZhi7BPHQ7GlRG+YPjJw8KAWb5Wm0 hm7rg4BODSoKbFdZogRtBwceYG9MLLu2f+UYcQB1Swh7+5VxvW5zmArtjDlx5puecoeb 4Dmw== 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=UHSBlrWKXm1wAl594fX7qblvpqL30ZdbgTyCgGt+Df8=; fh=A2+EB2fJr1mi0DM5boaEk/NqsHw0b0zooH+NWDHiYrM=; b=b2doSQFe3fIdXQR4Sa4dro+UPDUBqWqqIxEvz1R20bjtDaHtUyVhAGgZHQusskVGUt iVM9V/sIlyvy/Y1qyw+loe2vf9udHWQaPj7khc72jEOkzyQSZti9BU7D4EdKs6IaznSC a/J245JZWalQxABKj3IFBifDd9T6eLM9U88yeEdeXjR+2CGDwHc6u4Un9dePsCCqF/Rj IoYQMTVtzCHwg8FoKAZ3x3LoNw8r/n2LeC8jBqC48z2lXGd39vEjKKMF3nXNIEDCAj/z 0yTWDHevc1BiOCK7cIJocIl6KuR9aTnvf50e8+iKW4b1uAN0IjSQplYLrqpALCvF4oOp LoiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=nCVmDprT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k4-20020a6568c4000000b00563f72935e3si3543344pgt.608.2023.12.01.09.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 09:11:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=nCVmDprT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C90D1807C5FA; Fri, 1 Dec 2023 09:10:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229795AbjLARJx (ORCPT + 99 others); Fri, 1 Dec 2023 12:09:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbjLARJw (ORCPT ); Fri, 1 Dec 2023 12:09:52 -0500 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9A3F197 for ; Fri, 1 Dec 2023 09:09:57 -0800 (PST) Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-67a959e3afaso4797626d6.2 for ; Fri, 01 Dec 2023 09:09:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1701450597; x=1702055397; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UHSBlrWKXm1wAl594fX7qblvpqL30ZdbgTyCgGt+Df8=; b=nCVmDprTxS0ZF+WtC5Pq/FiUtgi4HPiOKYuOq2vWTzMYbvdNkl4JEHP7OtLBdPXo7T iilMMPXDJLV8dsPsIDuI42FKpzZ56yq1Kagf9BurUQhXV1WnXkCXp2rDqGPAZMihvSNF DuEAYAcKdtP0+nqyVOlQ+zYeiFmudCDUkZQd6Ohm0t0NG3OnXX+DOvKhe/Htq61GHj14 OiJK38WTkXvCcJMhBVYRte4rN1kcvcRGnzRaEqgIwck4Vjg+OIzV2OU5pNOG2WO3vO9y rhl76JxPT9wpyUzVzZDN3SYnqLg3qM15F4YMGlGzatq7EwNCwfAd66z+i3pJkBdFK8sO eKrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701450597; x=1702055397; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UHSBlrWKXm1wAl594fX7qblvpqL30ZdbgTyCgGt+Df8=; b=UEzVFSKgrdC5zYmCZI3A6JTUolHmKvkf1nStSzdy2m7Cfg6Vio0Txbj8R6SQVfzrHh BlgYURR1jjeysGSGUvBf+go47tzOpNzUTHujgLdfySrkJl2yq7kt40S8I+6TSc1o0aZc A92j3gbLtqRILjGPileS+hZ3mPE2Ap312n9v4s2CH/nH3clZDqSb7Da93dXiyEuv4iEn WIxv6QuIih1F1PDV+TJSGratuUrbgBrsih9AYk4q3iukFGHM1yDPt6qwQkpOvnsZGEV/ MbbmpnigcHjP3ec/Bm91/JN7lF/3EGqocgxrNjPtmIkzD92nFsaBmaRKcz8EiTV9rK4E L+jQ== X-Gm-Message-State: AOJu0YzR6cPnNxH+CFYHuiZLk/aDLBY8DiqLo5i/s0B3dlThKp2MZzdb cCw36GbhInW/U7IiTLsgbqCL+A== X-Received: by 2002:a0c:e90e:0:b0:67a:fd5:24a9 with SMTP id a14-20020a0ce90e000000b0067a0fd524a9mr30266352qvo.19.1701450596905; Fri, 01 Dec 2023 09:09:56 -0800 (PST) Received: from localhost (2603-7000-0c01-2716-da5e-d3ff-fee7-26e7.res6.spectrum.com. [2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id du5-20020a05621409a500b0067aa28ac616sm255221qvb.113.2023.12.01.09.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 09:09:56 -0800 (PST) Date: Fri, 1 Dec 2023 12:09:55 -0500 From: Johannes Weiner To: Michal Hocko 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: <20231201170955.GA694615@cmpxchg.org> References: <20231130153658.527556-1-schatzberg.dan@gmail.com> <20231130165642.GA386439@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Fri, 01 Dec 2023 09:10:09 -0800 (PST) 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. 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). So considering what swappiness DOES provide, and the definition and behavior to which we're tied by ABI rules, yes I do think it's useful to control this from the proactive reclaim context. In fact, we know it's useful, because we've been doing it for a while in production now - just in a hacky way, and this patch is merely making it less hacky. > Btw. IIRC these concerns were part of the reason why memcg v2 doesn't > have swappiness interface. If we decide to export swappiness via > memory.reclaim interface does it mean we will do so on per-memcg level > as well? Well I'm the person who wrote the initial cgroup2 memory interface, and I left it out because there was no clear usecase for why you'd want to tweak it on a per-container basis. But Dan did bring up a new and very concrete usecase: controlling for write endurance. And it's not just a theoretical one, but a proven real world application. As far as adding a static memory.swappiness goes, I wouldn't add it just because, but wait for a concrete usecase for that specifically. I don't think Dan's rationale extends to it. But if a usecase comes up and is convincing, I wouldn't be opposed to it.