lkml.org 
[lkml]   [2009]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/12] ksm: keep quiet while list empty
On Tue, 4 Aug 2009, Andrew Morton wrote:
> On Mon, 3 Aug 2009 13:14:03 +0100 (BST)
> Hugh Dickins <hugh.dickins@tiscali.co.uk> 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

(Phew, for a moment I thought you were asking us to use yield() here.)

>
>
> 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));
>
> ?

I'd be glad to simplify what we have there, but I think your proposal
ends up doing exactly what we're trying to avoid, doesn't it? Won't
it briefly wake up ksmd every ksm_thread_sleep_millisecs, even when
there's nothing for it to do?

>
> That would also reduce the latency in responding to kthread_should_stop().

That's not a high priority consideration. So far as I can tell, the only
use for that test is at startup, if the sysfs_create_group mysteriously
fails. It's mostly a leftover from when you could have CONFIG_KSM=m:

I did wonder whether to go back and add some SLAB_PANICs etc now,
but in the end I was either too lazy or too deferential to Izik's
fine error handling (you choose which to believe: both, actually).

Hugh


\
 
 \ /
  Last update: 2009-08-05 13:57    [W:0.072 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site