From: Minchan Kim <minchan.kim@gmail.com>
To: Greg Thelen <gthelen@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
Johannes Weiner <hannes@cmpxchg.org>,
Wu Fengguang <fengguang.wu@intel.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] memcg: make throttle_vm_writeout() memcg aware
Date: Wed, 10 Nov 2010 08:22:44 +0900 [thread overview]
Message-ID: <AANLkTinX9FSC=9azJWH7LELvLs2jYjOYUeQe4KhD_th=@mail.gmail.com> (raw)
In-Reply-To: <1289294671-6865-4-git-send-email-gthelen@google.com>
On Tue, Nov 9, 2010 at 6:24 PM, Greg Thelen <gthelen@google.com> wrote:
> If called with a mem_cgroup, then throttle_vm_writeout() should
> query the given cgroup for its dirty memory usage limits.
>
> dirty_writeback_pages() is no longer used, so delete it.
>
> Signed-off-by: Greg Thelen <gthelen@google.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
> ---
> include/linux/writeback.h | 2 +-
> mm/page-writeback.c | 31 ++++++++++++++++---------------
> mm/vmscan.c | 2 +-
> 3 files changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/include/linux/writeback.h b/include/linux/writeback.h
> index 335dba1..1bacdda 100644
> --- a/include/linux/writeback.h
> +++ b/include/linux/writeback.h
> @@ -97,7 +97,7 @@ void laptop_mode_timer_fn(unsigned long data);
> #else
> static inline void laptop_sync_completion(void) { }
> #endif
> -void throttle_vm_writeout(gfp_t gfp_mask);
> +void throttle_vm_writeout(gfp_t gfp_mask, struct mem_cgroup *mem_cgroup);
>
> /* These are exported to sysctl. */
> extern int dirty_background_ratio;
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index d717fa9..bf85062 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -131,18 +131,6 @@ EXPORT_SYMBOL(laptop_mode);
> static struct prop_descriptor vm_completions;
> static struct prop_descriptor vm_dirties;
>
> -static unsigned long dirty_writeback_pages(void)
> -{
> - unsigned long ret;
> -
> - ret = mem_cgroup_page_stat(NULL, MEMCG_NR_DIRTY_WRITEBACK_PAGES);
> - if ((long)ret < 0)
> - ret = global_page_state(NR_UNSTABLE_NFS) +
> - global_page_state(NR_WRITEBACK);
> -
> - return ret;
> -}
> -
Nice cleanup.
> /*
> * couple the period to the dirty_ratio:
> *
> @@ -703,12 +691,25 @@ void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
> }
> EXPORT_SYMBOL(balance_dirty_pages_ratelimited_nr);
>
> -void throttle_vm_writeout(gfp_t gfp_mask)
> +/*
> + * Throttle the current task if it is near dirty memory usage limits.
> + * If @mem_cgroup is NULL or the root_cgroup, then use global dirty memory
> + * information; otherwise use the per-memcg dirty limits.
> + */
> +void throttle_vm_writeout(gfp_t gfp_mask, struct mem_cgroup *mem_cgroup)
> {
> struct dirty_info dirty_info;
> + unsigned long nr_writeback;
>
> for ( ; ; ) {
> - global_dirty_info(&dirty_info);
> + if (!mem_cgroup || !memcg_dirty_info(mem_cgroup, &dirty_info)) {
> + global_dirty_info(&dirty_info);
> + nr_writeback = global_page_state(NR_UNSTABLE_NFS) +
> + global_page_state(NR_WRITEBACK);
> + } else {
> + nr_writeback = mem_cgroup_page_stat(
> + mem_cgroup, MEMCG_NR_DIRTY_WRITEBACK_PAGES);
In point of view rcu_read_lock removal, memcg can't destroy due to
mem_cgroup_select_victim's css_tryget?
Then, we can remove unnecessary rcu_read_lock in mem_cgroup_page_stat.
--
Kind regards,
Minchan Kim
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-11-09 23:22 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-09 9:24 [PATCH 0/6] *** memcg: make throttle_vm_writeout() cgroup aware *** Greg Thelen
2010-11-09 9:24 ` [PATCH 1/6] memcg: add mem_cgroup parameter to mem_cgroup_page_stat() Greg Thelen
2010-11-09 22:53 ` Minchan Kim
2010-11-10 0:51 ` Minchan Kim
2010-11-16 3:50 ` KAMEZAWA Hiroyuki
2010-11-22 6:40 ` Balbir Singh
2010-11-09 9:24 ` [PATCH 2/6] memcg: pass mem_cgroup to mem_cgroup_dirty_info() Greg Thelen
2010-11-09 23:09 ` Minchan Kim
2010-11-16 3:51 ` KAMEZAWA Hiroyuki
2010-11-22 6:41 ` Balbir Singh
2010-11-09 9:24 ` [PATCH 3/6] memcg: make throttle_vm_writeout() memcg aware Greg Thelen
2010-11-09 23:22 ` Minchan Kim [this message]
2010-11-12 8:17 ` Johannes Weiner
2010-11-12 20:39 ` Greg Thelen
2010-11-16 3:57 ` KAMEZAWA Hiroyuki
2010-11-19 11:16 ` Johannes Weiner
2010-11-09 9:24 ` [PATCH 4/6] memcg: simplify mem_cgroup_page_stat() Greg Thelen
2010-11-09 23:36 ` Minchan Kim
2010-11-12 8:19 ` Johannes Weiner
2010-11-12 20:40 ` Greg Thelen
2010-11-19 11:22 ` Johannes Weiner
2010-11-16 3:58 ` KAMEZAWA Hiroyuki
2010-11-09 9:24 ` [PATCH 5/6] memcg: simplify mem_cgroup_dirty_info() Greg Thelen
2010-11-10 1:01 ` Minchan Kim
2010-11-12 8:21 ` Johannes Weiner
2010-11-12 20:40 ` Greg Thelen
2010-11-09 9:24 ` [PATCH 6/6] memcg: make mem_cgroup_page_stat() return value unsigned Greg Thelen
2010-11-09 12:15 ` Wu Fengguang
2010-11-10 1:04 ` Minchan Kim
2010-11-12 8:29 ` Johannes Weiner
2010-11-12 20:41 ` Greg Thelen
2010-11-19 11:39 ` Johannes Weiner
2010-11-16 4:00 ` KAMEZAWA Hiroyuki
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='AANLkTinX9FSC=9azJWH7LELvLs2jYjOYUeQe4KhD_th=@mail.gmail.com' \
--to=minchan.kim@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=fengguang.wu@intel.com \
--cc=gthelen@google.com \
--cc=hannes@cmpxchg.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nishimura@mxp.nes.nec.co.jp \
/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