Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp579219ybz; Wed, 15 Apr 2020 14:26:38 -0700 (PDT) X-Google-Smtp-Source: APiQypKAtPTp/Y6Je6gHGmG6Szm7DyUH9cses5jjJmG6tDwrzgLe44auKA3w9QvkzOw7Mapbx0vs X-Received: by 2002:a17:906:6987:: with SMTP id i7mr6964366ejr.12.1586985998646; Wed, 15 Apr 2020 14:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586985998; cv=none; d=google.com; s=arc-20160816; b=vgEWj8rOn+0KK2vGrzC588Khc3Z2XEMqkTeNQiufX5NrhnmldVXDQrJ0VOPb+4j1en zwFIMvdLkKlCZT3JeCqmjt7nguwZEYQEZxqK9er28RFZXr3bwcPMOH+tlnSd1+0ChQU/ DnqKFIQO8gw/eYfjtE8XHXuOg/+5AQ7HGbh3NRvGqX/hIURJBLfKQ8aFqnelYUVlT3rn vYOPCCe90Oi3i/BWq/KKs3ln8qfuVH5xSPKScT6lIu5UIqvrsdVLVMVjv3/xlZArUqtt QFEG2FpneIou0JuDNN0zqPA1Q3QpY38kxO9zwBWkoQPJZd2V3kCmQv0ILaTRxeEWoAMR f22A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5fWEtgrTH9zO0zIcoo+/a88VwILs4L6u8exqS9T3p3Q=; b=hn2TBXcPGP6BYyHz/WUBgwihhveNHpSHrwYtFJrgMeqFh5Ow50RQ38j+tDItDFFDVe +Ass14zKqfLp8p/SsdmpsmsDivEtsi/iyYgq5r3MF6OJ3WzoNSaUOBoWzwTwsYLf1Ns5 r8EdKHM9IF5Uph/hFA2f9y65VJOwCdpGL0M/EdZm3IK61oCQOdvfwJMzkHPFacW1hxPU 1mx4zFPIkEW1pno3VKUjWlIdY9Owajv7evYUR41GjQ8/J+l+dI2I3TLLixR+V4AdXXM7 V6YLfvybAkXwZyF/uNTEZqfGWC/OmvmXHIrhQwqELolz+OZVz4KvPwTit1Mgyh5zKrho zpVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=CdxfULn1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn21si12697273ejc.379.2020.04.15.14.26.15; Wed, 15 Apr 2020 14:26:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=CdxfULn1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439390AbgDNLhT (ORCPT + 99 others); Tue, 14 Apr 2020 07:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2439354AbgDNLhP (ORCPT ); Tue, 14 Apr 2020 07:37:15 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 111DDC061A0C for ; Tue, 14 Apr 2020 04:37:15 -0700 (PDT) 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; bh=5fWEtgrTH9zO0zIcoo+/a88VwILs4L6u8exqS9T3p3Q=; b=CdxfULn1HuYr2DH0TtLsK1gNPW okFN71fsxOtk+nhi/fEjZeFESbU9pMlpnAZf2UGJ/WhVZ8Hp3W/uIUId5L8DF5auMRNvtojwvdTfj tbwUEWv0f2FKXHsIgdla7khVMn3bUygjYF2Pp/56Ei9qKJPQ/dI3pExkzr4hPhwpjfMqclkXMfTC0 Of9NXq83F+NUCjcaerVe8hVaYG+7vhsId9uU4TcVP/bitBBkkAFXg6aWQ/ZQiVy8SdpUgw0Vgfzoo +mvHZyh2dJbEtzg/RfZtig9UfdsYQ3QllU6jgj43QtIF5GX3Nkn2L8NUDzcoo+7oiq/eMWApdTczB 4eHT7bKQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOJru-0005Ei-Hd; Tue, 14 Apr 2020 11:36:42 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 47DD7305EEC; Tue, 14 Apr 2020 13:36:39 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2B4692038BC5C; Tue, 14 Apr 2020 13:36:39 +0200 (CEST) Date: Tue, 14 Apr 2020 13:36:39 +0200 From: Peter Zijlstra To: vpillai Cc: Nishanth Aravamudan , Julien Desfossez , Tim Chen , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Aaron Lu , Aubrey Li , aubrey.li@linux.intel.com, Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , Joel Fernandes , joel@joelfernandes.org Subject: Re: [RFC PATCH 03/13] sched: Core-wide rq->lock Message-ID: <20200414113639.GS20730@hirez.programming.kicks-ass.net> References: <855831b59e1b3774b11c3e33050eac4cc4639f06.1583332765.git.vpillai@digitalocean.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <855831b59e1b3774b11c3e33050eac4cc4639f06.1583332765.git.vpillai@digitalocean.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 04, 2020 at 04:59:53PM +0000, vpillai wrote: > @@ -6400,8 +6464,15 @@ int sched_cpu_activate(unsigned int cpu) > /* > * When going up, increment the number of cores with SMT present. > */ > - if (cpumask_weight(cpu_smt_mask(cpu)) == 2) > + if (cpumask_weight(cpu_smt_mask(cpu)) == 2) { > static_branch_inc_cpuslocked(&sched_smt_present); > +#ifdef CONFIG_SCHED_CORE > + if (static_branch_unlikely(&__sched_core_enabled)) { > + rq->core_enabled = true; > + } > +#endif > + } > + > #endif > set_cpu_active(cpu, true); > > @@ -6447,8 +6518,16 @@ int sched_cpu_deactivate(unsigned int cpu) > /* > * When going down, decrement the number of cores with SMT present. > */ > - if (cpumask_weight(cpu_smt_mask(cpu)) == 2) > + if (cpumask_weight(cpu_smt_mask(cpu)) == 2) { > +#ifdef CONFIG_SCHED_CORE > + struct rq *rq = cpu_rq(cpu); > + if (static_branch_unlikely(&__sched_core_enabled)) { > + rq->core_enabled = false; > + } > +#endif > static_branch_dec_cpuslocked(&sched_smt_present); > + > + } > #endif > > if (!sched_smp_initialized) Aside from the fact that it's probably much saner to write this as: rq->core_enabled = static_key_enabled(&__sched_core_enabled); I'm fairly sure I didn't write this part. And while I do somewhat see the point of disabling core scheduling for a core that has only a single thread on, I wonder why we care. The thing is, this directly leads to the utter horror-show that is patch 6. It should be perfectly possible to core schedule a core with only a single thread on. It might be a tad silly to do, but it beats the heck out of the trainwreck created here. So how did this happen?