Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933434AbcKGSo5 (ORCPT ); Mon, 7 Nov 2016 13:44:57 -0500 Received: from smtpi-sp-236.kinghost.net ([177.185.201.236]:60923 "EHLO smtpi-sp-236.kinghost.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932773AbcKGSoz (ORCPT ); Mon, 7 Nov 2016 13:44:55 -0500 X-Greylist: delayed 364 seconds by postgrey-1.27 at vger.kernel.org; Mon, 07 Nov 2016 13:44:55 EST Subject: Re: [PATCH] sched/rt: RT_RUNTIME_GREED sched feature To: Steven Rostedt , Clark Williams References: <20161107122221.299d026a@tagon> <20161107133046.7e4458c1@gandalf.local.home> Cc: Daniel Bristot de Oliveira , Ingo Molnar , Peter Zijlstra , Christoph Lameter , linux-rt-users , LKML From: Daniel Bristot de Oliveira Message-ID: <5d1b0eb1-6bf5-7148-a7b0-58ef1e0fd37f@bristot.me> Date: Mon, 7 Nov 2016 19:38:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161107133046.7e4458c1@gandalf.local.home> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1645 Lines: 42 On 11/07/2016 07:30 PM, Steven Rostedt wrote: >> I'm still reviewing the patch, but I have to wonder why bother with making it a scheduler feature? >> > >> > The SCHED_FIFO definition allows a fifo thread to starve others >> > because a fifo task will run until it yields. Throttling was added as >> > a safety valve to allow starved SCHED_OTHER tasks to get some cpu >> > time. Adding this unconditionally gets us a safety valve for >> > throttling a badly written fifo task, but allows the fifo task to >> > continue to consume cpu cycles if it's not starving anyone. >> > >> > Or am I missing something that's blazingly obvious? > Or I say make it the default. If people want the old behavior, they can > modify SCHED_FEATURES to do so. I added it as a feature to keep the current behavior by default. Currently, we have two throttling modes: With RT_RUNTIME_SHARING (default): before throttle, try to borrow some runtime from other CPU. Without RT_RUNTIME_SHARING: throttle the RT task, even if there is nothing else to do. The problem of the first is that an CPU easily borrow enough runtime to make the spin-rt-task to run forever, allowing the starvation of the non-rt-tasks, hence invalidating the mechanism. The problem of the second is that (with the default values) the CPU will be idle 5% of the time. IMHO, the balanced behavior is using GREED option + without RT_RUNTIME_SHARING: the non-rt tasks will be able to run, while avoiding CPU going idle. We can turn it by default setting default options. Moreover, AFAICS, these sched options are static keys, so they are very very low overhead conditions. -- Daniel