Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp735942imm; Wed, 18 Jul 2018 09:46:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfviDBpgLhcKl3fnPnMP2lSM4Pksrm21S60zxVwZCFG9UHS5qTYVh9b6cX2Tj0Wg/fAd0id X-Received: by 2002:a63:f713:: with SMTP id x19-v6mr6475615pgh.233.1531932396821; Wed, 18 Jul 2018 09:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531932396; cv=none; d=google.com; s=arc-20160816; b=qDkvnrduzBp25Spr5mDEsqCYg/ZE3ms7KzJ5fR7QoHFFc4VX8M7sa3sPP9zEbUX3DN 0Wj0sF4bpB0YsRSFFHe33RdCAFakQN6vKr8PDfSug2XF2WSDTmJBbsXn8AtvS/34auQz J6+DUU1fgfs49gFg6hxMBCYJGt7gbCBZo3I5MxiclKkkEyEOtcY64PePOJD0YVuV0v9E aLiPA173B3S+M27iIsM6AWq3Fa/3I8pyo6HUv95lLUfcHbYswf0h5+fsAFxgRpO7PxD3 7f+PoK1Pe0h9P5jfVrIbsdQlFmpOSs2sZI7jg9OdoQ/X3+CgTV9HQ2vcnSBfPAiNNGyG OPMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=hn8PNeEVeBiPcjbyroz+adMVtPsNaYaDnRKKaOIrY5E=; b=arNoVN/XjsUqdN9mkvs5gFsazykXM63K192by6i0VIRKwOUlUhWOQMbMd/qbQJHlSC gQQTo8jg2pLzrOebCEvi4c8cEFcLMiZRxlWshCS+tKI96FJnkM8wAtQLaCjg+UmoQiAy W77DDcmtclOuAhhKn/CL/Jl/z5BsL5yH+3CSQyFHAJAJzAHzSJhb4Ow0DAavE4tP0aYq IXC5GrlDtmPQhMAsAPo+uX/1uQ622+my36O8GAGS3Gvq3jCmQFiDXKeLsVbecGIHIqcu WqeFCalQ4hucs/ZOmNFj4sAH8N9XDPtRaeoggHVmPz2BUTyn6tS0F+et1rmOogq1J5Th N+DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=GHKwgm6D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m13-v6si3358478pls.70.2018.07.18.09.45.58; Wed, 18 Jul 2018 09:46:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=GHKwgm6D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731455AbeGRRWz (ORCPT + 99 others); Wed, 18 Jul 2018 13:22:55 -0400 Received: from mail-yb0-f193.google.com ([209.85.213.193]:40461 "EHLO mail-yb0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731059AbeGRRWy (ORCPT ); Wed, 18 Jul 2018 13:22:54 -0400 Received: by mail-yb0-f193.google.com with SMTP id y11-v6so2091831ybm.7 for ; Wed, 18 Jul 2018 09:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hn8PNeEVeBiPcjbyroz+adMVtPsNaYaDnRKKaOIrY5E=; b=GHKwgm6DdSmOCkFrFrv42QUK9fk3virG1dzvW1E0Vvo+r6PE5no+K+qKo4JPp9vcuH i657zfRdZ5fOXA2Y4EUZu1+7/5nfBwcl+qYfJ6xBcFDmRB0tNUiN4dCNubEo6owXF9FB HRR2DlNCF4yYaaV4NE+SKFemGf8af0346shmAk+YrT0t+n/Vvg+ZxcJqCJxnOA10a/pQ b+ktdoLgIv6lp4FAsq/B7yJyoJ5JiHVNraYZDivJTaJzosmYeik3Q3T6qUl0qdRar73b 28WCVoSExhX6o9VrIC4FYAkJqT3rhzUarHbsG6KtuHsBBJ8bi+oXHMELe+wVlgfv+6I0 nTtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hn8PNeEVeBiPcjbyroz+adMVtPsNaYaDnRKKaOIrY5E=; b=sBmkm48RW20b+hnAg2DGDRvrYw7RMBJ2QDeRBUIIz/YfhsRV0VzmsAAzf/vQR5iKmy 6zosk2vwiy6u/Qblpm+QxiOUGX772+DINQmCp7WkUNBA/f1/8UOLt39XKatZWMqMX/rZ FWl4GneRiZkJlfWx50XCkD8EkiFYwmYUUdItaMXHJJZ4u4P7cmZ2zYL5pPxIAwAHo7pf 7/e5eh7y5c+FAA0Q5mYHXUNXa2vzzSWAHdkSnaIfoXFnaeYw4BVXwgie1zAbvGlM7J+v fUKgnpyLhCE1uJizanBc4r0DjKSuPuqRQBiF/D4gXuMz6c2eoWMErmNnWcvVR/WND4DW xldQ== X-Gm-Message-State: AOUpUlHzgk2BGXuDllsyaVUNv7xDZSIRmCpYR23fhHoB1NFRIEsji6xq D8hBevt5J4knfdSM+iSfqwItAg== X-Received: by 2002:a25:588a:: with SMTP id m132-v6mr3582201ybb.464.1531932249992; Wed, 18 Jul 2018 09:44:09 -0700 (PDT) Received: from localhost ([2620:10d:c091:200::2:7eca]) by smtp.gmail.com with ESMTPSA id f137-v6sm4276121ywb.52.2018.07.18.09.44.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jul 2018 09:44:08 -0700 (PDT) Date: Wed, 18 Jul 2018 12:46:56 -0400 From: Johannes Weiner To: Peter Zijlstra Cc: Ingo Molnar , Andrew Morton , Linus Torvalds , Tejun Heo , Suren Baghdasaryan , Vinayak Menon , Christopher Lameter , Mike Galbraith , Shakeel Butt , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 08/10] psi: pressure stall information for CPU, memory, and IO Message-ID: <20180718164656.GA2838@cmpxchg.org> References: <20180712172942.10094-1-hannes@cmpxchg.org> <20180712172942.10094-9-hannes@cmpxchg.org> <20180718124627.GD2476@hirez.programming.kicks-ass.net> <20180718135633.GA5161@cmpxchg.org> <20180718163115.GV2494@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180718163115.GV2494@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18, 2018 at 06:31:15PM +0200, Peter Zijlstra wrote: > On Wed, Jul 18, 2018 at 09:56:33AM -0400, Johannes Weiner wrote: > > On Wed, Jul 18, 2018 at 02:46:27PM +0200, Peter Zijlstra wrote: > > > > I'm confused by this whole MEMSTALL thing... I thought the idea was to > > > account the time we were _blocked_ because of memstall, but you seem to > > > count the time we're _running_ with PF_MEMSTALL. > > > > Under heavy memory pressure, a lot of active CPU time is spent > > scanning and rotating through the LRU lists, which we do want to > > capture in the pressure metric. What we really want to know is the > > time in which CPU potential goes to waste due to a lack of > > resources. That's the CPU going idle due to a memstall, but it's also > > a CPU doing *work* which only occurs due to a lack of memory. We want > > to know about both to judge how productive system and workload are. > > Then maybe memstall (esp. the 'stall' part of it) is a bit of a > misnomer. I'm not tied to that name, but I can't really think of a better one. It was called PF_MEMDELAY in the past, but "delay" also has busy-spinning connotations in the kernel. "wait" also implies that it's a passive state. > > > And esp. the wait_on_page_bit_common caller seems performance sensitive, > > > and the above function is quite expensive. > > > > Right, but we don't call it on every invocation, only when waiting for > > the IO to read back a page that was recently deactivated and evicted: > > > > if (bit_nr == PG_locked && > > !PageUptodate(page) && PageWorkingset(page)) { > > if (!PageSwapBacked(page)) > > delayacct_thrashing_start(); > > psi_memstall_enter(&pflags); > > thrashing = true; > > } > > > > That means the page cache workingset/file active list is thrashing, in > > which case the IO itself is our biggest concern, not necessarily a few > > additional cycles before going to sleep to wait on its completion. > > Ah, right. PageWorkingset() is only true if we (recently) evicted that > page before, right? Yep, but not all of those, only the ones who were on the active list in their previous incarnation, aka refaulting *hot* pages, aka there is little chance this is healthy behavior.