Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3659524imm; Mon, 6 Aug 2018 08:27:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfYjj8LAFhxRDcS8MBRI74o2SBzRFnF1mkbio/2cQzoNOosUWdu0gBvMRuQITJzPSodir1V X-Received: by 2002:a17:902:728c:: with SMTP id d12-v6mr14130804pll.283.1533569264708; Mon, 06 Aug 2018 08:27:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533569264; cv=none; d=google.com; s=arc-20160816; b=FEPKzQf2IwRGG+dlprXpR0u4aezmZodPZ35R9vYt7DbOEYW1tp4w9riNgC7ivxsnL8 TXvYMODuXCLYy5zkqvRiz7NCfY5BZkp+eyouSdu2qxnjx70spPOFTsXSaNNYecpx9itv 4+gbF8eeLVJPkYqGFUZ68GvfeCST32e6k9U0Jh9k6qoAWvHUNGF3Edu9M8vGQQpVc+NP rj8+N0d/xjsNRPNzvTHKBh0az0iOX3l8oq7WlIfwml4olwwiEViJ2QMbV1xmAyV0lpGa orijOB46vzBzgmuK6chWHVPGwJ6PO6iiqq3SHE7XPyX3qoezP7T5B7+JgO5wYjQA9h9B AlOQ== 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=ZdfO5PyjZXR150UMtqHm4zxkP/3ep6gC1wezPDd7wUw=; b=TolUI2pYPBWRZUIDp5zuGOwrCCmwvs3G+vqyG4uqAaf2WutW68yLr22/atBkHpvrjI zzVlQX9lxTqPgOOtWX8GlBPDzGjpLWQI/3Ek35xwyqH3YWdABZ2hZpPdeIM/Elgstvm6 EwpDj4uXby1JwD/r8Rd92ji4kjDpTb53EkM6+buRVGF1bosQRpB4InjnoKymLYPGNr8E 88nRC3x3QMVxLrrVc6Hsyr/9HGzAO3QzmMr2fVhLynPYWhMKSY+FhoaQrSCzUCB1tGcy H7ts55R1Ig5DvRJNCgCEgCJ9s8dqd/3vuhTCddRqivcAJMzWHP1nr0z4S1qVoTuTm/Ut 12eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EgVD2YUc; 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 x1-v6si11419986pge.521.2018.08.06.08.27.29; Mon, 06 Aug 2018 08:27:44 -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=EgVD2YUc; 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 S1732928AbeHFRfT (ORCPT + 99 others); Mon, 6 Aug 2018 13:35:19 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36636 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732386AbeHFRfQ (ORCPT ); Mon, 6 Aug 2018 13:35:16 -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=ZdfO5PyjZXR150UMtqHm4zxkP/3ep6gC1wezPDd7wUw=; b=EgVD2YUcxlgr5gvaAdGPF1a5X bq1RrKJESnu+evMyio23d6fvKcFT0SO6xoEgyGCsKr4rDywUNX8yjV/q4LmRK7uSae7sBmRSXrQXV l3fN2NdeMNFQytE9bCEq8Q0HOxQeFaLf1OIEZ2l7AHz+Tib3Q3VJnlhXg9Tr/HtdcHJSyWnWINFYS VBP/R0BhbG92VEJbBM1IEqfG0ZfTnJb4VG+CoJiF4sgyknKpZz+q2VOOP01wiIqDPHoEez+rS5gHw Lz3YBXs60EsDU12AuBJHtyoQG2rsmN6OeOkEsF7RRDYamoq7nnVxqAfPK0AZFofVl16/JKP480l13 wmB22YCWQ==; 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 1fmhNz-0000UQ-1s; Mon, 06 Aug 2018 15:25:31 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EAF442058A21D; Mon, 6 Aug 2018 17:25:28 +0200 (CEST) Date: Mon, 6 Aug 2018 17:25:28 +0200 From: Peter Zijlstra To: Johannes Weiner Cc: Ingo Molnar , Andrew Morton , Linus Torvalds , Tejun Heo , Suren Baghdasaryan , Daniel Drake , Vinayak Menon , Christopher Lameter , Mike Galbraith , Shakeel Butt , Peter Enderborg , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 8/9] psi: pressure stall information for CPU, memory, and IO Message-ID: <20180806152528.GM2494@hirez.programming.kicks-ass.net> References: <20180801151958.32590-1-hannes@cmpxchg.org> <20180801151958.32590-9-hannes@cmpxchg.org> <20180803165641.GA2476@hirez.programming.kicks-ass.net> <20180806150550.GA9888@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180806150550.GA9888@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 Mon, Aug 06, 2018 at 11:05:50AM -0400, Johannes Weiner wrote: > Argh, that's right. This needs an explicit count if we want to access > it locklessly. And you already said you didn't like that this is the > only state not derived purely from the task counters, so maybe this is > the way to go after all. > > How about something like this (untested)? > +static inline void psi_switch(struct rq *rq, struct task_struct *prev, > + struct task_struct *next) > +{ > + if (psi_disabled) > + return; > + > + if (unlikely(prev->flags & PF_MEMSTALL)) > + psi_task_change(prev, rq_clock(rq), TSK_RECLAIMING, 0); > + if (unlikely(next->flags & PF_MEMSTALL)) > + psi_task_change(next, rq_clock(rq), 0, TSK_RECLAIMING); > +} Urgh... can't say I really like that. I would really rather do that scheduler_tick() thing to avoid the remote update. The tick is a lot less hot than the switch path and esp. next->flags might be a cold line (prev->flags is typically the same line as prev->state so we already have that, but I don't think anybody now looks at next->flags or its line, so that'd be cold load).