From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB5A8C10F14 for ; Thu, 3 Oct 2019 17:42:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9256120830 for ; Thu, 3 Oct 2019 17:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570124532; bh=kO0edMERiMK1zTYPPeg2W8nnKeWuXmPCqlnwYezt6do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lX+dzkZI2Rz5S+XVoTeCxGk4XmyqabkDjw31PqwRYOyXYAO0HWjWY1JCKBPEzhHaw E+oQI/8bjfk+6X2u+18t3B4P3slaydb7tryumHKRphrmUzXl7xpZ6y7eJ2TjbkVN+z XFYeFz3IHaBSVHnp8zDERyzedyjacn7LQ90p/9bE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730969AbfJCP5c (ORCPT ); Thu, 3 Oct 2019 11:57:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:39874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729870AbfJCP51 (ORCPT ); Thu, 3 Oct 2019 11:57:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 414B2222BE; Thu, 3 Oct 2019 15:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570118246; bh=kO0edMERiMK1zTYPPeg2W8nnKeWuXmPCqlnwYezt6do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CE3SoDT8ONWV9+1oB7hjp0BE4cyQgjy7BTzfGlyET2+10V218BP3u81T3fi/O+lDu C1UKgZpZ97+7P3/hUju5XrzzfOrEis7oJwnF7RXOLOlHXi6xm/6tGnkYB5GSGRBMPb eJdZFerVkL+o+IBKdXvjQDMiTY1TMCyyvdKI8BuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juri Lelli , "Peter Zijlstra (Intel)" , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Daniel Bristot de Oliveira , Tejun Heo , Linus Torvalds , Thomas Gleixner , lizefan@huawei.com, longman@redhat.com, luca.abeni@santannapisa.it, rostedt@goodmis.org, Ingo Molnar , Sasha Levin Subject: [PATCH 4.4 40/99] sched/core: Fix CPU controller for !RT_GROUP_SCHED Date: Thu, 3 Oct 2019 17:53:03 +0200 Message-Id: <20191003154314.889222769@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154252.297991283@linuxfoundation.org> References: <20191003154252.297991283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Juri Lelli [ Upstream commit a07db5c0865799ebed1f88be0df50c581fb65029 ] On !CONFIG_RT_GROUP_SCHED configurations it is currently not possible to move RT tasks between cgroups to which CPU controller has been attached; but it is oddly possible to first move tasks around and then make them RT (setschedule to FIFO/RR). E.g.: # mkdir /sys/fs/cgroup/cpu,cpuacct/group1 # chrt -fp 10 $$ # echo $$ > /sys/fs/cgroup/cpu,cpuacct/group1/tasks bash: echo: write error: Invalid argument # chrt -op 0 $$ # echo $$ > /sys/fs/cgroup/cpu,cpuacct/group1/tasks # chrt -fp 10 $$ # cat /sys/fs/cgroup/cpu,cpuacct/group1/tasks 2345 2598 # chrt -p 2345 pid 2345's current scheduling policy: SCHED_FIFO pid 2345's current scheduling priority: 10 Also, as Michal noted, it is currently not possible to enable CPU controller on unified hierarchy with !CONFIG_RT_GROUP_SCHED (if there are any kernel RT threads in root cgroup, they can't be migrated to the newly created CPU controller's root in cgroup_update_dfl_csses()). Existing code comes with a comment saying the "we don't support RT-tasks being in separate groups". Such comment is however stale and belongs to pre-RT_GROUP_SCHED times. Also, it doesn't make much sense for !RT_GROUP_ SCHED configurations, since checks related to RT bandwidth are not performed at all in these cases. Make moving RT tasks between CPU controller groups viable by removing special case check for RT (and DEADLINE) tasks. Signed-off-by: Juri Lelli Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Michal Koutný Reviewed-by: Daniel Bristot de Oliveira Acked-by: Tejun Heo Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: lizefan@huawei.com Cc: longman@redhat.com Cc: luca.abeni@santannapisa.it Cc: rostedt@goodmis.org Link: https://lkml.kernel.org/r/20190719063455.27328-1-juri.lelli@redhat.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- kernel/sched/core.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0e70bfeded7fd..d81bcc6362fff 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8339,10 +8339,6 @@ static int cpu_cgroup_can_attach(struct cgroup_taskset *tset) #ifdef CONFIG_RT_GROUP_SCHED if (!sched_rt_can_attach(css_tg(css), task)) return -EINVAL; -#else - /* We don't support RT-tasks being in separate groups */ - if (task->sched_class != &fair_sched_class) - return -EINVAL; #endif } return 0; -- 2.20.1