Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp110646pxp; Wed, 16 Mar 2022 01:26:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCJqwyRTf3joTUS7B53QUmIGbFpwDCzon3Y/BMgGYnB8DLBrmq30NLHeSgaBjzFobQjmSZ X-Received: by 2002:a17:907:2dab:b0:6db:f0a6:761a with SMTP id gt43-20020a1709072dab00b006dbf0a6761amr6609391ejc.584.1647419213023; Wed, 16 Mar 2022 01:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647419213; cv=none; d=google.com; s=arc-20160816; b=r6PXpS1JARc1UG+DAcoayQAXFDLsPnKE3TWAwX6o815A8gSSBa+cwLaYLFOejy9WmE r9xIFEH4DXtz6zNfEBbbuNqjfo+Uu3dmlXLLEY48/sJjkNHMBIXkTNGuvxvdNItQy9KH 9iAjsw3zqavPnkATYG7kWUFtQE0+HnJdrE+BX7J830W27v9UVzTxYMift7aW+mhTwNfX /Pv9GqILthlfWR4g/laYBL85QGN6vcMAOA9vfvERP4ec5YUpDHaYx3GgyDgFVf6LUQuR 2ezcaJRZCyXuWVBY6+jmrIWkPD5ghti9oo2qJeJz/VsDkehPGeiV8hU910V73rmvPDAs QJFw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TaLNlzXGwgt3rIVBhMb8m6A+9RFUlVGbRu4EdMRGlyg=; b=qcjZN/P6JEPTLXCfJJByAqf9hkGwjCOFfRR0zZoJDj7wQpZ2Zx2Jj1gdqRAnlnq+CZ TED2ncktvCGGsUJopN4oNuoEr2xR7mTV+rYkhEBd3e1IRBbbPepjD5Cm6HPYKPyOH/la 4vD6Z4FpwM5a2Ec5qAmyM562r0h1IBzTD0OmajNmqyrCy1M0W6Ho5Xk0CyrqeqfE53C6 DHxLPNqfTW/Nbe3Qy6ak9AulIydmXMGEcXK1Q8NFdYvE2CiKjtChfdw3VF7IOYVYRRrj wkyAMf/99RpGDXD+GCWnxvZl9J+DLZ/RWcCOiefHiL9CSVwd1lLs7EUPR4ZoHWAZrJ50 rBtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=eFmcNQFm; 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 bd23-20020a056402207700b00418eb23a4casi462143edb.364.2022.03.16.01.26.27; Wed, 16 Mar 2022 01:26:53 -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=eFmcNQFm; 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 S238338AbiCNM6T (ORCPT + 99 others); Mon, 14 Mar 2022 08:58:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241770AbiCNM6Q (ORCPT ); Mon, 14 Mar 2022 08:58:16 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2873811A3E; Mon, 14 Mar 2022 05:57:06 -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 CBBA6218FE; Mon, 14 Mar 2022 12:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1647262624; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TaLNlzXGwgt3rIVBhMb8m6A+9RFUlVGbRu4EdMRGlyg=; b=eFmcNQFmrNsywdOeFr5SEDup6JsmNK0K+YScoACNqR2qy1LHFFYhq1WsNq+LI5EPmA8/2Q bQCv7UfngnJKKpainDF0pEVNMNsKVuHf3pi0c/ifsViuOWtm9nfJR/G4o6naP5tiL4+IiB 27UYnqde9XPDx7asXLRv5oXrc/eu6lc= 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 A930B13B34; Mon, 14 Mar 2022 12:57:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wMNRKKA7L2KcTgAAMHmgww (envelope-from ); Mon, 14 Mar 2022 12:57:04 +0000 Date: Mon, 14 Mar 2022 13:57:03 +0100 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Shakeel Butt Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Ivan Babrou , Frank Hofmann , Andrew Morton , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Daniel Dao , stable@vger.kernel.org Subject: Re: [PATCH] memcg: sync flush only if periodic flush is delayed Message-ID: <20220314125703.GA11645@blackbody.suse.cz> References: <20220304184040.1304781-1-shakeelb@google.com> <20220311160051.GA24796@blackbody.suse.cz> <20220312190715.cx4aznnzf6zdp7wv@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220312190715.cx4aznnzf6zdp7wv@google.com> 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 Hi. On Sat, Mar 12, 2022 at 07:07:15PM +0000, Shakeel Butt wrote: > So, I will focus on the error rate in this email. (OK, I'll stick to error estimate (for long-term) in this message and will send another about the current patch.) > [...] > > > The benefit this was traded for was the greater accuracy, the possible > > error is: > > - before > > - O(nr_cpus * nr_cgroups(subtree) * MEMCG_CHARGE_BATCH) (1) > > Please note that (1) is the possible error for each stat item and > without any time bound. I agree (forgot to highlight this can stuck forever). > > > - after > > O(nr_cpus * MEMCG_CHARGE_BATCH) // sync. flush > > The above is across all the stat items. Can it be used to argue about the error? E.g. nr_cpus * MEMCG_CHARGE_BATCH / nr_counters looks appealing but that's IMO too optimistic. The individual item updates are correlated so in practice a single item would see a lower error than my first relation but without delving too much into correlations the upper bound is nr_counters independent. > I don't get the reason of breaking 'cr' into individual stat item or > counter. What is the benefit? We want to keep the error rate decoupled > from the number of counters (or stat items). It's just a model, it should capture that every stat item (change) contributes to the common error estimate. (So it moves more towards the nr_cpus * MEMCG_CHARGE_BATCH / nr_counters per-item error (but here we're asking about processing time.)) [...] > My main reason behind trying NR_MEMCG_EVENTS was to reduce flush_work by > reducing nr_counters and I don't think nr_counters should have an impact > on Δt. The higher number of items is changing, the sooner they accumulate the target error, no? (Δt is not the periodic flush period, it's variable time between two sync flushes.) Michal