[Devel] [PATCH v2] Port diff-ve-timers-convert-ve-monotonic-to-abs-time-when-setting-timerfd-2

Vladimir Davydov vdavydov at parallels.com
Tue Jun 9 08:43:13 PDT 2015


On Tue, Jun 09, 2015 at 06:38:11PM +0300, Pavel Tikhomirov wrote:
> Need this for docker, as sometimes systemd-tmpfiles-clean.timer inside
> PCS7 ct is spamming dbus with requests to start corresponding service.
> And at the same time docker tries to create cgroup for container and
> attach it to hierarchies like memory and blkio.
> 
> That is because systemd timer was triggered with non-virtualized timerfd
> using plain host clock but check that timer is successfull uses
> virtualized clock_gettime and don't pass before proper(in-container)
> timer activation. And timers charges again and again starts service
> got in busy loop.
> 
> https://jira.sw.ru/browse/PSBM-34017
> 
> v2: move the stubs to ve.h
> 
> Port the following RH6 commit:
> 
>   Author: Vladimir Davydov
>   Email: vdavydov at parallels.com
>   Subject: fs: convert ve monotonic to abs time when setting timerfd
>   Date: Fri, 15 Feb 2013 11:57:09 +0400
> 
>   * [timers] corrected TFD_TIMER_ABSTIME timer handling,
>     the issue led to high cpu usage inside a Fedora 18 CT
>     by 'init' process (PSBM-18284)
> 
>   Monotonic time inside container, as it can be obtained using various
>   system calls such as clock_gettime, is reported since start of the container,
>   not since start of the whole system. This was made in order to avoid time
>   issues while a container is migrated between different physical hosts, but this
>   also introduced a lot of problems in time- related system calls because
>   absolute monotonic time, which is in fact relative to container, passed to those
>   system calls must be converted to system-wide monotonic time, which is used by
>   kernel hrtimers.
> 
>   One of those buggy system calls is timerfd_settime which accepts as an
>   argument absolute time if flag TFD_TIMER_ABSTIME is specified.
> 
>   The patch fixes it by converting container monotonic time to system-
>   wide monotonic time using the monotonic_ve_to_abs() function, which was
>   introduced earlier and is now exported for that reason.
> 
>   https://jira.sw.ru/browse/PSBM-18284
> 
>   Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
> 
> Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

Reviewed-by: Vladimir Davydov <vdavydov at parallels.com>



More information about the Devel mailing list