Messages in this thread | | | Date | Wed, 9 Nov 2011 10:09:00 -0800 | From | Tejun Heo <> | Subject | Re: [PATCH] thp: reduce khugepaged freezing latency |
| |
Hello, Anrea.
On Wed, Nov 09, 2011 at 06:29:42PM +0100, Andrea Arcangeli wrote: > My point is if what happens is: > > freezer CPU khugepaged > ------ > assert freezing > wake_up(interruptible) > __set_current_state(interruptible) > schedule() > > are we still hanging then?
Yeap, you're right. I was thinking INTERRUPTILBE was being set before try_to_freeze().
> And I think it's silly to use wait_event_freezable_timeout if I > don't have any waitqueue to wait on.
I'm confused. You're doing add_wait_queue() before schedule_timeout_interruptible(). prepare_to_wait() is essentially add_wait_queue() + set_current_state(). What am I missing? ie. why not do the following?
prepare_to_wait(INTERRUPTIBLE); try_to_freeze(); schedule_timeout(); try_to_freeze(); finish_wait();
or even simpler,
wait_event_freezable_timeout(wq, false, timeout);
In terms of overhead, there is no appreciable difference from
add_wait_queue(); schedule_timeout_interruptible(); remove_wait_queue()
Or is the logic there scheduled to change?
> +signed long __sched schedule_timeout_freezable(signed long timeout) > +{ > + do > + set_current_state(TASK_INTERRUPTIBLE); > + while (try_to_freeze()); > + return schedule_timeout(timeout); > +} > +EXPORT_SYMBOL(schedule_timeout_freezable);
Hmmm... I don't know. I really hope all freezable tasks stick to higher level interface. It's way too easy to get things wrong and eat either freezing or actual wakeup condition.
Thank you.
-- tejun
| |