Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752973AbdIFKo1 (ORCPT ); Wed, 6 Sep 2017 06:44:27 -0400 Received: from merlin.infradead.org ([205.233.59.134]:33670 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbdIFKo0 (ORCPT ); Wed, 6 Sep 2017 06:44:26 -0400 Date: Wed, 6 Sep 2017 12:44:20 +0200 From: Peter Zijlstra To: Chris Wilson Cc: Andy Lutomirski , Ingo Molnar , "linux-kernel@vger.kernel.org" Subject: Re: Abysmal scheduler performance in Linus' tree? Message-ID: <20170906104420.ic5lbpacpyyz53w5@hirez.programming.kicks-ass.net> References: <150468933360.28581.16446660443497682079@mail.alporthouse.com> <20170906092427.poloe4aczytwtggk@hirez.programming.kicks-ass.net> <150469312649.28581.17626550155735691534@mail.alporthouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <150469312649.28581.17626550155735691534@mail.alporthouse.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1273 Lines: 35 On Wed, Sep 06, 2017 at 11:18:46AM +0100, Chris Wilson wrote: > > +static void get_llc_stats(struct llc_stats *stats, int cpu) > > +{ > > + struct sched_domain_shared *sds = rcu_dereference(per_cpu(sd_llc_shared, cpu)); > > + > > + if (!sds) { > > + memset(&stats, 0, sizeof(*stats)); > > Yes, I even sent you a mail about it ;) Bah, too much email, sorry :-( > > + /* > > + * The has_capacity stuff is not SMT aware, but by trying to balance > > + * the nr_running on both ends we try and fill the domain at equal > > + * rates, thereby first consuming cores before siblings. > > + */ > > + > > + /* if the old cache has capacity, stay there */ > > + if (prev_stats.has_capacity && prev_stats.nr_running < this_stats.nr_running+1) > > + return false; > > + > > + /* if this cache has capacity, come here */ > > + if (this_stats.has_capacity && this_stats.nr_running < prev_stats.nr_running+1) > > + return true; > > This is still not working as intended, it should be > > if (this_stats.has_capacity && this_stats.nr_running+1 < prev_stats.nr_running) > return true; > > to fix the regression. Argh, you're quite right. Let me do a patch for that.