]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
UBUNTU: SAUCE: Clear Linux: ksm-wakeups
authorArjan van de Ven <arjan@linux.intel.com>
Mon, 14 Mar 2016 17:06:46 +0000 (11:06 -0600)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 16 Sep 2019 13:06:27 +0000 (15:06 +0200)
reduce wakeups in ksm by adding rounding (aligning) when the sleep times are 1 second or longer

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
[ saf: update for conflicts when rebasing to v5.0 ]
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
mm/ksm.c

index 3dc4346411e4e36a0ced02c755e0506481bc5455..5f4b6d59eebbe72f20b79315c7237fcc76c03b1d 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2432,9 +2432,14 @@ static int ksm_scan_thread(void *nothing)
 
                if (ksmd_should_run()) {
                        sleep_ms = READ_ONCE(ksm_thread_sleep_millisecs);
-                       wait_event_interruptible_timeout(ksm_iter_wait,
-                               sleep_ms != READ_ONCE(ksm_thread_sleep_millisecs),
-                               msecs_to_jiffies(sleep_ms));
+                       if (sleep_ms >= 1000)
+                               wait_event_interruptible_timeout(ksm_iter_wait,
+                                       sleep_ms != READ_ONCE(ksm_thread_sleep_millisecs),
+                                       msecs_to_jiffies(round_jiffies_relative(sleep_ms)));
+                       else
+                               wait_event_interruptible_timeout(ksm_iter_wait,
+                                       sleep_ms != READ_ONCE(ksm_thread_sleep_millisecs),
+                                       msecs_to_jiffies(sleep_ms));
                } else {
                        wait_event_freezable(ksm_thread_wait,
                                ksmd_should_run() || kthread_should_stop());