Re: [PATCH] memcg: Only record foreign writebacks with dirty pages when memcg is not disabled

From: Baoquan He
Date: Mon Sep 23 2019 - 04:42:22 EST


On 09/23/19 at 04:30pm, Baoquan He wrote:

> ---
> include/linux/memcontrol.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index ad8f1a397ae4..fa53f9d51205 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -1261,7 +1261,8 @@ void mem_cgroup_track_foreign_dirty_slowpath(struct page *page,
> static inline void mem_cgroup_track_foreign_dirty(struct page *page,
> struct bdi_writeback *wb)
> {
> - if (unlikely(&page->mem_cgroup->css != wb->memcg_css))
> + if (unlikely(&page->mem_cgroup->css != wb->memcg_css)
> + && !mem_cgroup_disabled())

Sorry, this is the draft patch I was testing. Later I think this
had better be moved into mem_cgroup_track_foreign_dirty_slowpath().

Not very sure about this. Will send a v2 to match the patch log.

> mem_cgroup_track_foreign_dirty_slowpath(page, wb);
> }
>
> --
> 2.17.2
>