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 BF793C6FD1D for ; Thu, 30 Mar 2023 07:49:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 472486B0072; Thu, 30 Mar 2023 03:49:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 422A36B0074; Thu, 30 Mar 2023 03:49:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C38E6B0075; Thu, 30 Mar 2023 03:49:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 173536B0072 for ; Thu, 30 Mar 2023 03:49:11 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E9532140F2F for ; Thu, 30 Mar 2023 07:49:10 +0000 (UTC) X-FDA: 80624788860.06.20FD5A8 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf12.hostedemail.com (Postfix) with ESMTP id F2B4340010 for ; Thu, 30 Mar 2023 07:49:08 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=OtqKKjzU; spf=pass (imf12.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680162549; 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=zl6vnuhb0+tm4UNYVkua6ap4lB/Vnj1JGtAkmTbyth8=; b=BLWREbZ/z4rgaVgo6mQvtkKeQILatSKgQq09ov5t/IytXLJ4niXXkO37OZmyG+5PNiHU/0 jXP/PnvN1PJNwQYufxw9o9G6cf6V5JrFb8/2A4OGtbuDKoaFdwlqKXJwR5ipSIQyH6bAFr kY6SUp/qXERNexFpI0Fdy2DzxNWjafE= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=OtqKKjzU; spf=pass (imf12.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680162549; a=rsa-sha256; cv=none; b=fug9/os+SQ5Y9HZghm9CDoMphjz6XghxNXWSTrOL+vsQUqDDNVcJmPBdQL/THilR1CuFsG BLzEauTxcY+dNi+NohwJzHX+CssvwfhSxtnVeI9MlOmu4TgAkvnH+z+uOP46OqfGlt6ae/ MCXMyBMEUJ0CXv/yUxr31CJdo3W4Nhg= 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 82C051FE96; Thu, 30 Mar 2023 07:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1680162547; 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=zl6vnuhb0+tm4UNYVkua6ap4lB/Vnj1JGtAkmTbyth8=; b=OtqKKjzUcmO/o0IDfFsZZQhAvhs/NKY4kJjUmP4UIDS3us0gtfDjwpZ5/hrmfHWxHHPzpI dZ7X131mCHa/QAdw7J0fEZfW35910RAIMN0WuPe7lYwebuRZiekoQnwdQ8sA+rGDGkzp83 p1Te8uGBUwpnjYZ5L8u7t6zIzW2B6cI= 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 8A2651348E; Thu, 30 Mar 2023 07:49:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EG8lH/M+JWRDAgAAMHmgww (envelope-from ); Thu, 30 Mar 2023 07:49:07 +0000 Date: Thu, 30 Mar 2023 09:49:06 +0200 From: Michal Hocko To: Yosry Ahmed , Johannes Weiner Cc: Shakeel Butt , Tejun Heo , Josef Bacik , Jens Axboe , Zefan Li , Roman Gushchin , Muchun Song , Andrew Morton , Michal =?iso-8859-1?Q?Koutn=FD?= , Vasily Averin , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org Subject: Re: [PATCH v2 4/9] cgroup: rstat: add WARN_ON_ONCE() if flushing outside task context Message-ID: References: <20230328221644.803272-1-yosryahmed@google.com> <20230328221644.803272-5-yosryahmed@google.com> <20230329192059.2nlme5ubshzdbpg6@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Stat-Signature: rse9hgrqgohoouidsaz91jdfk5jiuuhj X-Rspam-User: X-Rspamd-Queue-Id: F2B4340010 X-Rspamd-Server: rspam06 X-HE-Tag: 1680162548-366410 X-HE-Meta: U2FsdGVkX1+R5xK20cFC/zJH6szsn7xr2ypb927Yk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smk9vYrVzPAEqINhRTyuRXVZ1D5q/lVCnYFmfNcRROcu6SlH2DMB4zlndoK7fu2+qWYTtWPRDkomTkEE7yw2FwnFY0OO++6QX60qeboeh7gu5oxqUXYy7/tLL7LJMA957mmXHi274ypmyWGHTEg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 30-03-23 00:13:16, Yosry Ahmed wrote: > On Thu, Mar 30, 2023 at 12:06 AM Michal Hocko wrote: [...] > > So the real question is. Do we really care so deeply? After all somebody > > might be calling this from within a spin lock or irq disabled section > > resulting in a similar situation without noticing. > > There are discussions in [1] about making atomic rstat flush not > disable irqs throughout the process, so in that case it would only > result in a similar situation if the caller has irq disabled. The only > caller that might have irq disabled is the same caller that might be > in irq context before this series: mem_cgroup_usage(). > > On that note, and while I have your attention, I was wondering if we > can eliminate the flush call completely from mem_cgroup_usage(), and > read the global stats counters for root memcg instead of the root > counters. There might be subtle differences, but the root memcg usage > isn't super accurate now anyway (e.g. it doesn't include kernel > memory). root memcg stats are imprecise indeed and I have to admit I do not really know why we are adding more work for that case. I have tried to dig into git history for that yesterday but couldn't find a satisfying answer. It goes all the way down to 2d146aa3aa842 which has done the switch to rstat. Maybe Johannes remembers. Anyway, back to this particular patch. I still do not see strong reasons to be verbose about !in_task case so I would just drop this patch. -- Michal Hocko SUSE Labs