Received: by 10.213.65.68 with SMTP id h4csp2388747imn; Mon, 9 Apr 2018 02:43:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/5HWlnPc75TXVvD3f0Oup0NMFxo/PdL2JAUuBdK7l7SkA00eAYzrMRPSMYFKQ6ebkjSxlz X-Received: by 2002:a17:902:24c:: with SMTP id 70-v6mr37936725plc.384.1523267023870; Mon, 09 Apr 2018 02:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523267023; cv=none; d=google.com; s=arc-20160816; b=qL6VCC6dSqglSw3cx62NOOcgjb2q1IZ7WMdFcRtkPKqcT+Bt+MNoN0AWwWyjuE8AmH zCJygsI6ukxyYEUwv6G2t0iD4AlP76hQrArgb1RPIOxDUzC/OLrFcg1HdF/gMZxvZRJx 17t9n8tuUU76udJu6e0jW0CWNjDolz6AKW0t3WqsK5R52qeBOreh2xApCxfAp63s6xjt 6yIkYSAwCDIbL0RZcW5WIIrmU+sLTypHofPl/JQUgjxv/utIB5OthJrBmiVgnXMrwVB6 7IUZ49Ffpybbm5IRkEhEc1wH3i1ujJfaZdl19eBMcbvmAfIRzAkEjD8gX5KBKVcD9k7H gJfw== 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=s6O388VxLcL/++C0fw5Hah0Hp2lKq1/DP6wK8lNFC50=; b=YJL/gMxyjibGO64cpWaKR4bPKdbSgYIZDOVIn6ccVcybEFeYjgcnlzP9jaNzOQ9g9L qk9zh7/6ijxPcmBRa4fabSWpzLTWkAaOCyg0Trk8W/hiMZPSqRDheMUk0c2LhbM/x6hS wLpw3VxKUIxaBMOCa4gqSkagPUECSNO0BgsB0tRm7jsMaRvunllXrHXx80TKvyp1Fo6h ao+QAgRX0Ia3Zaw8XEYpzPQwBssl8HoM30ceLeZu74vqVjM7j/3rkQLvMim3HyLv82II JenggZfjBdKX4yb7/LhgiHMSKbNqTbb8J9qNRYZEW6g+vGhbPByEWzPVCBfuVK4FX5CQ 4RvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=j1XL3ihf; 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 u45si10993946pgn.702.2018.04.09.02.43.06; Mon, 09 Apr 2018 02:43:43 -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=merlin.20170209 header.b=j1XL3ihf; 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 S1752238AbeDIJkO (ORCPT + 99 others); Mon, 9 Apr 2018 05:40:14 -0400 Received: from merlin.infradead.org ([205.233.59.134]:51794 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970AbeDIJkM (ORCPT ); Mon, 9 Apr 2018 05:40:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=s6O388VxLcL/++C0fw5Hah0Hp2lKq1/DP6wK8lNFC50=; b=j1XL3ihfg3a3a550zuxl3Nc9r URH/JWAIaCwpn6KFEOptgFRPYsy7gyNUFpF+sTY2Ehk99rx2IMm5Df1n2+8vJEMvgOO23JgId4Wf3 D7FBcn4rM0DXw+qzn8jBF5L6BGB4Ayq475+nlwM/PcV6A74ldyGjpPv5QLTOMOffgfEZrmm41mvEq Yridh+6rn4NQ9XAIdKhBbRJoH+jXm/qq8uvanH8BjS+pPdJUwGvYhzAeFrAFE2THa4RCGVXX2Cbhn fa7kqWoQhyHrQj6AR0AY9VCSdJoY3rh+CfLXkDQh1MKVVFNs0MjfD5UkTp8/lFefWZ8V2M+M67p6g uoM+LP8Og==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5THQ-0004sz-By; Mon, 09 Apr 2018 09:40:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AF80B202A4A09; Mon, 9 Apr 2018 11:40:01 +0200 (CEST) Date: Mon, 9 Apr 2018 11:40:01 +0200 From: Peter Zijlstra To: Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Quentin Perret , Thara Gopinath , linux-pm@vger.kernel.org, Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , "Rafael J . Wysocki" , Greg Kroah-Hartman , Vincent Guittot , Viresh Kumar , Todd Kjos , Joel Fernandes Subject: Re: [RFC PATCH 3/6] sched: Add over-utilization/tipping point indicator Message-ID: <20180409094001.GZ4043@hirez.programming.kicks-ass.net> References: <20180320094312.24081-1-dietmar.eggemann@arm.com> <20180320094312.24081-4-dietmar.eggemann@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180320094312.24081-4-dietmar.eggemann@arm.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (I know there is a new version out; but I was reading through this to catch up with the discussion) On Tue, Mar 20, 2018 at 09:43:09AM +0000, Dietmar Eggemann wrote: > +static inline int sd_overutilized(struct sched_domain *sd) > +{ > + return READ_ONCE(sd->shared->overutilized); > +} > + > +static inline void update_overutilized_status(struct rq *rq) > +{ > + struct sched_domain *sd; > + > + rcu_read_lock(); > + sd = rcu_dereference(rq->sd); > + if (sd && !sd_overutilized(sd) && cpu_overutilized(rq->cpu)) > + WRITE_ONCE(sd->shared->overutilized, 1); > + rcu_read_unlock(); > +} > +#else I think you ought to go have a look at the end of kernel/sched/topology.c:sd_init(), where it says: /* * For all levels sharing cache; connect a sched_domain_shared * instance. */ if (sd->flags & SD_SHARE_PKG_RESOURCES) { sd->shared = *per_cpu_ptr(sdd->sds, sd_id); atomic_inc(&sd->shared->ref); atomic_set(&sd->shared->nr_busy_cpus, sd_weight); } Because if I read all this correctly, your code assumes sd->shared exists unconditionally, while the quoted bit only ensures it does so <= LLC.