Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2423676imm; Mon, 28 May 2018 07:51:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZofdQ7OCYyYOfUkpwK/te/qtZXBq40N0+nIPvu+eDI6pBEWft6o3+F/29YNiUmeyBAlMo2f X-Received: by 2002:a17:902:7146:: with SMTP id u6-v6mr13639595plm.289.1527519108074; Mon, 28 May 2018 07:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527519108; cv=none; d=google.com; s=arc-20160816; b=ZBvW/f7+aTz0srcFYzXvYnBNrY/OggSkiYg5N+1QsU5GhQBJljAuVhcWxKtWs+LmS0 qJodZwvBG4B0QxADJUg+HaoLHwI/YtykM87kwVTRKsFPxu9QNZv9kkNFI2h0IrwdRxBh FbxynAA1XKs8XAcgnf/yIsOI3CdAUAQeNGq7uXDmK1imcmBlehczJdgClQUmPjpWruLh 9cJmLBLjUb7yJqoto384K2QKBvH7nL+EkkislrR60jwGe0McOY3UcY8dFndv2JA0yrS1 vI4wdjhFil2Gn1L8BD83zW9GSkZnywBV64xMYDgaHnOxumvwGqXDTbXE15NhUF63xgn6 bSfw== 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=E//nsqqRpbJ7t92OLBWgV3NQ1WVUkInBpwSbQZOuDKU=; b=VIYrEdx+OMScbJAq/V/JyL8Eaiq0wAT+pkT9GBS7dTT7+GukkyhNyz3xEj4U+VHYvx k8b9wGOF7+92ydLhxcuimbxK9HrteUSIQC6+uoV7qWycwgRmMW7X6XYG4pNFgZoCWPut J9UHRAPGGFSbeF/8rOSbH49MtHC/auIoQQpambcYIC+OcGDIWYkgYCEvaRxoV4YuLKUY wwCSL6ZWDp/n00U5zBvu0LWEcPT/461yz6DGr0ZdvJrHWgu2nzsBom8OHhRn/QPR5173 sNZlCavRTs36IxIiSb1j2L0Iy9PZ3kGnkGxo+u70zrKuraGlZvED3UJeCL4DEjcIk/nZ ZgcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jKlIHJSu; 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 w10-v6si3799887pgt.404.2018.05.28.07.51.33; Mon, 28 May 2018 07:51:48 -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=jKlIHJSu; 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 S939289AbeE1Otr (ORCPT + 99 others); Mon, 28 May 2018 10:49:47 -0400 Received: from merlin.infradead.org ([205.233.59.134]:48514 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932390AbeE1Otm (ORCPT ); Mon, 28 May 2018 10:49:42 -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=E//nsqqRpbJ7t92OLBWgV3NQ1WVUkInBpwSbQZOuDKU=; b=jKlIHJSuaaIpi7SMILsQZlVUZ AxtOFR8eh4dssibrRDwexP/sM56DxgIZ90ZYhJlzPbcKCyIQAp2sgCipwYiYxwaneJMCheVOuVh0s QR2AEB8N4xrPMxvZEAK6PQPsmbqdar5EfNTm7Az7ePFLe2f0fQwnhyF4hffyk4cfZsZ/R9kIXSvsr iwZdFZvEfEPQeDdeemc3fjrWO7qTrdWlx9GsWjUqJg6kG83jIiCadWzYGojA2ADc5rTBcbmfWx017 I5deWiJd1XFa+GDjitwZY8dG98MTzT5gZY6LRDRgCCh7WPd703AqwZXZ4SJtTju4hvJyJtfwRVkNd LMhJxNweQ==; 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 1fNJSf-0002e8-T0; Mon, 28 May 2018 14:49:26 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 835C82029F1C1; Mon, 28 May 2018 16:49:24 +0200 (CEST) Date: Mon, 28 May 2018 16:49:24 +0200 From: Peter Zijlstra To: Paul Burton Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Paul McKenney , Tejun Heo Subject: Re: [PATCH 1/2] sched: Make select_task_rq() require cpu_active() for user tasks Message-ID: <20180528144924.GE12217@hirez.programming.kicks-ass.net> References: <20180526154648.11635-1-paul.burton@mips.com> <20180526154648.11635-2-paul.burton@mips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180526154648.11635-2-paul.burton@mips.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 26, 2018 at 08:46:47AM -0700, Paul Burton wrote: > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -1565,7 +1565,8 @@ int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags) > * not worry about this generic constraint ] > */ > if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) || > - !cpu_online(cpu))) > + !cpu_online(cpu) || > + (!cpu_active(cpu) && !(p->flags & PF_KTHREAD)))) > cpu = select_fallback_rq(task_cpu(p), p); That is not quite right.. and I find that the wrong patch: 955dbdf4ce87 ("sched: Allow migrating kthreads into online but inactive CPUs") got merged over my suggested alternative :-( http://lkml.kernel.org/r/20170725165821.cejhb7v2s3kecems@hirez.programming.kicks-ass.net So, lets first fix that, and then your patch becomes something like the below I think. --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1562,7 +1562,7 @@ int select_task_rq(struct task_struct *p * not worry about this generic constraint ] */ if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) || - !cpu_online(cpu))) + (is_per_cpu_kthread(p) ? !cpu_online(cpu) : !cpu_active(cpu))) cpu = select_fallback_rq(task_cpu(p), p); return cpu;