[Devel] [PATCH RH8 v2 4/4] mm/backing-dev: associate writeback with correct blkcg

Kirill Tkhai ktkhai at virtuozzo.com
Tue Jul 13 18:09:01 MSK 2021


On 09.07.2021 02:23, Andrey Zhadchenko wrote:
> Use cgroup_get_e_ve_css to get correct blkcg_css for writeback instances.
> 
> https://jira.sw.ru/browse/PSBM-131253
> Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
> ---
>  mm/backing-dev.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> index cc2a3c0..f6884ab 100644
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -559,7 +559,17 @@ static int cgwb_create(struct backing_dev_info *bdi,
>  	int ret = 0;
>  
>  	memcg = mem_cgroup_from_css(memcg_css);
> +
> +#ifdef CONFIG_VE
> +	if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
> +		blkcg_css = cgroup_get_e_css(memcg_css->cgroup,
> +					     &io_cgrp_subsys);
> +	else
> +		blkcg_css = cgroup_get_e_ve_css(memcg_css->cgroup,
> +						&io_cgrp_subsys);

I'd moved this repeating twice pattern into separate function, but it's up to you.

Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>

> +#else
>  	blkcg_css = cgroup_get_e_css(memcg_css->cgroup, &io_cgrp_subsys);
> +#endif
>  	blkcg = css_to_blkcg(blkcg_css);
>  	memcg_cgwb_list = &memcg->cgwb_list;
>  	blkcg_cgwb_list = &blkcg->cgwb_list;
> @@ -683,8 +693,17 @@ struct bdi_writeback *wb_get_create(struct backing_dev_info *bdi,
>  			struct cgroup_subsys_state *blkcg_css;
>  
>  			/* see whether the blkcg association has changed */
> +#ifdef CONFIG_VE
> +			if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
> +				blkcg_css = cgroup_get_e_css(memcg_css->cgroup,
> +							     &io_cgrp_subsys);
> +			else
> +				blkcg_css = cgroup_get_e_ve_css(memcg_css->cgroup,
> +							     &io_cgrp_subsys);
> +#else
>  			blkcg_css = cgroup_get_e_css(memcg_css->cgroup,
>  						     &io_cgrp_subsys);
> +#endif
>  			if (unlikely(wb->blkcg_css != blkcg_css ||
>  				     !wb_tryget(wb)))
>  				wb = NULL;
> 



More information about the Devel mailing list