Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35525596rwd; Mon, 10 Jul 2023 08:38:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlEg+w616FMv4h9nTjkDW+zpS364IVISasqScXNggNY+vjqVamzfubEhwGKsOQZKgmeOrUDe X-Received: by 2002:a5d:490b:0:b0:314:4db:e0b2 with SMTP id x11-20020a5d490b000000b0031404dbe0b2mr12502726wrq.15.1689003532609; Mon, 10 Jul 2023 08:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689003532; cv=none; d=google.com; s=arc-20160816; b=G2CKcPZJncU1fDT5liFIhxK5M3YMXvGUXXE0I4qlgBdl2z8MBUiH+ynSigR00c8i79 V5QENilQdI8/Q3+PuwhUDuz4owZ2771yP6ElH8YP+SzHgOByvWqcAB9B51inEdqcWEwt Qk0CJkn07pVqbXXqai8qLd//A4zbvPF+QBf7BcUiDbWiU59hSpn9tUKmCP9dnzwMVzCy QWdpai6mcQXvd90b+nOkWt3pEe4Hb+vP7XIGPSnuBPO1UGHlpQ2d/hKkPLhsr5WIh8g9 nkdFwio1unQtlRhLc9DOrfzF+fJNi+RbtgYRmIHpP4kDThUEHMnC6YHg86pLHUhTVG9y dixw== 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=2dSDCIryhoqYz8ZS1bBqRNqc86fubisnGZKJq77QBlA=; fh=304P672eUZ3RPIod4JcLEt8FmvBPJ2k8qHCdZqGBSbo=; b=M4lA5SfmJmCCSx9hzpHfxx7h+tQrFfneEJdgaygEarmjD3yRHCmWBws0XrQRliPdGz D/0thUlusiZIOQNWpXdD+oEoP1kJiKZfn7t5egWassGUQdVyQZHTorA9dZ8gU0IuUFan AZaHofivVhNdeCSYXOai85PaqfE7tKRlbeaWiizxd9VM+jPXZ7Hcml6kWY4wTJn8ekAJ LEPu3GiBrWci4Lx+tc91MI3y3LK4Djc76eEqSzkIEnpU0anA8ZDDONV0xXObt7XyzrPI nV2zlG4bla538QxyMsODFRl49GpKtuukdnPvETcsO4teAL5BO0IVyKzssgnYLIf7ECiU DBmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=ZOh9PSn4; 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 jx16-20020a170906ca5000b0098e044f3701si8771331ejb.201.2023.07.10.08.38.28; Mon, 10 Jul 2023 08:38:52 -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=ZOh9PSn4; 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 S230496AbjGJOo6 (ORCPT + 99 others); Mon, 10 Jul 2023 10:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbjGJOo5 (ORCPT ); Mon, 10 Jul 2023 10:44:57 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8543DC3; Mon, 10 Jul 2023 07:44:56 -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-out1.suse.de (Postfix) with ESMTPS id 38B7721AE8; Mon, 10 Jul 2023 14:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1689000295; 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=2dSDCIryhoqYz8ZS1bBqRNqc86fubisnGZKJq77QBlA=; b=ZOh9PSn4qAb49Y/vRW4RvILvHVqDNm8r7BSRKjNFgqVMKsAHnK+MLjUCMjalAB1ujYKCXP VH9Y13+ev6/vDr7W357nCLvnoVwnsFHEaGMUZGMQZXiDaIpzdjn2cZa1YiBoRWsDx1qnAW cfgvONSAD46IH0pcuEFK25CaUCcA8C8= 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 0743A13A05; Mon, 10 Jul 2023 14:44:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mijkAGcZrGSrSgAAMHmgww (envelope-from ); Mon, 10 Jul 2023 14:44:55 +0000 Date: Mon, 10 Jul 2023 16:44:53 +0200 From: Michal =?utf-8?Q?Koutn=C3=BD?= To: Ivan Babrou Cc: cgroups@vger.kernel.org, Linux MM , kernel-team , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , linux-kernel Subject: Re: Expensive memory.stat + cpu.stat reads Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="b77s5ccberk4hrjr" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,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 --b77s5ccberk4hrjr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello. On Fri, Jun 30, 2023 at 04:22:28PM -0700, Ivan Babrou = wrote: > As you might've noticed from the output, splitting the loop into two > makes the code run 10x faster. That is curious. > We're running Linux v6.1 (the output is from v6.1.25) with no patches > that touch the cgroup or mm subsystems, so you can assume vanilla > kernel. Have you watched for this on older kernels too? > I am happy to try out patches or to do some tracing to help understand > this better. I see in your reproducer you tried swapping order of controllers flushed.=20 Have you also tried flushing same controller twice (in the inner loop)? (Despite the expectation is that it shouldn't be different from half the scenario where ran two loops.) Thanks, Michal --b77s5ccberk4hrjr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQpEWyjXuwGT2dDBqAGvrMr/1gcjgUCZKwZYwAKCRAGvrMr/1gc jkiaAP0cMXwbvKMrd3UFe9bkgPZXxl1WeME+caCgKNQqMZaS1AD/eGWbOeKD5V7A KBibSziS+oGtgU+Wg7XvKGBFaasJZA4= =jPdL -----END PGP SIGNATURE----- --b77s5ccberk4hrjr--