Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2474381imm; Mon, 28 May 2018 08:46:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr7m5OZjaUWadM8bLq+xc8AZB/C8UQfb0kl7tdNIuIlo0ufOe+VXWNNTpKzG9Ef+JVgwC+V X-Received: by 2002:a63:6383:: with SMTP id x125-v6mr10714276pgb.277.1527522393560; Mon, 28 May 2018 08:46:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527522393; cv=none; d=google.com; s=arc-20160816; b=cIWQm/JQHVtbZSjxvwAIoWgQbRjpRhRSqWQRwkOlQ7QMy+pQLSo09KTWktPZAA11V0 hJI5tDffvtcrL3jvlTj3xhalpqnGxuILyb1Wumyq0pVDbMDaSk8excEGxQaqFkmUXRTI Kyz9Mr2sHGYw9sqysVwXBvN9qff87wlAkdqfS0c3E0KmJ3jzMqYG/G9eNKLi4EZChcXF ubNsQnSxrA5dS1KITmt1P/gi9s8mPA92//0M7E1iHcVENUXvmycJhO6XlbqW/1f3m7+w uEJx0v9wWk5btDGzjZMwmqXxsBV38JQHIG6jmnLl8kuJEbFdj9HJYjAPJDGCQemd4fco JdjA== 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:arc-authentication-results; bh=o6x+xOW6uX6XcQZ4yk6DkVTvC9PoQkP57L7YWEeE4qs=; b=VkDDqd03Wv+ffNJ2wZFcc3W9PvBW5NdS38dstos9+ppwGM72lQrEjuDLqwW8/iPuCR Uxj715ZAiGQKNm8n67RD0xaRl7QZrXpIrsPJy6WoUU+T+aVnkOqd94SchFQI902rfCnh 5EYb2nkvR7eAdsPMMXn1+i5SP0tLh3aXXywyTUOJ3hu/34VCBGqwbB6HYCKSdZkjFjAh TnjB3fdw5QgU+IPkV8kk8cCjK7z0n5cao6xyDJM/rF6EfNTCeQxL91WU6Avzu23AVRkf pql1fJ1v5Sd3GaaCfT2kiwOBbBYZm4LNyMhYvnB70FwdK+KiYysXlhr9E8jpLLWxEDfI OYag== ARC-Authentication-Results: i=1; mx.google.com; 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 x17-v6si31171662pfh.354.2018.05.28.08.46.19; Mon, 28 May 2018 08:46:33 -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; 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 S969215AbeE1Ppt (ORCPT + 99 others); Mon, 28 May 2018 11:45:49 -0400 Received: from 9pmail.ess.barracuda.com ([64.235.154.210]:34186 "EHLO 9pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968684AbeE1Ppq (ORCPT ); Mon, 28 May 2018 11:45:46 -0400 Received: from mipsdag03.mipstec.com (mail3.mips.com [12.201.5.33]) by mx1402.ess.rzc.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA256 bits=128 verify=NO); Mon, 28 May 2018 15:45:16 +0000 Received: from mipsdag02.mipstec.com (10.20.40.47) by mipsdag03.mipstec.com (10.20.40.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Mon, 28 May 2018 08:45:21 -0700 Received: from localhost (10.20.78.219) by mipsdag02.mipstec.com (10.20.40.47) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 28 May 2018 08:45:21 -0700 Date: Mon, 28 May 2018 08:45:16 -0700 From: Paul Burton To: Peter Zijlstra CC: , 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: <20180528154516.c54b37ygekcn3p4g@pburton-laptop> References: <20180526154648.11635-1-paul.burton@mips.com> <20180526154648.11635-2-paul.burton@mips.com> <20180528144924.GE12217@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180528144924.GE12217@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20180512 X-BESS-ID: 1527522316-321458-31141-136399-1 X-BESS-VER: 2018.6-r1805181819 X-BESS-Apparent-Source-IP: 12.201.5.33 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.193454 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On Mon, May 28, 2018 at 04:49:24PM +0200, Peter Zijlstra wrote: > 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 Thanks for the link - just knowing that the intention is that only per-CPU kthreads are allowed on !active CPUs is useful. > , 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; Yes this looks good to me. Are you planning to submit your change to introduce is_per_cpu_kthread(), or shall I? Thanks, Paul