1. 04 Mar, 2011 4 commits
    • Darren Hart's avatar
      sched: Allow users with sufficient RLIMIT_NICE to change from SCHED_IDLE policy · c02aa73b
      Darren Hart authored
      The current scheduler implementation returns -EPERM when trying to
      change from SCHED_IDLE to SCHED_OTHER or SCHED_BATCH. Since SCHED_IDLE
      is considered to be a nice 20 on steroids, changing to another policy
      should be allowed provided the RLIMIT_NICE is accounted for.
      
      This patch allows the following test-case to pass with RLIMIT_NICE=40,
      but still fail with RLIMIT_NICE=10 when the calling process is run
      from a typical shell (nice 0, or 20 in rlimit terms).
      
      int main()
      {
      	int ret;
      	struct sched_param sp;
      	sp.sched_priority = 0;
      
      	/* switch to SCHED_IDLE */
      	ret = sched_setscheduler(0, SCHED_IDLE, &sp);
      	printf("setscheduler IDLE: %d\n", ret);
      	if (ret) return ret;
      
      	/* switch back to SCHED_OTHER */
      	ret = sched_setscheduler(0, SCHED_OTHER, &sp);
      	printf("setscheduler OTHER: %d\n", ret);
      
      	return ret;
      }
      
       $ ulimit -e
       40
       $ ./test
       setscheduler IDLE: 0
       setscheduler OTHER: 0
      
       $ ulimit -e 10
       $ ulimit -e
       10
       $ ./test
       setscheduler IDLE: 0
       setscheduler OTHER: -1
      Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
      LKML-Reference: <4D657BEE.4040608@linux.intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c02aa73b
    • Darren Hart's avatar
      sched: Allow SCHED_BATCH to preempt SCHED_IDLE tasks · a2f5c9ab
      Darren Hart authored
      Perform the test for SCHED_IDLE before testing for SCHED_BATCH (and
      ensure idle tasks don't preempt idle tasks) so the non-interactive,
      but still important, SCHED_BATCH tasks will run in favor of the very
      low priority SCHED_IDLE tasks.
      Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: default avatarMike Galbraith <efault@gmx.de>
      Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
      LKML-Reference: <1298408674-3130-2-git-send-email-dvhart@linux.intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a2f5c9ab
    • Ingo Molnar's avatar
      Merge branch 'sched/urgent' into sched/core · e0a92c17
      Ingo Molnar authored
      Merge reason: Add fixes before applying dependent patches.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e0a92c17
    • Balbir Singh's avatar
      sched: Fix sched rt group scheduling when hierachy is enabled · 0c3b9168
      Balbir Singh authored
      The current sched rt code is broken when it comes to hierarchical
      scheduling, this patch fixes two problems
      
      1. It adds redundant enqueuing (harmless) when it finds a queue
         has tasks enqueued, but it has no run time and it is not
         throttled.
      
      2. The most important change is in sched_rt_rq_enqueue/dequeue.
         The code just picks the rt_rq belonging to the current cpu
         on which the period timer runs, the patch fixes it, so that
         the correct rt_se is enqueued/dequeued.
      
      Tested with a simple hierarchy
      
      /c/d, c and d assigned similar runtimes of 50,000 and a while
      1 loop runs within "d". Both c and d get throttled, without
      the patch, the task just stops running and never runs (depends
      on where the sched_rt b/w timer runs). With the patch, the
      task is throttled and runs as expected.
      
      [ bharata, suggestions on how to pick the rt_se belong to the
        rt_rq and correct cpu ]
      Signed-off-by: default avatarBalbir Singh <balbir@linux.vnet.ibm.com>
      Acked-by: default avatarBharata B Rao <bharata@linux.vnet.ibm.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: stable@kernel.org
      LKML-Reference: <20110303113435.GA2868@balbir.in.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0c3b9168
  2. 03 Mar, 2011 29 commits
  3. 02 Mar, 2011 7 commits