From: Michal Hocko <mhocko@kernel.org>
To: Li RongQing <lirongqing@baidu.com>
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Johannes Weiner <hannes@cmpxchg.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: Re: [PATCH 1/2] mm: add a function to return a bdi_writeback dirty page statistic
Date: Wed, 1 Aug 2018 13:03:56 +0200 [thread overview]
Message-ID: <20180801110356.GH16767@dhcp22.suse.cz> (raw)
In-Reply-To: <1533120516-18279-1-git-send-email-lirongqing@baidu.com>
On Wed 01-08-18 18:48:35, Li RongQing wrote:
> this is a preparation to optimise a full writeback
> when reclaim memory
Please do not add unused functions. This makes review harder without a
good reason. Besides that we already have mem_cgroup_wb_stats. Why
cannot you reuse it?
> Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> include/linux/memcontrol.h | 2 +-
> mm/memcontrol.c | 6 ++++++
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 6c6fb116e925..58e29555ac81 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -1141,7 +1141,7 @@ struct wb_domain *mem_cgroup_wb_domain(struct bdi_writeback *wb);
> void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages,
> unsigned long *pheadroom, unsigned long *pdirty,
> unsigned long *pwriteback);
> -
> +unsigned long mem_cgroup_wb_dirty_stats(struct bdi_writeback *wb);
> #else /* CONFIG_CGROUP_WRITEBACK */
>
> static inline struct wb_domain *mem_cgroup_wb_domain(struct bdi_writeback *wb)
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 8c0280b3143e..82d3061e91d1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3640,6 +3640,12 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages,
> }
> }
>
> +unsigned long mem_cgroup_wb_dirty_stats(struct bdi_writeback *wb)
> +{
> + struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css);
> +
> + return memcg_page_state(memcg, NR_FILE_DIRTY);
> +}
> #else /* CONFIG_CGROUP_WRITEBACK */
>
> static int memcg_wb_domain_init(struct mem_cgroup *memcg, gfp_t gfp)
> --
> 2.16.2
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2018-08-01 11:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-01 10:48 [PATCH 1/2] mm: add a function to return a bdi_writeback dirty page statistic Li RongQing
2018-08-01 10:48 ` [PATCH 2/2] fs/writeback: do memory cgroup related writeback firstly Li RongQing
2018-08-01 11:16 ` Michal Hocko
2018-08-01 11:03 ` Michal Hocko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180801110356.GH16767@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lirongqing@baidu.com \
--cc=vdavydov.dev@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).