Received: by 10.192.165.148 with SMTP id m20csp5404985imm; Wed, 9 May 2018 04:39:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQOh7E+vM772xz48w4jyPnCTLdWih1e5x1xS4YWdfhV+08hy3UWn7YOqcbgj616uw86sFJ X-Received: by 2002:a17:902:9a4b:: with SMTP id x11-v6mr30697609plv.176.1525865981097; Wed, 09 May 2018 04:39:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525865981; cv=none; d=google.com; s=arc-20160816; b=PivobnMuivV8qnGaFOIJun1LCrtYmvOb+ahKyL/CfBETdIPWmx4+RLStricUaK71nJ BvPr/X8Hm34SCM7Da4vQo8FTsIbThznBDzd6emUJgmJFz8N9oGGae1T+GUr8H4ea8S78 XyPUZD21W2EMp7Ma5MMSfRuOx1mt0ZPha4TEYQ5v5YLPqLoFPA8E3pwp86z3+uFboq0W 5gCMRWYScQJ9/cpzvbU7XeS6B/1WqR5yFNWM7fmjQgP9KeppQfTkf4VrcRsq2RDZkViz UD0j4b0+anebGvTN19IW3T9CvVy5K+jGj12dsZkgLzlAsHnQUubw3UmnrJ+PWpaCYcVl 3Cbw== 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=SDadu1U/BcuAnzTexDW7zictMF42zgXBGclVmtyGo3U=; b=Wp5vZQTtoqaymz42pcHNRj/XbWz31c76cwHfdT2QcH6P8iXid0MXXJ+4/eWYmAdYJi bQQVR5ohlE5m7hvQOTVfulGerYmfMqQvu4Kzq0/z0wnNDWSHaRYVRaAKGHnjPfw61RNj RCkF6ZLf1rplXCvNxCBfAC3euB1I0Rn0ICxfiRBofW3Ep7Y9aUGj6/lnoY3LUx6TYZCW iBCTMkqzK/ESYq/tS7ve8wvN0XS58KMPremXlEbyiArL9vKvQzPsgxj2avDi9s9E5Gw7 X8SpARYi9h3edMACiyiR42UDT0YHnOZrINQY9zicQCfJJ5u7m5/0eSLTUNgYyif3vYgH seTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lrB5950y; 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 p23-v6si20706802pgv.153.2018.05.09.04.39.26; Wed, 09 May 2018 04:39:41 -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=lrB5950y; 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 S934275AbeEILjC (ORCPT + 99 others); Wed, 9 May 2018 07:39:02 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36720 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933832AbeEILi7 (ORCPT ); Wed, 9 May 2018 07:38:59 -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=SDadu1U/BcuAnzTexDW7zictMF42zgXBGclVmtyGo3U=; b=lrB5950y6Sf+Pl54yJQxKc9S6 gQDQd7yamVu1YhghscdGzSsoQ8p/3VmopmVjYDd/sHanwiZysv/FnkSORUMBGcbRUItxTI4FypdVt 5v6CxqrYyoguJwHqaDlSp/RH2n5jEG9FeMk7V8DEfKVB+AaGvAMcWs335MCGMf5TI0qb3KAO0smm/ /4XwPiiWsNQlTlzG277ka70vzpiPNhs49I41M+FGSUTtw61alOuh0lOTkfLy9gk1XH1dfyyT8nJei veUmMBJy5xqYqI1enzbIxDjFIVPFniLZm5lW+KREN0K0WRjb6XQb8vkoawypS/pyeuWBu7XYFz1L1 CGZvg14LA==; 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 1fGNQp-000632-9m; Wed, 09 May 2018 11:38:51 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 335B42029FA13; Wed, 9 May 2018 13:38:49 +0200 (CEST) Date: Wed, 9 May 2018 13:38:49 +0200 From: Peter Zijlstra To: Johannes Weiner Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, cgroups@vger.kernel.org, Ingo Molnar , Andrew Morton , Tejun Heo , Balbir Singh , Mike Galbraith , Oliver Yang , Shakeel Butt , xxx xxx , Taras Kondratiuk , Daniel Walker , Vinayak Menon , Ruslan Ruslichenko , kernel-team@fb.com Subject: Re: [PATCH 6/7] psi: pressure stall information for CPU, memory, and IO Message-ID: <20180509113849.GJ12235@hirez.programming.kicks-ass.net> References: <20180507210135.1823-1-hannes@cmpxchg.org> <20180507210135.1823-7-hannes@cmpxchg.org> <20180509104618.GP12217@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180509104618.GP12217@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 09, 2018 at 12:46:18PM +0200, Peter Zijlstra wrote: > On Mon, May 07, 2018 at 05:01:34PM -0400, Johannes Weiner wrote: > > > @@ -2038,6 +2038,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) > > cpu = select_task_rq(p, p->wake_cpu, SD_BALANCE_WAKE, wake_flags); > > if (task_cpu(p) != cpu) { > > wake_flags |= WF_MIGRATED; > > + psi_ttwu_dequeue(p); > > set_task_cpu(p, cpu); > > } > > > > > +static inline void psi_ttwu_dequeue(struct task_struct *p) > > +{ > > + /* > > + * Is the task being migrated during a wakeup? Make sure to > > + * deregister its sleep-persistent psi states from the old > > + * queue, and let psi_enqueue() know it has to requeue. > > + */ > > + if (unlikely(p->in_iowait || (p->flags & PF_MEMSTALL))) { > > + struct rq_flags rf; > > + struct rq *rq; > > + int clear = 0; > > + > > + if (p->in_iowait) > > + clear |= TSK_IOWAIT; > > + if (p->flags & PF_MEMSTALL) > > + clear |= TSK_MEMSTALL; > > + > > + rq = __task_rq_lock(p, &rf); > > + update_rq_clock(rq); > > + psi_task_change(p, rq_clock(rq), clear, 0); > > + p->sched_psi_wake_requeue = 1; > > + __task_rq_unlock(rq, &rf); > > + } > > +} > > Yeah, no... not happening. > > We spend a lot of time to never touch the old rq->lock on wakeups. Mason > was the one pushing for that, so he should very well know this. > > The one cross-cpu atomic (iowait) is already a problem (the whole iowait > accounting being useless makes it even worse), adding significant remote > prodding is just really bad. Also, since all you need is the global number, I don't think you actually need any of this. See what we do for nr_uninterruptible. In general I think you want to (re)read loadavg.c some more, and maybe reuse a bit more of that.