Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3535728iob; Tue, 17 May 2022 02:05:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIFErVf3Zdk3AojANe5+Ocbv8WRjcLCor4/IcNFKciejcJen30of7+flJ/jI43e/vkGsAK X-Received: by 2002:a05:6a00:1c5c:b0:505:7469:134a with SMTP id s28-20020a056a001c5c00b005057469134amr21660373pfw.16.1652778335434; Tue, 17 May 2022 02:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652778335; cv=none; d=google.com; s=arc-20160816; b=r9H40PmS+qn0rIhOPFq1gCmGX3eQ+gHEOcVznauEUdKJnIdwl2R1JRm0+acIl/a2yS /x3DhQZEMiIRvBgOnDQxu5EGD2hcvKQOqrWB/P3eMMzgSRQYYf3YlnyNqU9+JPbWSxUa c9gpX3OPvDS0O44Jlqnu3SyZG6pOxE2blrqnur188DeSChNtCVTBfCiEUxNOtDn60F2U F9XaKvHtQ/5tC3alcUXUVGpFlX8E+br6BWHxdF0na8KVvo5RfVG5H25xWbZQkWtF6JOj DoFVH27Yhi9KwX2UbMMn6WW0pUmMSCeAFr4J6xhoDQbwoVDCCVSjGLzcmHE6vQriMVPZ cEJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=W7ceyTjxid5l9ZGGTqZ+wt/EPfbFdKSX+/F4lyNdDKg=; b=tYB/KQBux+RBbirzOA8eW8z/fWHzJ1BVxdCMCJJ5g35PJCAR++fx+xflb3XTCdshHG UXClbTOx0STso7yIgeA4a9Tiooe9x0Q+6z8+Ms+L3UZxG2BxGNU3jZICxb8gZ0pBh+ka e5lLEpMU6icFFCko9wxvs/j/Y8RcR8rOyNENG0rUU9M68zD1zxu/OXY4q34xCuum5F4g BYh2g5zjFlKz+W7czu9fuBDmg7lzYsdt7UsE1UY+35GNk0u7OKXxB3oMvVabMEA2hSid 53o3CfdJXl1zWcKt+ftg35jzaVOub/ZndG1JRSLNWF4+4/M3thiatqa7/PxJt1aNxyzI nz1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=g3iVVHUt; 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 s19-20020a056a00195300b004fa7e2947fdsi16074397pfk.147.2022.05.17.02.05.22; Tue, 17 May 2022 02:05:35 -0700 (PDT) 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=g3iVVHUt; 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 S239383AbiEPOfG (ORCPT + 99 others); Mon, 16 May 2022 10:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231847AbiEPOfC (ORCPT ); Mon, 16 May 2022 10:35:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17909D5F; Mon, 16 May 2022 07:35:02 -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 C56F71FB2E; Mon, 16 May 2022 14:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1652711700; 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=W7ceyTjxid5l9ZGGTqZ+wt/EPfbFdKSX+/F4lyNdDKg=; b=g3iVVHUtSyQWBN3Y59HjcBDj1p/IZFTO1o2s8CWmnszg6wBpymi4LOQIZAcNlK/seWQfW5 OTdSKo9VL5YnbQyO5U7Jfrl+JZ6OG/lh8V2pkehTwaRN9l9VeiSd8KtqESYl+sNjIGZ0wr /r1jDJWacCJhVoSdrQMTgwD1CqqpyIo= 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 883E513AAB; Mon, 16 May 2022 14:35:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KL9RIBRhgmL0GwAAMHmgww (envelope-from ); Mon, 16 May 2022 14:35:00 +0000 Date: Mon, 16 May 2022 16:34:59 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Johannes Weiner Cc: Andrew Morton , Michal Hocko , Roman Gushchin , Shakeel Butt , Seth Jennings , Dan Streetman , Minchan Kim , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH v2 6/6] zswap: memcg accounting Message-ID: <20220516143459.GA17557@blackbody.suse.cz> References: <20220510152847.230957-1-hannes@cmpxchg.org> <20220510152847.230957-7-hannes@cmpxchg.org> <20220511173218.GB31592@blackbody.suse.cz> <20220513151426.GC16096@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) 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 On Fri, May 13, 2022 at 01:08:13PM -0400, Johannes Weiner wrote: > Right, it's accounted as a subset rather than fully disjointed. But it > is a limitable counter of its own, so I exported it as such, with a > current and a max knob. This is comparable to the kmem counter in v1. That counter and limit didn't turn out well. I liked the analogy to writeback (and dirty limit) better. > From an API POV it would be quite strange to have max for a counter > that has no current. Likewise it would be strange for a major memory > consumer to be missing from memory.stat. My understanding would be to have all memory.stat entries as you propose, no extra .current counter and the .max knob for zswap configuration. > It needs to be configured to the workload's access frequency curve, > which can be done with trial-and-error (reasonable balance between > zswpins and pswpins) or in a more targeted manner using tools such as > page_idle, damon etc. > [...] > Because for load tuning, bytes make much more sense. That's how you > measure the workingset, so a percentage is an awkward indirection. At > the cgroup level, it makes even less sense: all memcg tunables are in > bytes, it would be quite weird to introduce a "max" that is 0-100. Add > the confusion of how percentages would propagate down the hierarchy... Thanks for the explanation. I guess there's no simple tranformation of in-kernel available information that'd allow a more semantic configuration of this value. The rather crude absolute value requires (but also simply allows) some calibration or responsive tuning. > I don't traverse all ancestors, I bail on disabled groups and skip > unlimited ones. I admit I missed that. > Flushing unnecessary groups with a ratelimit doesn't sound like an > improvement to me. Then I'm only concerned about a situation when there's a single deep memcg that undergoes both workingset_refault() and zswap querying. The latter (bare call to cgroup_rstat_flush()) won't reset stats_flush_threshold, so the former (or the async flush more likely) would attempt a flush too. The flush work (on the leaf memcg) would be done twice even though it may be within the tolerance of cumulated error the second time. This is a thing that might require attention in the future (depending on some data how it actually performs). I see how the current approach is justified. Regards, Michal