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 BAC94C19F28 for ; Wed, 3 Aug 2022 13:55:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 49B1D6B0071; Wed, 3 Aug 2022 09:55:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 424598E0002; Wed, 3 Aug 2022 09:55:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 29E258E0001; Wed, 3 Aug 2022 09:55:42 -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 181516B0071 for ; Wed, 3 Aug 2022 09:55:42 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E3E0F1C6F77 for ; Wed, 3 Aug 2022 13:55:41 +0000 (UTC) X-FDA: 79758429282.02.2783F52 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by imf22.hostedemail.com (Postfix) with ESMTP id 3814EC00F6 for ; Wed, 3 Aug 2022 13:55:41 +0000 (UTC) Received: by mail-qt1-f179.google.com with SMTP id d16so1229562qtw.8 for ; Wed, 03 Aug 2022 06:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=lQmTwuH19noXU8KpeeAnN5wF6xxdpiMxXJOzXODGwqU=; b=0k7nUrbpXLcaPeWPf60nz1yNFjZ/YkPDFzWTlv1KmmrFzIm2f1cMvivgKSu1u7TEZj 2/sbX9+byvfdjE8wK0tdzxTYiK9YqK0GqsDv3ZaJyUgmRpW/TDs25YzEqrKcMRorAeg5 LiokXNEF0dr/rKiTJ4Zfg6MK37m6TDHh54mrkeWee6VD1B+Rqi11t/5jN7REjUJ7xY4s qk5npgwTzDiP0tc6ngdQKBYVXNW4nTWseViEXG/GTiHT2/jR9tEz9XjLjRoAFqIEZBi+ w6PIhKBI8RBsl0tVVG8jKY6bRweyNTxw+0N3M/4feZe2Bg8zPMnKsg+6n3cJTZtAJS2d zAdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=lQmTwuH19noXU8KpeeAnN5wF6xxdpiMxXJOzXODGwqU=; b=fDtVSgdIcsARG6+aT3PoDPQTp5YLhfG/FwLUui3PYD1fKRDkr0d2vFXlUe5BJGk1tP Ijm+oyrE3OEyPCqaWquAwfjfjZWTCwUXAm2kQh+oHGxkkOhGNdI3in5ICk1aIyPUi3SL jndbQK4k2EZnOIGDlp1B1eroJ/JGZlCkYBtJOJ+u1Hibg5tLfBE0wPtOt1hs/Rjr+k3P X2J91WbsoaSAp83vGes8r9L1zsCLfjVpqwAyPBDQI9juJAIv28kbq/GHwtv0pLzB1Gww SpEljPe/mk4EGYW7H1uNKSC66ts9v8Sg2Jig0TBkYFa0puf1kFjrqawD0V5Ld+JZ9bvW CHhQ== X-Gm-Message-State: ACgBeo3crYi0aBgWslao2BLTamkbsR/pop4PVi+lH8WqZKrsgo8a6yho ULjCwkXUDxEw61+mf+xphux0/w== X-Google-Smtp-Source: AA6agR55ZUMakwR8gOPEEriFgNS65we8TZqR5lyXHTta3pfmlHq7HU0LVG3E/Eq2e/cr6AkfR2Y4IQ== X-Received: by 2002:ac8:7396:0:b0:33f:4f21:59d6 with SMTP id t22-20020ac87396000000b0033f4f2159d6mr1194652qtp.453.1659534940438; Wed, 03 Aug 2022 06:55:40 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-00ea-7f88-5fd9-01cd.res6.spectrum.com. [2603:7000:c01:2716:ea:7f88:5fd9:1cd]) by smtp.gmail.com with ESMTPSA id do54-20020a05620a2b3600b006b5e1aeb777sm3106801qkb.43.2022.08.03.06.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Aug 2022 06:55:40 -0700 (PDT) Date: Wed, 3 Aug 2022 09:55:39 -0400 From: Johannes Weiner To: cgel.zte@gmail.com Cc: akpm@linux-foundation.org, tj@kernel.org, axboe@kernel.dk, vdavydov.dev@gmail.com, ran.xiaokai@zte.com.cn, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgel , Peter Zijlstra Subject: Re: [RFC PATCH 1/2] psi: introduce memory.pressure.stat Message-ID: References: <20220801004205.1593100-1-ran.xiaokai@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220801004205.1593100-1-ran.xiaokai@zte.com.cn> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659534941; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lQmTwuH19noXU8KpeeAnN5wF6xxdpiMxXJOzXODGwqU=; b=8I5zglrXVvyqZETOTBMk12mb860A1DnkPAuw0CYkkuj5+bLMNwi+lL06kWRghizCWW8H6o t6zeF4drzeJWd1fD8ATRSDgj0ADasYJZmWzsNzjbY0t24R7eQUmQaCNBRwL0xUEzKfxbYc pj+qLSAp+WzYqc5IfBOBbEm4d1WPSGk= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=0k7nUrbp; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf22.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.179 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659534941; a=rsa-sha256; cv=none; b=6vvpO9aPiP6Tt6fJkdkYaSI8GnQpfxMdTiq17332lWbiNckyVFKbMGD2uUGxVQhr1NIZYE ISK5KSWzRGHMerCkMWkGL/19yD2c9Smaro1wrt+OZTAi1x8wKf1zlHETpniEDoik0aWhY6 F51luUfMbQT57JwOWKa6wkd9GElMssU= X-Stat-Signature: rjic31n6abkokkj61udoiapfsuxide7j X-Rspamd-Queue-Id: 3814EC00F6 X-Rspamd-Server: rspam01 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=0k7nUrbp; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf22.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.179 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Rspam-User: X-HE-Tag: 1659534941-444509 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 Mon, Aug 01, 2022 at 12:42:04AM +0000, cgel.zte@gmail.com wrote: > From: cgel > > For now psi memory pressure account for all the mem stall in the > system, And didnot provide a detailed information why the stall > happens. This patch introduce a cgroupu knob memory.pressure.stat, > it tells the detailed stall information of all memory events and it > format and the corresponding proc interface. > > for the cgroup, add memory.pressure.stat and it shows: > kswapd: avg10=0.00 avg60=0.00 avg300=0.00 total=0 > direct reclaim: avg10=0.00 avg60=0.00 avg300=0.12 total=42356 > kcompacted: avg10=0.00 avg60=0.00 avg300=0.00 total=0 > direct compact: avg10=0.00 avg60=0.00 avg300=0.00 total=0 > cgroup reclaim: avg10=0.00 avg60=0.00 avg300=0.00 total=0 > workingset thrashing: avg10=0.00 avg60=0.00 avg300=0.00 total=0 > > for the system wide, a proc file introduced as pressure/memory_stat > and the format is the same as the cgroup interface. > > With this detaled information, for example, if the system is stalled > because of kcompacted, compaction_proactiveness can be promoted so > pro-compaction can be involved earlier. > > Signed-off-by: cgel > @@ -64,9 +91,11 @@ struct psi_group_cpu { > > /* Aggregate pressure state derived from the tasks */ > u32 state_mask; > + u32 state_memstall; > > /* Period time sampling buckets for each state of interest (ns) */ > u32 times[NR_PSI_STATES]; > + u32 times_mem[PSI_MEM_STATES]; This doubles the psi cache footprint on every context switch, wakeup, sleep, etc. in the scheduler. You're also adding more branches to those same paths. It'll measurably affect everybody who is using psi. Yet, in the years of using psi in production myself, I've never felt the need for what this patch provides. There are event counters for everything that contributes to pressure, and it's never been hard to rootcause spikes. There are also things like bpftrace that let you identify who is stalling for how long in order to do one-off tuning and systems introspection. For this to get merged, it needs a better explanation of the usecase that requires this information to be broadly available all the time. And it needs to bring down the impact on everybody else who doesn't want this - either by reducing the footprint or by making the feature optional.