Re: [PATCH] sched/preempt: fix cond_resched_lock() and cond_resched_softirq()

From: Steven Rostedt
Date: Thu May 07 2015 - 13:32:36 EST


On Thu, May 07, 2015 at 08:06:47PM +0300, Konstantin Khlebnikov wrote:
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index fe22f7510bce..087bf36ecd46 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4223,7 +4223,7 @@ SYSCALL_DEFINE0(sched_yield)
>
> int __sched _cond_resched(void)
> {
> - if (should_resched()) {
> + if (should_resched(0)) {
> preempt_schedule_common();
> return 1;
> }
> @@ -4241,7 +4241,7 @@ EXPORT_SYMBOL(_cond_resched);
> */
> int __cond_resched_lock(spinlock_t *lock)
> {
> - int resched = should_resched();
> + int resched = should_resched(PREEMPT_LOCK_OFFSET);

Hmm, yeah, the current code would have should_resched() always return false.

> int ret = 0;
>
> lockdep_assert_held(lock);
> @@ -4263,7 +4263,7 @@ int __sched __cond_resched_softirq(void)
> {
> BUG_ON(!in_softirq());
>
> - if (should_resched()) {
> + if (should_resched(SOFTIRQ_DISABLE_OFFSET)) {

Here too.

-- Steve

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