lkml.org 
[lkml]   [2025]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/3] selftests: cgroup: Add cg_read_key_long_poll() to poll a cgroup key with retries
On Wed, Dec 03, 2025 at 07:56:29PM +0800, Guopeng Zhang <zhangguopeng@kylinos.cn> wrote:
> Introduce a new helper function `cg_read_key_long_poll()` in
> cgroup_util.h. This function polls the specified key in a cgroup file
> until it matches the expected value or the retry limit is reached,
> with configurable wait intervals between retries.
>
> This helper is particularly useful for handling asynchronously updated
> cgroup statistics (e.g., memory.stat), where immediate reads may
> observe stale values, especially on busy systems. It allows tests and
> other utilities to handle such cases more flexibly.
>
> Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
> Suggested-by: Michal Koutný <mkoutny@suse.com>
> Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
> ---
> .../selftests/cgroup/lib/cgroup_util.c | 21 +++++++++++++++++++
> .../cgroup/lib/include/cgroup_util.h | 5 +++++
> 2 files changed, 26 insertions(+)

Acked-by: Michal Koutný <mkoutny@suse.com>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2025-12-04 16:11    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog