[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181211151957.GJ2342@uranus.lan>
Date: Tue, 11 Dec 2018 18:19:57 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Kirill Tkhai <ktkhai@...tuozzo.com>
Cc: akpm@...ux-foundation.org, mhocko@...e.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, gorcunov@...tuozzo.com
Subject: Re: [PATCH v3] ksm: React on changing "sleep_millisecs" parameter
faster
On Tue, Dec 11, 2018 at 06:11:25PM +0300, Kirill Tkhai wrote:
> ksm thread unconditionally sleeps in ksm_scan_thread()
> after each iteration:
>
> schedule_timeout_interruptible(
> msecs_to_jiffies(ksm_thread_sleep_millisecs))
>
> The timeout is configured in /sys/kernel/mm/ksm/sleep_millisecs.
>
> In case of user writes a big value by a mistake, and the thread
> enters into schedule_timeout_interruptible(), it's not possible
> to cancel the sleep by writing a new smaler value; the thread
> is just sleeping till timeout expires.
>
> The patch fixes the problem by waking the thread each time
> after the value is updated.
>
> This also may be useful for debug purposes; and also for userspace
> daemons, which change sleep_millisecs value in dependence of
> system load.
>
> Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.com>
>
> v3: Do not use mutex: to acquire it may take much time in case long
> list of ksm'able mm and pages.
> v2: Use wait_event_interruptible_timeout() instead of unconditional
> schedule_timeout().
Looks ok to me, thanks!
Acked-by: Cyrill Gorcunov <gorcunov@...il.com>
Powered by blists - more mailing lists