Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6260708rwl; Tue, 4 Apr 2023 09:54:42 -0700 (PDT) X-Google-Smtp-Source: AKy350YkgmXtLwG6eX4etnNgr1ZUHhNXv7zEv/avEeHp+7+Z02GQayZN09V2T+z7j/LOoLZPmQZ6 X-Received: by 2002:a17:906:8a65:b0:92b:f0d9:15f3 with SMTP id hy5-20020a1709068a6500b0092bf0d915f3mr47234ejc.37.1680627282043; Tue, 04 Apr 2023 09:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680627282; cv=none; d=google.com; s=arc-20160816; b=M7rHDVBUMxfQA8dWApYJp1S3TrFPHPaGCrVgO3hjOKb6KKdc0+ah6ALhvhmCkjiVYQ Ypqhc1uzLlFgDRvi7U7I8mN6VuG1QJFaqEHQOJwKPaax2QOt7Q0jqei0bL+z/v+XwO+B Lz7ykH39r18V8OMdv6fpuQw1x389O08guVgFSaD1cW8PI1Agy6gsvfQnl47519HRI/WO sdArDxqqgNh9xsNu4wzIeGN/M1ZcIELMwH9deXRtt6FMtW5J3ZwA9E1pP/hUSjKMUtxt 83Jb5S9RWA6X7J2SY8FoVKAfFe5z8+omFhSp7GEMXgY89SMwxqAOlFtwYjl/Z2Gz6uJZ S36A== 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=Ll6vzEKQtu1d/iiPFBcw95nX9gIYgOaKMZRWVNUtfkM=; b=mcp2lK9K2HV/lTezu8jGXdZ2Q1gtoeUoKB8RDI2ysav3mBhRKnGF7jdTcgHhJyiwgH oVFECSEzpmmHf7pCjIaK+x4ZAGraaQbSl6Tr9wurgxUmKrxPwaj/9hz90TjYx7WH2l4V 47CcKBzTucYHAUBU2NC2RfK9EymF+n9GkVLmlOE2amomSdpvo3VFXy7ipFsW4QpFnqHZ 5HzBv/i/M0pyGrH9/JU+zg/7h/UQbO4relXaZfRgsPAkuD6hXVNNTJ8pE/oG+45PQGn6 kZxuejJePJQ1CDOOBxRmnvQphfq2HkvplZO3IoaJYDjSkYNk7hJnkd1Hz4Cps/tqIh3K llgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=OnTsPuWs; 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 e26-20020a056402089a00b00501d7ce6144si1541640edy.474.2023.04.04.09.54.17; Tue, 04 Apr 2023 09:54:42 -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=OnTsPuWs; 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 S235601AbjDDQxe (ORCPT + 99 others); Tue, 4 Apr 2023 12:53:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234777AbjDDQxY (ORCPT ); Tue, 4 Apr 2023 12:53:24 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C5AE4EC5; Tue, 4 Apr 2023 09:53:08 -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 9A75E20689; Tue, 4 Apr 2023 16:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1680627186; 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=Ll6vzEKQtu1d/iiPFBcw95nX9gIYgOaKMZRWVNUtfkM=; b=OnTsPuWsvR8SUopMCtCWMTgT2XxI3U2ix4/z/djlxuJpDe5rTy1vlqUc7rIQ79SwyWU+Ba aNQWpCYDuFeaj6SA/BU2bvIIYzm8uWKKX3KtU5qWEj3+h5Nzr/fpy+by5cNlp77YPmMqCo FWnVjkGyLQXqBJ8fQCYb63lUO4hLKBw= 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 4C4161391A; Tue, 4 Apr 2023 16:53:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +w65EfJVLGTSMAAAMHmgww (envelope-from ); Tue, 04 Apr 2023 16:53:06 +0000 Date: Tue, 4 Apr 2023 18:53:05 +0200 From: Michal =?utf-8?Q?Koutn=C3=BD?= To: Yosry Ahmed Cc: Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Vasily Averin , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, Michal Hocko Subject: Re: [PATCH v3 6/8] workingset: memcg: sleep when flushing stats in workingset_refault() Message-ID: <20230404165305.ffs7uscqpndnfytn@blackpad> References: <20230330191801.1967435-1-yosryahmed@google.com> <20230330191801.1967435-7-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qfkseaqkxxqkcz24" Content-Disposition: inline In-Reply-To: <20230330191801.1967435-7-yosryahmed@google.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 --qfkseaqkxxqkcz24 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 30, 2023 at 07:17:59PM +0000, Yosry Ahmed wrote: > In workingset_refault(), we call > mem_cgroup_flush_stats_atomic_ratelimited() to read accurate stats > within an RCU read section and with sleeping disallowed. Move the > call above the RCU read section to make it non-atomic. >=20 > Flushing is an expensive operation that scales with the number of cpus > and the number of cgroups in the system, so avoid doing it atomically > where possible. I understand why one does not process the whole flushing load in one go in general. However, I remember there were reports of workingset_refault() being sensitive to latencies (hence the ratelimited call was created). Is there any consideration on impact of this here? (Or are there other cond_resched() precendents on this path? Should it be mentioned like in the vmscan (7/8) commit?) Thanks, Michal --qfkseaqkxxqkcz24 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTrXXag4J0QvXXBmkMkDQmsBEOquQUCZCxV7gAKCRAkDQmsBEOq uUD+AQD8wXXi9jmmMAZsQDelWPQkkod/PwIlrMWJ7mxxhDrGEwEAqpLPmU1ZnE0x eJvubQemadydJAWDGZe8mox2qJ3iLAY= =AwCK -----END PGP SIGNATURE----- --qfkseaqkxxqkcz24--