lkml.org 
[lkml]   [2015]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] sched/preempt: fix cond_resched_lock() and cond_resched_softirq()
    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@vger.kernel.org
    > More majordomo info at http://vger.kernel.org/majordomo-info.html
    > Please read the FAQ at http://www.tux.org/lkml/


    \
     
     \ /
      Last update: 2015-05-07 19:41    [W:6.451 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site