[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1275311015.2678.131.camel@localhost>
Date: Mon, 31 May 2010 16:03:35 +0300
From: Artem Bityutskiy <dedekind1@...il.com>
To: Nick Piggin <npiggin@...e.de>
Cc: Al Viro <viro@...IV.linux.org.uk>,
LKML <linux-kernel@...r.kernel.org>,
Jens Axboe <jens.axboe@...cle.com>,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCHv4 17/17] writeback: lessen sync_supers wakeup count
On Mon, 2010-05-31 at 22:47 +1000, Nick Piggin wrote:
> > set_current_state(TASK_INTERRUPTIBLE);
> > /*
> > * XXX: what if we are preempted here. No timer is armed. Our state is
> > * TASK_INTERRUPTIBLE, supers_dirty is 1, so no one will ever wake us
> > * up. Thus, we'll sleep forever.
> > */
> > if (supers_dirty)
> > bdi_arm_supers_timer();
> > schedule();
> >
> > Not sure, but I did quick search and it looks like in preemptive kernel,
> > an interrupt may happen in the XXX place above, then it will call
> > 'preempt_schedule_irq()', which sill call 'schedule()'.
>
> Yes, preempt does not participate in tsak sleeping exactly for reasons
> such as this.
>
> From kernel/sched.c:schedule()
>
> if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
> if (unlikely(signal_pending_state(prev->state, prev)))
> prev->state = TASK_RUNNING;
> else
> deactivate_task(rq, prev, DEQUEUE_SLEEP);
> switch_count = &prev->nvcsw;
> }
>
> If the task is not running, then is only removed from the runqueue
> (or reset to running in case of pending signal) IFF it has not been
> scheduled from an involuntary kernel preemption.
>
> So in the XXX region, the task will actually be allowed to run again
> until it calls schedule().
Clear now, thanks a lot again!
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists