Re: [PATCH 5/12] ksm: keep quiet while list empty

From: Andrew Morton
Date: Tue Aug 04 2009 - 18:00:59 EST


On Mon, 3 Aug 2009 13:14:03 +0100 (BST)
Hugh Dickins <hugh.dickins@xxxxxxxxxxxxx> wrote:

> + if (ksmd_should_run()) {
> schedule_timeout_interruptible(
> msecs_to_jiffies(ksm_thread_sleep_millisecs));
> } else {
> wait_event_interruptible(ksm_thread_wait,
> - (ksm_run & KSM_RUN_MERGE) ||
> - kthread_should_stop());
> + ksmd_should_run() || kthread_should_stop());
> }

Yields


if (ksmd_should_run()) {
schedule_timeout_interruptible(
msecs_to_jiffies(ksm_thread_sleep_millisecs));
} else {
wait_event_interruptible(ksm_thread_wait,
ksmd_should_run() || kthread_should_stop());
}

can it be something like

wait_event_interruptible_timeout(ksm_thread_wait,
ksmd_should_run() || kthread_should_stop(),
msecs_to_jiffies(ksm_thread_sleep_millisecs));

?

That would also reduce the latency in responding to kthread_should_stop().
--
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/