Re: [PATCH -next] cgroup: Introduce css_is_online() helper

From: Tejun Heo
Date: Tue Apr 23 2024 - 11:56:51 EST


Hello,

On Tue, Apr 23, 2024 at 03:49:23PM +0200, Jan Kara wrote:
> On Sat 20-04-24 09:44:28, Xiu Jianfeng wrote:
> > Introduce css_is_online() helper to test if whether the specified
> > css is online, avoid testing css.flags with CSS_ONLINE directly
> > outside of cgroup.c.
> >
> > Signed-off-by: Xiu Jianfeng <xiujianfeng@xxxxxxxxxx>
>
> Looks good. Feel free to add:
>
> Reviewed-by: Jan Kara <jack@xxxxxxx>

I'm a bit skeptical about these trivial helpers. If the test is something
more involved or has complications which need documentation (e.g. regarding
synchronization and what not), the helper would be useful even if it's just
as a place to centrally document what's going on. However, here, it's just
testing one flag and I'm not sure what benefits the helper brings.

Thanks.

--
tejun