From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16245C2BBCA for ; Tue, 25 Jun 2024 21:20:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7899E6B0099; Tue, 25 Jun 2024 17:20:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 738AD6B009A; Tue, 25 Jun 2024 17:20:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6001E6B009B; Tue, 25 Jun 2024 17:20:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 429AD6B0099 for ; Tue, 25 Jun 2024 17:20:53 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E4CEF1A068B for ; Tue, 25 Jun 2024 21:20:52 +0000 (UTC) X-FDA: 82270680744.15.B149F0E Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) by imf25.hostedemail.com (Postfix) with ESMTP id 7FF26A0022 for ; Tue, 25 Jun 2024 21:20:50 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mYNbUn+B; spf=pass (imf25.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.185 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719350430; h=from:from:sender:reply-to:subject:subject: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:dkim-signature; bh=kSEq35mq+2liJqu8fhW0CLedotKEkg4vp/Y3QA9hLTo=; b=7VSXlqsWwDDR7Um9Hs7h7s6hQ3EXUyLP0+YYsWiGZBfDFmpipo5HL5U+PGmdFkLXu+Dsfs clf5qWCa5ExP2emWVbtQAV2Tf0exyi3aBD0QWjP5xbRNWaVGQ38Us8AU3ruu54MsdNjKvz awxIgvYhflVQMp91Hwg8adAEBJMLKaA= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mYNbUn+B; spf=pass (imf25.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.185 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719350430; a=rsa-sha256; cv=none; b=7spZ6mnXWQChchj//rhjl2hroPLS4NHqbs8gJwW8HjIcOyF1ybNMB8rfWohxkdJJGwKGXf MFGVUarSOvNOsSyqAzJfsXsrg/8uU7Q2yL974bC6cezYg9QHYfHJb8lpLnBggdEivgSaOI 2ZZPHIPlnXvzrTQMQtmrdcJDTeHs2Zw= X-Envelope-To: yosryahmed@google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1719350447; h=from:from:reply-to:subject:subject: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=kSEq35mq+2liJqu8fhW0CLedotKEkg4vp/Y3QA9hLTo=; b=mYNbUn+BI0xiW3w9+MuLPEHsI3Z0TJjUg/rudWWYFZCW9OJ9Z6/+VcZeGtToiNrXdNSs8F l8ee/ddMnko4irYcFoESNE/u0730s/oEaIHgyohwi/WTjsy/PfSGR5zi3scbf22IMmLhE+ IGCtVYRKj6ywAWNASzFS1MNWm3Hb9l8= X-Envelope-To: hawk@kernel.org X-Envelope-To: tj@kernel.org X-Envelope-To: cgroups@vger.kernel.org X-Envelope-To: hannes@cmpxchg.org X-Envelope-To: lizefan.x@bytedance.com X-Envelope-To: longman@redhat.com X-Envelope-To: kernel-team@cloudflare.com X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-kernel@vger.kernel.org Date: Tue, 25 Jun 2024 14:20:43 -0700 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Yosry Ahmed Cc: Jesper Dangaard Brouer , tj@kernel.org, cgroups@vger.kernel.org, hannes@cmpxchg.org, lizefan.x@bytedance.com, longman@redhat.com, kernel-team@cloudflare.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] cgroup/rstat: Avoid thundering herd problem by kswapd across NUMA nodes Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7FF26A0022 X-Stat-Signature: bwpyt3qa39te9yeiu9x6dg3omrnrsmuq X-Rspam-User: X-HE-Tag: 1719350450-374079 X-HE-Meta: U2FsdGVkX19Zvhq6D0mzJleRDWcPuHbFJKkWzO4QGQr2sIDe1CxH9tsaeNpWNzomw062kvM5UrcSoucy32Lhf/fE80b7gE7CI3IhVEhJJmkW1Moy48pbI8Numk+x7dJwm7OCWIZDWy8ckwwJLHJWNJWRJDoNopZvnuuTCoRIwZ4nU/olkqo+jCDeV7xFwLz1BIwXR4pnetuTRFj3cwOYDJl2r1bt28kjzWtN98zff4b6N18f6M8rwP+diwHPRmLy2XRne+oCrHmNshCYEsNvw6PUHnOPs92sGS9x40SSlp5MHMziin3CX/N6ZAr4FvHbktKQ+AJeRCpSUk+M0l5qVBV0XWeccfyojPvlngXp9e8pWVtMV7aDg7GVnNYOZUPbLtIFMKJmBCDfkJ0/8zOe4RTZuq2EwBs1cg3RvTjJyXyQY8aCed+MAmcB0KZ9FA6AySQVPy70CuKKiBdz21Ld2DedvJMSZJo117W34QKnV9HamAoaLingt4jFaxxTNrfSAXng/gU8G98nVhFxZFIj1u+22ecxOaBNC6PZAp/Uz0XIINw4v2WmBsQ/UYWRhrKB14mL5+hk+9SXy1RhScpVnGb+vW7s1vN8xNx4/Kh8MBUGQ73z26c96J04pFA/QjyVinmCd+bqpqvLwkOj/LEfG+/J5NaCnMstPzg3CA3hQ4C8vdma413Nk2zQTxFqv2xLbCp/M+DPOmmuEUeZeoPGN/0PVXUU6AXmb7A7nG+sJI9DW37r8wc3ItqvJhYY+lALN5GsKyP5UpkbOsGA7e7gxHB3u0uft233e5EBmdVSUti4iAolV9CY38XMqNlmohqa4aUdqQurSxP1V1PH25XJkNA6YHybDM0Kez07VTXjW4fJLyGD0W3VoNrPEVXlSN5dXmVvtlgxFU6QY8tioYTEV1rFKxQEAhtGIbR/5EfAjB0HphjBrCzxU3cmmedey6h+2w2yrfOzyTkhprNNemd WXH14C4t SLeLBaMPkwNT7Op1Nu04TjxhZygSGer77KUnLJSmfs4N1H+jk19IxUBJZDNNMVQJvwXVjIXr4Wf1Uf9bLTXU1YY2dapY24tXU4yJoYJDgNQeUYv+omz6rYlxx2FWEvXwcg8jq96HsPa6GVKFtUR2kr2sa141HTwxBYis7Bcba1UMrG+kSka20B/gVqDyUqrY3IByOylt6KHXIcWM1MQI0lD+fQLIlPC5UxktT+AffBBk+7fY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Jun 25, 2024 at 01:45:00PM GMT, Yosry Ahmed wrote: > On Tue, Jun 25, 2024 at 9:21 AM Shakeel Butt wrote: > > > > On Tue, Jun 25, 2024 at 09:00:03AM GMT, Yosry Ahmed wrote: > > [...] > > > > > > My point is not about accuracy, although I think it's a reasonable > > > argument on its own (a lot of things could change in a short amount of > > > time, which is why I prefer magnitude-based ratelimiting). > > > > > > My point is about logical ordering. If a userspace program reads the > > > stats *after* an event occurs, it expects to get a snapshot of the > > > system state after that event. Two examples are: > > > > > > - A proactive reclaimer reading the stats after a reclaim attempt to > > > check if it needs to reclaim more memory or fallback. > > > - A userspace OOM killer reading the stats after a usage spike to > > > decide which workload to kill. > > > > > > I listed such examples with more detail in [1], when I removed > > > stats_flush_ongoing from the memcg code. > > > > > > [1]https://lore.kernel.org/lkml/20231129032154.3710765-6-yosryahmed@google.com/ > > > > You are kind of arbitrarily adding restrictions and rules here. Why not > > follow the rules of a well established and battle tested stats infra > > used by everyone i.e. vmstats? There is no sync flush and there are > > frequent async flushes. I think that is what Jesper wants as well. > > That's how the memcg stats worked previously since before rstat and > until the introduction of stats_flush_ongoing AFAICT. We saw an actual > behavioral change when we were moving from a pre-rstat kernel to a > kernel with stats_flush_ongoing. This was the rationale when I removed > stats_flush_ongoing in [1]. It's not a new argument, I am just > reiterating what we discussed back then. In my reply above, I am not arguing to go back to the older stats_flush_ongoing situation. Rather I am discussing what should be the best eventual solution. From the vmstats infra, we can learn that frequent async flushes along with no sync flush, users are fine with the 'non-determinism'. Of course cgroup stats are different from vmstats i.e. are hierarchical but I think we can try out this approach and see if this works or not. BTW it seems like this topic should be discussed be discussed face-to-face over vc or LPC. What do you folks thing? Shakeel