From 6407f8667f77eabb80a92fb48f9080a8d9dfd277 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 11 Mar 2024 14:32:12 +0100 Subject: [PATCH] rump: prevent sleep times of less than 1 sec This patch caps the busyness of the rump kernel, which normally calls sleep with timeouts between 0 and 10 ms even when idle. On Sculpt running on a x250 laptop, this patch saves 0.4% CPU load, which is almost the half of the idle load. Issue #5140 --- repos/dde_rump/src/lib/rump/hypercall.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/repos/dde_rump/src/lib/rump/hypercall.cc b/repos/dde_rump/src/lib/rump/hypercall.cc index c84bf79f8c..c273b4ae09 100644 --- a/repos/dde_rump/src/lib/rump/hypercall.cc +++ b/repos/dde_rump/src/lib/rump/hypercall.cc @@ -324,6 +324,18 @@ int rumpuser_clock_sleep(int enum_rumpclock, int64_t sec, long nsec) break; } + /* + * When using rump in the form of vfs_rump as file-system implementation, + * this function is steadily called with sleep times in the range of 0 to + * 10 ms, inducing load even when the file system is not accessed. + * + * This load on idle can be lowered by forcing a sleep time of at least one + * second. This does not harm the operation of vfs_rump because the file + * system is not driven by time. + */ + if (msec < 1000) + msec = 1000; + Rump::env().sleep_sem().down(true, Genode::Microseconds(msec * 1000)); rumpkern_sched(nlocks, 0);