Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3672427imm; Mon, 6 Aug 2018 08:39:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeJeeT4r2JsWlc2Sq2ioKiNKwhMasbZmLdABg4hErx/rgEW6ISyDvFcIhHxjZIjK6dbAZau X-Received: by 2002:a62:c819:: with SMTP id z25-v6mr17454858pff.44.1533569974034; Mon, 06 Aug 2018 08:39:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533569974; cv=none; d=google.com; s=arc-20160816; b=MATXb2trbEw2sieHHANHkGaTYgDUnW0y7ZveYJtu5oFLu9tJ154KredL7pKPitUwpO 1aQV4wGTJNTYffxYvm18jqIqNuqbVzIJRGpgQDyir8MQM3DWJoADA5ISpO4l5Uz2Nvps j49XHRrBKcvHZImMzUsejqNE8CAs7NEye1+JtXNKkEXx6Y0pUzvE36NJrAoFNkivTlwt RCJFCcImncFoq6ETpbTkuHddO9WSW8TEyWPRPTZG0uvg/AY3wJHrga3naPY/CudOIOu9 6N736fila9pS4sAbKpWC++4Yd9+tZLWw7xS3tSm5dqKiPwmW+QOt1TnI2S/uuZAIC3gM eWcQ== 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=qGtFj7QGQQt9S5+V3oAQSCBbiSZ7fGINDfjcXzvk80A=; b=I2Js5EpIrA3Prq571Br3S7QdaP16qlYOnuG8M96arVaQyIBiz251ruxzx0wnKP5y+o 1aiCqDYdND0Jy5C25aVYjpxqUeGsaHo8BFMKEmctQreCY+n4/TaS3h+eC/DVk0WKtv3a +U6aqlqZw4nUVcfSy9IXugmGN/MbVY+vNPLMUzh0tUqhODG11tnLiv9JqyvCITwyoIQV iR/wveFyigyXTfXZe5h2kli2iaYIp8RQdHcTumNshf5aM4ooOvbT9FALaZd6W4bat7Ze sa/9vW6mLibtRC/AZfVQYjtiY633uCeMMG06svRthpACNPNq1jGQn3aIklph8qSv+kTL Mjvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=doipVUdh; 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 z15-v6si12889840pgf.293.2018.08.06.08.39.18; Mon, 06 Aug 2018 08:39:34 -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=doipVUdh; 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 S1732862AbeHFRrd (ORCPT + 99 others); Mon, 6 Aug 2018 13:47:33 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:39538 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729724AbeHFRrd (ORCPT ); Mon, 6 Aug 2018 13:47:33 -0400 Received: by mail-qk0-f193.google.com with SMTP id b5-v6so9173675qkg.6 for ; Mon, 06 Aug 2018 08:37:54 -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=qGtFj7QGQQt9S5+V3oAQSCBbiSZ7fGINDfjcXzvk80A=; b=doipVUdhWQjSItLgotm8duswFctbnFegpnQzV8RbRWdGIBRLv4YoA4CdkusAOiMjtI gFA0jFlkbOr2humb2F+PzGx1sQmQsyESlBXXmBRIHN5kaRJ07i1P1GbuCODQtfM10dbj Fm33vvDZdiXtFyk1SwCw30dF26jTaU4w5Msi4wr06kM1xIRwjUwq5l5aU49g1WmWrK/s jmtELt0EA5SuLdTLyLTf6l3ybX4JKr33fmYWbpIS0yvtnjEgl8f8G9idOVNBOEHQfrSH Gjb/AP8fa/0hkJYASs03WBYrzR75uVwYzlsEuYbhcJnhk+YY1nT5Ruf3aLpKMFG8MmLe q36A== 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=qGtFj7QGQQt9S5+V3oAQSCBbiSZ7fGINDfjcXzvk80A=; b=Pe+7mcxpWzQwuHPxyd0HJpzxjFICR+do4VdxHrq68LptU+DN622ifbiX3M2b7WE8bd RP7QoLLBIrWwzLRcwps6QgJ311aHPzDmzdgfYQNKRyY4zMzogx+q6tFPWF9fQJ+B2XCf wQZX9Q2IguUgHgtsjd/ZxgVxEh8GWCIMjDPLAhl5mk1uhRiZxZ0x08+fh5ouR9bwEQhi wV4V+OJ/ydTvHqym4ODkdEvLHUk7QQGRKFQzEgZ1FXo/Z5lMM33xg7b0yLqE8/HhP6l2 A5w71LOURsAND1M8BD20zdOZbO77gju8WHeoGQO/eKy6wgcRwPswI12U0DKlRSGQiq14 s8Pg== X-Gm-Message-State: AOUpUlGhrcAZSFP493xUZkuNZpXVfEsm2zk+6WssVEAmBBScbFZtQVhA R931+MUjO9zfi3j/tRHRxZyo+A== X-Received: by 2002:a37:71c7:: with SMTP id m190-v6mr13962620qkc.275.1533569873837; Mon, 06 Aug 2018 08:37:53 -0700 (PDT) Received: from localhost (pool-96-246-38-36.nycmny.fios.verizon.net. [96.246.38.36]) by smtp.gmail.com with ESMTPSA id t11-v6sm9584120qkt.28.2018.08.06.08.37.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Aug 2018 08:37:52 -0700 (PDT) Date: Mon, 6 Aug 2018 11:40:51 -0400 From: Johannes Weiner To: Peter Zijlstra 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: <20180806154051.GA14209@cmpxchg.org> References: <20180801151958.32590-1-hannes@cmpxchg.org> <20180801151958.32590-9-hannes@cmpxchg.org> <20180803165641.GA2476@hirez.programming.kicks-ass.net> <20180806150550.GA9888@cmpxchg.org> <20180806152528.GM2494@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180806152528.GM2494@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 Mon, Aug 06, 2018 at 05:25:28PM +0200, Peter Zijlstra wrote: > 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). Okay, the tick updater sounds like a much better option then. HZ frequency should produce more than recent enough data. That means we will retain the not-so-nice PF_MEMSTALL flag test under rq lock, but it'll eliminate most of that memory ordering headache. I'll do that. Thanks!