Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp722748imm; Wed, 18 Jul 2018 09:32:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeBQ/nhK/C7v+ZcqAf1YfHy+ykslAkL2iCNsxbuem3MO5DB1pz5+g0Hc3ZAMZUWEduKj6Ph X-Received: by 2002:a63:cc04:: with SMTP id x4-v6mr6369841pgf.33.1531931534465; Wed, 18 Jul 2018 09:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531931534; cv=none; d=google.com; s=arc-20160816; b=fvY3Q8MIdS9Zmfbja7qXXsDSAaGxz7+VcLfUeuYyx/qvKGnmI8LSz9lTw1ebBNdYJP RDFUYP07c8tTLuzsllDI7Z7fxQ0smTu3bgaBfowGBdi0UfrigcDLXZTQral4PvK5q46E 8O+RlpVFfZFVqU8J0NAxDouxgrUv7V0cNdr2gU8RdBD+ZSjBz9BwHkNWbEahRTOV2GiQ Re10zNy5LgM1SIZv0EqX63KrV0CAG77TRpgqgytEiD9utSDt5drzSP4R76qUcDtOe+pa /wDNaTt/rBOdCtTb+lQViRmwZLNNxOPoDZGecGGDVydR07zVja9ldo7/rln22lvaWEDk Ljzg== 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=hcOhW0AxgeVW8KlsPYSm+C8c2IhtRyda4fOPsxxcs8s=; b=Y83w0Ln+WeCYBkacZPiFMZzcK5vcs/eoVWFswjpxIfq3SjWy14mKQxOs7icicbHcSI bupE/EnTeF6mZbR7y7ngyRX2yUD/AsNt9P61jcLDSBi+GHPQoOS6B10Yj7qqipkv/nTK 063j3IDbt65cpje2UL21iatiO2gVhtnRZD8KNeIr37qktnfJs0WYeESHpNOUbj8yT+px n+aIEeXAkjcfCxqyZu18ZOA7Z9ruxvyyvg+8iAtfTlsFmwtN/xov1m+qRtQn9GsqYNEQ Vnbh7x4bnrf/kfo5T38oobOzod70WlMIjeBzelO803gQWewYN9ZFoHYvpwB00LAqqp4M WAzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=gOd6CZZv; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k15-v6si3377873pls.463.2018.07.18.09.31.59; Wed, 18 Jul 2018 09:32:14 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=gOd6CZZv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731323AbeGRRKF (ORCPT + 99 others); Wed, 18 Jul 2018 13:10:05 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48216 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731144AbeGRRKE (ORCPT ); Wed, 18 Jul 2018 13:10:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hcOhW0AxgeVW8KlsPYSm+C8c2IhtRyda4fOPsxxcs8s=; b=gOd6CZZvAM+wz80XpZd9n8PUQ e52fnLMGVEXlYwPUJuYsTQpdOzYQQi6OfIay0CdCp7BBwdFOpSreNtnpPC+cnJTE5EybJ6GhJAfdq hFcBjLxBu3UWJgEZ6cEpfh+d6b8RnWdbaxxjiB89rkWBBs7tNuqEJD+8PNuAkTGKHyfj/U7zNhsWp SrkrpYnn3soo8hSZQy9djv6v9oHH5oWb5taSFdY81soZggrEwecgvDUN7/g3TlkedN3tZTKwGgaA2 7J6YLrJV3eCc9EbotCiVC7eAUfNtGgJRZgKDYYSBHJWdqLHpYpOX6rx9kV9GBzewJ86+LQRysCHG+ TLvY5HohA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ffpMC-0000SS-Oz; Wed, 18 Jul 2018 16:31:16 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3E48E20275F37; Wed, 18 Jul 2018 18:31:15 +0200 (CEST) Date: Wed, 18 Jul 2018 18:31:15 +0200 From: Peter Zijlstra To: Johannes Weiner 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: <20180718163115.GV2494@hirez.programming.kicks-ass.net> References: <20180712172942.10094-1-hannes@cmpxchg.org> <20180712172942.10094-9-hannes@cmpxchg.org> <20180718124627.GD2476@hirez.programming.kicks-ass.net> <20180718135633.GA5161@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180718135633.GA5161@cmpxchg.org> 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 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. > > 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?