[PATCH]sched: Isochronous class v2 for unprivileged soft rt scheduling

From: Con Kolivas (kernel_at_kolivas.org)
Date: 01/19/05

  • Next message: George Anzinger: "Re: [PATCH] dynamic tick patch"
    Date:	Thu, 20 Jan 2005 09:39:45 +1100
    To: linux <linux-kernel@vger.kernel.org>
    
    
    

    This is version 2 of the SCHED_ISO patch with the yield bug fixed and
    code cleanups.

    This patch for 2.6.11-rc1 provides a method of providing real time
    scheduling to unprivileged users which increasingly is desired for
    multimedia workloads.

    It does this by adding a new scheduling class called SCHED_ISO or
    Isochronous scheduling which means "same time" scheduling. This class
    does not require superuser privileges and is starvation free. The
    scheduling class no. 4 was chosen since there are quite a few userspace
    applications already supporting 3 and 4 for SCHED_BATCH and SCHED_ISO
    respectively on non-mainline kernels. As a way of immediately providing
    support for current userspace apps, any unprivileged user starting an
    application requesting SCHED_RR or SCHED_FIFO will be demoted to
    SCHED_ISO. This may or may not be worth removing later.

    The SCHED_ISO class runs as SCHED_RR effectively at a priority just
    above all SCHED_NORMAL tasks and below all true real time tasks. Once a
    cpu usage limit is exceeded by tasks of this class (per cpu), SCHED_ISO
    tasks will then run as SCHED_NORMAL until the cpu usage drops to 90% of
    the cpu limit.

    By default the cpu limit is set to 70% which literature suggests should
    provide good real time behaviour for most applications without gross
    unfairness. This cpu limit is calculated as a decaying average over 5
    seconds. These limits are configurable with the tunables
    /proc/sys/kernel/iso_cpu
    /proc/sys/kernel/iso_period

    iso_cpu can be set to 100 which would allow all unprivileged users
    access to unrestricted SCHED_RR behaviour. OSX provides a similar class
    to SCHED_ISO and uses 90% as its cpu limit.

    The sysrq-n combination which converts all user real-time tasks to
    SCHED_NORMAL also will affect SCHED_ISO tasks.

    Currently the round robin interval is set to 10ms which is a cache
    friendly timeslice. It may be worth making this configurable or smaller,
    and it would also be possible to implement SCHED_ISO of a FIFO nature as
    well.

    For testing, the userspace tool schedtool available here:
    http://freequaos.host.sk/schedtool/
    can be used as a wrapper to start SCHED_ISO tasks
    schedtool -I -e xmms
    for example

    Patch also available here:
    http://ck.kolivas.org/patches/SCHED_ISO/

    Signed-off-by: Con Kolivas <kernel@kolivas.org>

    
    

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/



  • Next message: George Anzinger: "Re: [PATCH] dynamic tick patch"

    Relevant Pages

    • [PATCH][RFC] sched: Isochronous class for unprivileged soft rt scheduling
      ... This patch for 2.6.11-rc1 provides a method of providing real time ... It does this by adding a new scheduling class called SCHED_ISO or ... By default the cpu limit is set to 70% which literature suggests should ... iso_cpu can be set to 100 which would allow all unprivileged users ...
      (Linux-Kernel)
    • Re: initial rusage patch.
      ... I have updated the patch at the same location to solve various exit related races. ... I have only to fix the cpu limit code. ... The only disadvantage to 2 and 3 is that they require extra space in the proc but reduce runtime, especially on systems with no limits. ... the only time we need locks is in rufetchwhere we aggregate the threads counters and rusage structs into one allocated by the caller. ...
      (freebsd-arch)