Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755382AbeAHWS5 (ORCPT + 1 other); Mon, 8 Jan 2018 17:18:57 -0500 Received: from merlin.infradead.org ([205.233.59.134]:57334 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750827AbeAHWS4 (ORCPT ); Mon, 8 Jan 2018 17:18:56 -0500 Date: Mon, 8 Jan 2018 23:18:51 +0100 From: Peter Zijlstra To: subhra mazumdar Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, steven.sistare@oracle.com, dhaval.giani@oracle.com Subject: Re: [RFC PATCH V2] sched: Improve scalability of select_idle_sibling using SMT balance Message-ID: <20180108221851.GV29822@worktop.programming.kicks-ass.net> References: <20180108221237.31761-1-subhra.mazumdar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180108221237.31761-1-subhra.mazumdar@oracle.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon, Jan 08, 2018 at 02:12:37PM -0800, subhra mazumdar wrote: > @@ -2751,6 +2763,31 @@ context_switch(struct rq *rq, struct task_struct *prev, > struct task_struct *next, struct rq_flags *rf) > { > struct mm_struct *mm, *oldmm; > + int this_cpu = rq->cpu; > + struct sched_domain *sd; > + int prev_busy, next_busy; > + > + if (rq->curr_util == UTIL_UNINITIALIZED) > + prev_busy = 0; > + else > + prev_busy = (prev != rq->idle); > + next_busy = (next != rq->idle); > + > + /* > + * From sd_llc downward update the SMT utilization. > + * Skip the lowest level 0. > + */ > + sd = rcu_dereference_sched(per_cpu(sd_llc, this_cpu)); > + if (next_busy != prev_busy) { > + for_each_lower_domain(sd) { > + if (sd->level == 0) > + break; > + sd_context_switch(sd, rq, next_busy - prev_busy); > + } > + } > + No, we're not going to be adding atomic ops here. We've been arguing over adding a single memory barrier to this path, atomic are just not going to happen. Also this is entirely the wrong way to do this, we already have code paths that _know_ if they're going into or coming out of idle.