Skip to content

Commit

Permalink
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm…
Browse files Browse the repository at this point in the history
…/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
 "Three small fixes"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/clock: Prevent tracing recursion in sched_clock_cpu()
  stop_machine: Fix^2 race between stop_two_cpus() and stop_cpus()
  sched/deadline: Deny unprivileged users to set/change SCHED_DEADLINE policy
  • Loading branch information
Linus Torvalds committed Mar 16, 2014
2 parents b44eeb4 + 96b3d28 commit 59bf6c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions kernel/sched/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@ u64 sched_clock_cpu(int cpu)
if (unlikely(!sched_clock_running))
return 0ull;

preempt_disable();
preempt_disable_notrace();
scd = cpu_sdc(cpu);

if (cpu != smp_processor_id())
clock = sched_clock_remote(scd);
else
clock = sched_clock_local(scd);
preempt_enable();
preempt_enable_notrace();

return clock;
}
Expand Down
9 changes: 9 additions & 0 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3338,6 +3338,15 @@ static int __sched_setscheduler(struct task_struct *p,
return -EPERM;
}

/*
* Can't set/change SCHED_DEADLINE policy at all for now
* (safest behavior); in the future we would like to allow
* unprivileged DL tasks to increase their relative deadline
* or reduce their runtime (both ways reducing utilization)
*/
if (dl_policy(policy))
return -EPERM;

/*
* Treat SCHED_IDLE as nice 20. Only allow a switch to
* SCHED_NORMAL if the RLIMIT_NICE would normally permit it.
Expand Down
2 changes: 1 addition & 1 deletion kernel/stop_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *
*/
smp_call_function_single(min(cpu1, cpu2),
&irq_cpu_stop_queue_work,
&call_args, 0);
&call_args, 1);
lg_local_unlock(&stop_cpus_lock);
preempt_enable();

Expand Down

0 comments on commit 59bf6c3

Please sign in to comment.