* [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-29 10:03 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-06-29 10:03 UTC (permalink / raw)
To: linux-mm
Cc: akpm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
This is onto 3 patches I posted yesterday.
I'm sorry I once got Acks in v1 but refleshed totally.
==
>From fda72071ee473be1caee163920da0f5c397c95e8 Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Date: Wed, 29 Jun 2011 18:24:49 +0900
Subject: [PATCH] export memory cgroup's swappines
Each memory cgroup has 'swappiness' value and it can be accessed by
get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
and swappiness is passed by argument. It's propagated by scan_control.
get_swappiness is static function but some planned updates will need to
get swappiness from files other than memcontrol.c
This patch exports get_swappiness() as mem_cgroup_swappiness().
By this, we can remove the argument of swapiness from try_to_free...
and drop swappiness from scan_control. only memcg uses it.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Changelog:
- drop swappiness from scan_control
---
include/linux/swap.h | 10 +++++++---
mm/memcontrol.c | 13 ++++++-------
mm/vmscan.c | 23 ++++++++++-------------
3 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a273468..aabcca4 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -252,11 +252,9 @@ static inline void lru_cache_add_file(struct page *page)
extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
gfp_t gfp_mask, nodemask_t *mask);
extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
- gfp_t gfp_mask, bool noswap,
- unsigned int swappiness);
+ gfp_t gfp_mask, bool noswap);
extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned);
extern int __isolate_lru_page(struct page *page, int mode, int file);
@@ -365,11 +363,17 @@ static inline void put_swap_token(struct mm_struct *mm)
extern void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
+extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
#else
static inline void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
{
}
+
+static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
+{
+ return vm_swappiness;
+}
#endif
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3e7d5e6..ae10796 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1330,7 +1330,7 @@ static unsigned long mem_cgroup_margin(struct mem_cgroup *mem)
return margin >> PAGE_SHIFT;
}
-static unsigned int get_swappiness(struct mem_cgroup *memcg)
+unsigned int mem_cgroup_swappiness(struct mem_cgroup *memcg)
{
struct cgroup *cgrp = memcg->css.cgroup;
@@ -1776,12 +1776,11 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
/* we use swappiness of local cgroup */
if (check_soft) {
ret = mem_cgroup_shrink_node_zone(victim, gfp_mask,
- noswap, get_swappiness(victim), zone,
- &nr_scanned);
+ noswap, zone, &nr_scanned);
*total_scanned += nr_scanned;
} else
ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
- noswap, get_swappiness(victim));
+ noswap);
css_put(&victim->css);
/*
* At shrinking usage, we can't check we should stop here or
@@ -3826,7 +3825,7 @@ try_to_free:
goto out;
}
progress = try_to_free_mem_cgroup_pages(mem, GFP_KERNEL,
- false, get_swappiness(mem));
+ false);
if (!progress) {
nr_retries--;
/* maybe some writeback is necessary */
@@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
{
struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
- return get_swappiness(memcg);
+ return mem_cgroup_swappiness(memcg);
}
static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
@@ -4997,7 +4996,7 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
INIT_LIST_HEAD(&mem->oom_notify);
if (parent)
- mem->swappiness = get_swappiness(parent);
+ mem->swappiness = mem_cgroup_swappiness(parent);
atomic_set(&mem->refcnt, 1);
mem->move_charge_at_immigrate = 0;
mutex_init(&mem->thresholds_lock);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4f49535..fb37699 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -95,8 +95,6 @@ struct scan_control {
/* Can pages be swapped as part of reclaim? */
int may_swap;
- int swappiness;
-
int order;
/*
@@ -1729,6 +1727,13 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
}
+static int vmscan_swappiness(struct scan_control *sc)
+{
+ if (scanning_global_lru(sc))
+ return vm_swappiness;
+ return mem_cgroup_swappiness(sc->mem_cgroup);
+}
+
/*
* Determine how aggressively the anon and file LRU lists should be
* scanned. The relative value of each set of LRU lists is determined
@@ -1789,8 +1794,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
* With swappiness at 100, anonymous and file have the same priority.
* This scanning priority is essentially the inverse of IO cost.
*/
- anon_prio = sc->swappiness;
- file_prio = 200 - sc->swappiness;
+ anon_prio = vmscan_swappiness(sc);
+ file_prio = 200 - vmscan_swappiness(sc);
/*
* OK, so we have swap space and a fair amount of page cache
@@ -2179,7 +2184,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
.nr_to_reclaim = SWAP_CLUSTER_MAX,
.may_unmap = 1,
.may_swap = 1,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
.nodemask = nodemask,
@@ -2203,7 +2207,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned)
{
@@ -2213,7 +2216,6 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
.may_writepage = !laptop_mode,
.may_unmap = 1,
.may_swap = !noswap,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem,
};
@@ -2242,8 +2244,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
gfp_t gfp_mask,
- bool noswap,
- unsigned int swappiness)
+ bool noswap)
{
struct zonelist *zonelist;
unsigned long nr_reclaimed;
@@ -2253,7 +2254,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
.may_unmap = 1,
.may_swap = !noswap,
.nr_to_reclaim = SWAP_CLUSTER_MAX,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem_cont,
.nodemask = NULL, /* we don't care the placement */
@@ -2403,7 +2403,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
* we want to put equal scanning pressure on each zone.
*/
.nr_to_reclaim = ULONG_MAX,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
};
@@ -2862,7 +2861,6 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
.may_writepage = 1,
.nr_to_reclaim = nr_to_reclaim,
.hibernation_mode = 1,
- .swappiness = vm_swappiness,
.order = 0,
};
struct shrink_control shrink = {
@@ -3049,7 +3047,6 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
.nr_to_reclaim = max_t(unsigned long, nr_pages,
SWAP_CLUSTER_MAX),
.gfp_mask = gfp_mask,
- .swappiness = vm_swappiness,
.order = order,
};
struct shrink_control shrink = {
--
1.7.4.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-29 10:03 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-06-29 10:03 UTC (permalink / raw)
To: linux-mm
Cc: akpm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
This is onto 3 patches I posted yesterday.
I'm sorry I once got Acks in v1 but refleshed totally.
==
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-29 10:03 ` KAMEZAWA Hiroyuki
@ 2011-06-29 12:20 ` Michal Hocko
-1 siblings, 0 replies; 32+ messages in thread
From: Michal Hocko @ 2011-06-29 12:20 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, akpm, linux-kernel, nishimura, bsingharora, Ying Han
On Wed 29-06-11 19:03:25, KAMEZAWA Hiroyuki wrote:
> This is onto 3 patches I posted yesterday.
> I'm sorry I once got Acks in v1 but refleshed totally.
> ==
> From fda72071ee473be1caee163920da0f5c397c95e8 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 29 Jun 2011 18:24:49 +0900
> Subject: [PATCH] export memory cgroup's swappines
>
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
>
> Changelog:
> - drop swappiness from scan_control
Yes, this is even better.
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-29 12:20 ` Michal Hocko
0 siblings, 0 replies; 32+ messages in thread
From: Michal Hocko @ 2011-06-29 12:20 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, akpm, linux-kernel, nishimura, bsingharora, Ying Han
On Wed 29-06-11 19:03:25, KAMEZAWA Hiroyuki wrote:
> This is onto 3 patches I posted yesterday.
> I'm sorry I once got Acks in v1 but refleshed totally.
> ==
> From fda72071ee473be1caee163920da0f5c397c95e8 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 29 Jun 2011 18:24:49 +0900
> Subject: [PATCH] export memory cgroup's swappines
>
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
>
> Changelog:
> - drop swappiness from scan_control
Yes, this is even better.
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-29 10:03 ` KAMEZAWA Hiroyuki
@ 2011-06-29 13:00 ` Balbir Singh
-1 siblings, 0 replies; 32+ messages in thread
From: Balbir Singh @ 2011-06-29 13:00 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, akpm, linux-kernel, nishimura, Michal Hocko, Ying Han
On Wed, Jun 29, 2011 at 3:33 PM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@jp.fujitsu.com> wrote:
> This is onto 3 patches I posted yesterday.
> I'm sorry I once got Acks in v1 but refleshed totally.
> ==
> From fda72071ee473be1caee163920da0f5c397c95e8 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 29 Jun 2011 18:24:49 +0900
> Subject: [PATCH] export memory cgroup's swappines
>
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Good refactoring
Acked-by: Balbir Singh <bsingharora@gmail.com>
Thanks,
Balbir Singh
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-29 13:00 ` Balbir Singh
0 siblings, 0 replies; 32+ messages in thread
From: Balbir Singh @ 2011-06-29 13:00 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, akpm, linux-kernel, nishimura, Michal Hocko, Ying Han
On Wed, Jun 29, 2011 at 3:33 PM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@jp.fujitsu.com> wrote:
> This is onto 3 patches I posted yesterday.
> I'm sorry I once got Acks in v1 but refleshed totally.
> ==
> From fda72071ee473be1caee163920da0f5c397c95e8 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 29 Jun 2011 18:24:49 +0900
> Subject: [PATCH] export memory cgroup's swappines
>
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Good refactoring
Acked-by: Balbir Singh <bsingharora@gmail.com>
Thanks,
Balbir Singh
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-29 10:03 ` KAMEZAWA Hiroyuki
@ 2011-06-29 20:00 ` Andrew Morton
-1 siblings, 0 replies; 32+ messages in thread
From: Andrew Morton @ 2011-06-29 20:00 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
On Wed, 29 Jun 2011 19:03:25 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> +unsigned int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> +static int vmscan_swappiness(struct scan_control *sc)
The patch seems a bit confused about the signedness of swappiness.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-29 20:00 ` Andrew Morton
0 siblings, 0 replies; 32+ messages in thread
From: Andrew Morton @ 2011-06-29 20:00 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
On Wed, 29 Jun 2011 19:03:25 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> +unsigned int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> +static int vmscan_swappiness(struct scan_control *sc)
The patch seems a bit confused about the signedness of swappiness.
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-29 20:00 ` Andrew Morton
@ 2011-06-30 3:32 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-06-30 3:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
On Wed, 29 Jun 2011 13:00:43 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 29 Jun 2011 19:03:25 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > Each memory cgroup has 'swappiness' value and it can be accessed by
> > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > and swappiness is passed by argument. It's propagated by scan_control.
> >
> > get_swappiness is static function but some planned updates will need to
> > get swappiness from files other than memcontrol.c
> > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > By this, we can remove the argument of swapiness from try_to_free...
> > and drop swappiness from scan_control. only memcg uses it.
> >
>
> > +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> > +unsigned int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> > +static int vmscan_swappiness(struct scan_control *sc)
>
> The patch seems a bit confused about the signedness of swappiness.
>
ok, v3 here. Now, memcg's one use "int" because vm_swapiness is "int".
==
>From af1bae8f2c6a8dbff048222bb45c7162b505f38b Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Date: Wed, 29 Jun 2011 18:24:49 +0900
Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
Each memory cgroup has 'swappiness' value and it can be accessed by
get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
and swappiness is passed by argument. It's propagated by scan_control.
get_swappiness is static function but some planned updates will need to
get swappiness from files other than memcontrol.c
This patch exports get_swappiness() as mem_cgroup_swappiness().
By this, we can remove the argument of swapiness from try_to_free...
and drop swappiness from scan_control. only memcg uses it.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Changelog:
- adjusted signedness to vm_swappiness.
- drop swappiness from scan_control
---
include/linux/swap.h | 10 +++++++---
mm/memcontrol.c | 15 +++++++--------
mm/vmscan.c | 23 ++++++++++-------------
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a273468..0299832 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -252,11 +252,9 @@ static inline void lru_cache_add_file(struct page *page)
extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
gfp_t gfp_mask, nodemask_t *mask);
extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
- gfp_t gfp_mask, bool noswap,
- unsigned int swappiness);
+ gfp_t gfp_mask, bool noswap);
extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned);
extern int __isolate_lru_page(struct page *page, int mode, int file);
@@ -365,11 +363,17 @@ static inline void put_swap_token(struct mm_struct *mm)
extern void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
+extern int mem_cgroup_swappiness(struct mem_cgroup *mem);
#else
static inline void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
{
}
+
+static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
+{
+ return vm_swappiness;
+}
#endif
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3e7d5e6..db70176 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -249,7 +249,7 @@ struct mem_cgroup {
atomic_t oom_lock;
atomic_t refcnt;
- unsigned int swappiness;
+ int swappiness;
/* OOM-Killer disable */
int oom_kill_disable;
@@ -1330,7 +1330,7 @@ static unsigned long mem_cgroup_margin(struct mem_cgroup *mem)
return margin >> PAGE_SHIFT;
}
-static unsigned int get_swappiness(struct mem_cgroup *memcg)
+int mem_cgroup_swappiness(struct mem_cgroup *memcg)
{
struct cgroup *cgrp = memcg->css.cgroup;
@@ -1776,12 +1776,11 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
/* we use swappiness of local cgroup */
if (check_soft) {
ret = mem_cgroup_shrink_node_zone(victim, gfp_mask,
- noswap, get_swappiness(victim), zone,
- &nr_scanned);
+ noswap, zone, &nr_scanned);
*total_scanned += nr_scanned;
} else
ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
- noswap, get_swappiness(victim));
+ noswap);
css_put(&victim->css);
/*
* At shrinking usage, we can't check we should stop here or
@@ -3826,7 +3825,7 @@ try_to_free:
goto out;
}
progress = try_to_free_mem_cgroup_pages(mem, GFP_KERNEL,
- false, get_swappiness(mem));
+ false);
if (!progress) {
nr_retries--;
/* maybe some writeback is necessary */
@@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
{
struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
- return get_swappiness(memcg);
+ return mem_cgroup_swappiness(memcg);
}
static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
@@ -4997,7 +4996,7 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
INIT_LIST_HEAD(&mem->oom_notify);
if (parent)
- mem->swappiness = get_swappiness(parent);
+ mem->swappiness = mem_cgroup_swappiness(parent);
atomic_set(&mem->refcnt, 1);
mem->move_charge_at_immigrate = 0;
mutex_init(&mem->thresholds_lock);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4f49535..fb37699 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -95,8 +95,6 @@ struct scan_control {
/* Can pages be swapped as part of reclaim? */
int may_swap;
- int swappiness;
-
int order;
/*
@@ -1729,6 +1727,13 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
}
+static int vmscan_swappiness(struct scan_control *sc)
+{
+ if (scanning_global_lru(sc))
+ return vm_swappiness;
+ return mem_cgroup_swappiness(sc->mem_cgroup);
+}
+
/*
* Determine how aggressively the anon and file LRU lists should be
* scanned. The relative value of each set of LRU lists is determined
@@ -1789,8 +1794,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
* With swappiness at 100, anonymous and file have the same priority.
* This scanning priority is essentially the inverse of IO cost.
*/
- anon_prio = sc->swappiness;
- file_prio = 200 - sc->swappiness;
+ anon_prio = vmscan_swappiness(sc);
+ file_prio = 200 - vmscan_swappiness(sc);
/*
* OK, so we have swap space and a fair amount of page cache
@@ -2179,7 +2184,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
.nr_to_reclaim = SWAP_CLUSTER_MAX,
.may_unmap = 1,
.may_swap = 1,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
.nodemask = nodemask,
@@ -2203,7 +2207,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned)
{
@@ -2213,7 +2216,6 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
.may_writepage = !laptop_mode,
.may_unmap = 1,
.may_swap = !noswap,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem,
};
@@ -2242,8 +2244,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
gfp_t gfp_mask,
- bool noswap,
- unsigned int swappiness)
+ bool noswap)
{
struct zonelist *zonelist;
unsigned long nr_reclaimed;
@@ -2253,7 +2254,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
.may_unmap = 1,
.may_swap = !noswap,
.nr_to_reclaim = SWAP_CLUSTER_MAX,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem_cont,
.nodemask = NULL, /* we don't care the placement */
@@ -2403,7 +2403,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
* we want to put equal scanning pressure on each zone.
*/
.nr_to_reclaim = ULONG_MAX,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
};
@@ -2862,7 +2861,6 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
.may_writepage = 1,
.nr_to_reclaim = nr_to_reclaim,
.hibernation_mode = 1,
- .swappiness = vm_swappiness,
.order = 0,
};
struct shrink_control shrink = {
@@ -3049,7 +3047,6 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
.nr_to_reclaim = max_t(unsigned long, nr_pages,
SWAP_CLUSTER_MAX),
.gfp_mask = gfp_mask,
- .swappiness = vm_swappiness,
.order = order,
};
struct shrink_control shrink = {
--
1.7.4.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-30 3:32 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-06-30 3:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
On Wed, 29 Jun 2011 13:00:43 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 29 Jun 2011 19:03:25 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > Each memory cgroup has 'swappiness' value and it can be accessed by
> > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > and swappiness is passed by argument. It's propagated by scan_control.
> >
> > get_swappiness is static function but some planned updates will need to
> > get swappiness from files other than memcontrol.c
> > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > By this, we can remove the argument of swapiness from try_to_free...
> > and drop swappiness from scan_control. only memcg uses it.
> >
>
> > +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> > +unsigned int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> > +static int vmscan_swappiness(struct scan_control *sc)
>
> The patch seems a bit confused about the signedness of swappiness.
>
ok, v3 here. Now, memcg's one use "int" because vm_swapiness is "int".
==
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-30 3:32 ` KAMEZAWA Hiroyuki
@ 2011-06-30 6:32 ` Michal Hocko
-1 siblings, 0 replies; 32+ messages in thread
From: Michal Hocko @ 2011-06-30 6:32 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora, Ying Han
On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
> On Wed, 29 Jun 2011 13:00:43 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Wed, 29 Jun 2011 19:03:25 +0900
> > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> >
> > > Each memory cgroup has 'swappiness' value and it can be accessed by
> > > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > > and swappiness is passed by argument. It's propagated by scan_control.
> > >
> > > get_swappiness is static function but some planned updates will need to
> > > get swappiness from files other than memcontrol.c
> > > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > > By this, we can remove the argument of swapiness from try_to_free...
> > > and drop swappiness from scan_control. only memcg uses it.
> > >
> >
> > > +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> > > +unsigned int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> > > +static int vmscan_swappiness(struct scan_control *sc)
> >
> > The patch seems a bit confused about the signedness of swappiness.
> >
>
> ok, v3 here. Now, memcg's one use "int" because vm_swapiness is "int".
> ==
>
> From af1bae8f2c6a8dbff048222bb45c7162b505f38b Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 29 Jun 2011 18:24:49 +0900
> Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
>
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
>
> Changelog:
> - adjusted signedness to vm_swappiness.
> - drop swappiness from scan_control
> ---
> include/linux/swap.h | 10 +++++++---
> mm/memcontrol.c | 15 +++++++--------
> mm/vmscan.c | 23 ++++++++++-------------
> 3 files changed, 24 insertions(+), 24 deletions(-)
>
[...]
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3e7d5e6..db70176 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
[...]
> @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> {
> struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
>
> - return get_swappiness(memcg);
> + return mem_cgroup_swappiness(memcg);
> }
If you want to be type clean you should change this one as well. I
think it is worth it, though. The function is called only to return the
current value to userspace and mem_cgroup_swappiness_write guaranties
that it falls down into <0,100> interval. Additionally, cftype doesn't
have any read specialization for int values so you would need to use a
generic one. Finally if you changed read part you should change also
write part and add > 0 check which is a lot of code for not that good
reason.
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-30 6:32 ` Michal Hocko
0 siblings, 0 replies; 32+ messages in thread
From: Michal Hocko @ 2011-06-30 6:32 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora, Ying Han
On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
> On Wed, 29 Jun 2011 13:00:43 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Wed, 29 Jun 2011 19:03:25 +0900
> > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> >
> > > Each memory cgroup has 'swappiness' value and it can be accessed by
> > > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > > and swappiness is passed by argument. It's propagated by scan_control.
> > >
> > > get_swappiness is static function but some planned updates will need to
> > > get swappiness from files other than memcontrol.c
> > > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > > By this, we can remove the argument of swapiness from try_to_free...
> > > and drop swappiness from scan_control. only memcg uses it.
> > >
> >
> > > +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> > > +unsigned int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> > > +static int vmscan_swappiness(struct scan_control *sc)
> >
> > The patch seems a bit confused about the signedness of swappiness.
> >
>
> ok, v3 here. Now, memcg's one use "int" because vm_swapiness is "int".
> ==
>
> From af1bae8f2c6a8dbff048222bb45c7162b505f38b Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Wed, 29 Jun 2011 18:24:49 +0900
> Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
>
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
>
> Changelog:
> - adjusted signedness to vm_swappiness.
> - drop swappiness from scan_control
> ---
> include/linux/swap.h | 10 +++++++---
> mm/memcontrol.c | 15 +++++++--------
> mm/vmscan.c | 23 ++++++++++-------------
> 3 files changed, 24 insertions(+), 24 deletions(-)
>
[...]
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3e7d5e6..db70176 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
[...]
> @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> {
> struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
>
> - return get_swappiness(memcg);
> + return mem_cgroup_swappiness(memcg);
> }
If you want to be type clean you should change this one as well. I
think it is worth it, though. The function is called only to return the
current value to userspace and mem_cgroup_swappiness_write guaranties
that it falls down into <0,100> interval. Additionally, cftype doesn't
have any read specialization for int values so you would need to use a
generic one. Finally if you changed read part you should change also
write part and add > 0 check which is a lot of code for not that good
reason.
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-30 6:32 ` Michal Hocko
@ 2011-06-30 7:10 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-06-30 7:10 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora, Ying Han
On Thu, 30 Jun 2011 08:32:32 +0200
Michal Hocko <mhocko@suse.cz> wrote:
> On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
> > On Wed, 29 Jun 2011 13:00:43 -0700
> > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > > On Wed, 29 Jun 2011 19:03:25 +0900
> > > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > >
> > > > Each memory cgroup has 'swappiness' value and it can be accessed by
> > > > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > > > and swappiness is passed by argument. It's propagated by scan_control.
> > > >
> > > > get_swappiness is static function but some planned updates will need to
> > > > get swappiness from files other than memcontrol.c
> > > > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > > > By this, we can remove the argument of swapiness from try_to_free...
> > > > and drop swappiness from scan_control. only memcg uses it.
> > > >
> > >
> > > > +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> > > > +unsigned int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> > > > +static int vmscan_swappiness(struct scan_control *sc)
> > >
> > > The patch seems a bit confused about the signedness of swappiness.
> > >
> >
> > ok, v3 here. Now, memcg's one use "int" because vm_swapiness is "int".
> > ==
> >
> > From af1bae8f2c6a8dbff048222bb45c7162b505f38b Mon Sep 17 00:00:00 2001
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > Date: Wed, 29 Jun 2011 18:24:49 +0900
> > Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
> >
> > Each memory cgroup has 'swappiness' value and it can be accessed by
> > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > and swappiness is passed by argument. It's propagated by scan_control.
> >
> > get_swappiness is static function but some planned updates will need to
> > get swappiness from files other than memcontrol.c
> > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > By this, we can remove the argument of swapiness from try_to_free...
> > and drop swappiness from scan_control. only memcg uses it.
> >
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> Reviewed-by: Michal Hocko <mhocko@suse.cz>
>
> >
> > Changelog:
> > - adjusted signedness to vm_swappiness.
> > - drop swappiness from scan_control
> > ---
> > include/linux/swap.h | 10 +++++++---
> > mm/memcontrol.c | 15 +++++++--------
> > mm/vmscan.c | 23 ++++++++++-------------
> > 3 files changed, 24 insertions(+), 24 deletions(-)
> >
> [...]
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 3e7d5e6..db70176 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> [...]
> > @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> > {
> > struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> >
> > - return get_swappiness(memcg);
> > + return mem_cgroup_swappiness(memcg);
> > }
>
> If you want to be type clean you should change this one as well. I
> think it is worth it, though. The function is called only to return the
> current value to userspace and mem_cgroup_swappiness_write guaranties
> that it falls down into <0,100> interval. Additionally, cftype doesn't
> have any read specialization for int values so you would need to use a
> generic one. Finally if you changed read part you should change also
> write part and add > 0 check which is a lot of code for not that good
> reason.
I don't want to make this type-clean. Should I add type casting as
==
return (u64) mem_cgroup_swappiness(memcg);
==
?
Thanks,
-Kame
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-30 7:10 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-06-30 7:10 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora, Ying Han
On Thu, 30 Jun 2011 08:32:32 +0200
Michal Hocko <mhocko@suse.cz> wrote:
> On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
> > On Wed, 29 Jun 2011 13:00:43 -0700
> > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > > On Wed, 29 Jun 2011 19:03:25 +0900
> > > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > >
> > > > Each memory cgroup has 'swappiness' value and it can be accessed by
> > > > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > > > and swappiness is passed by argument. It's propagated by scan_control.
> > > >
> > > > get_swappiness is static function but some planned updates will need to
> > > > get swappiness from files other than memcontrol.c
> > > > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > > > By this, we can remove the argument of swapiness from try_to_free...
> > > > and drop swappiness from scan_control. only memcg uses it.
> > > >
> > >
> > > > +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> > > > +unsigned int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> > > > +static int vmscan_swappiness(struct scan_control *sc)
> > >
> > > The patch seems a bit confused about the signedness of swappiness.
> > >
> >
> > ok, v3 here. Now, memcg's one use "int" because vm_swapiness is "int".
> > ==
> >
> > From af1bae8f2c6a8dbff048222bb45c7162b505f38b Mon Sep 17 00:00:00 2001
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > Date: Wed, 29 Jun 2011 18:24:49 +0900
> > Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
> >
> > Each memory cgroup has 'swappiness' value and it can be accessed by
> > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > and swappiness is passed by argument. It's propagated by scan_control.
> >
> > get_swappiness is static function but some planned updates will need to
> > get swappiness from files other than memcontrol.c
> > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > By this, we can remove the argument of swapiness from try_to_free...
> > and drop swappiness from scan_control. only memcg uses it.
> >
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> Reviewed-by: Michal Hocko <mhocko@suse.cz>
>
> >
> > Changelog:
> > - adjusted signedness to vm_swappiness.
> > - drop swappiness from scan_control
> > ---
> > include/linux/swap.h | 10 +++++++---
> > mm/memcontrol.c | 15 +++++++--------
> > mm/vmscan.c | 23 ++++++++++-------------
> > 3 files changed, 24 insertions(+), 24 deletions(-)
> >
> [...]
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 3e7d5e6..db70176 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> [...]
> > @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> > {
> > struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> >
> > - return get_swappiness(memcg);
> > + return mem_cgroup_swappiness(memcg);
> > }
>
> If you want to be type clean you should change this one as well. I
> think it is worth it, though. The function is called only to return the
> current value to userspace and mem_cgroup_swappiness_write guaranties
> that it falls down into <0,100> interval. Additionally, cftype doesn't
> have any read specialization for int values so you would need to use a
> generic one. Finally if you changed read part you should change also
> write part and add > 0 check which is a lot of code for not that good
> reason.
I don't want to make this type-clean. Should I add type casting as
==
return (u64) mem_cgroup_swappiness(memcg);
==
?
Thanks,
-Kame
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-30 7:10 ` KAMEZAWA Hiroyuki
@ 2011-06-30 7:33 ` Michal Hocko
-1 siblings, 0 replies; 32+ messages in thread
From: Michal Hocko @ 2011-06-30 7:33 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora, Ying Han
On Thu 30-06-11 16:10:39, KAMEZAWA Hiroyuki wrote:
> On Thu, 30 Jun 2011 08:32:32 +0200
> Michal Hocko <mhocko@suse.cz> wrote:
>
> > On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
> > [...]
> > > @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> > > {
> > > struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> > >
> > > - return get_swappiness(memcg);
> > > + return mem_cgroup_swappiness(memcg);
> > > }
> >
> > If you want to be type clean you should change this one as well. I
> > think it is worth it, though. The function is called only to return the
> > current value to userspace and mem_cgroup_swappiness_write guaranties
> > that it falls down into <0,100> interval. Additionally, cftype doesn't
> > have any read specialization for int values so you would need to use a
> > generic one. Finally if you changed read part you should change also
> > write part and add > 0 check which is a lot of code for not that good
> > reason.
>
> I don't want to make this type-clean.
Agreed.
> Should I add type casting as
> ==
> return (u64) mem_cgroup_swappiness(memcg);
> ==
> ?
I do not think it is necessary. The value is promoted to u64
automatically.
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-30 7:33 ` Michal Hocko
0 siblings, 0 replies; 32+ messages in thread
From: Michal Hocko @ 2011-06-30 7:33 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora, Ying Han
On Thu 30-06-11 16:10:39, KAMEZAWA Hiroyuki wrote:
> On Thu, 30 Jun 2011 08:32:32 +0200
> Michal Hocko <mhocko@suse.cz> wrote:
>
> > On Thu 30-06-11 12:32:29, KAMEZAWA Hiroyuki wrote:
> > [...]
> > > @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> > > {
> > > struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> > >
> > > - return get_swappiness(memcg);
> > > + return mem_cgroup_swappiness(memcg);
> > > }
> >
> > If you want to be type clean you should change this one as well. I
> > think it is worth it, though. The function is called only to return the
> > current value to userspace and mem_cgroup_swappiness_write guaranties
> > that it falls down into <0,100> interval. Additionally, cftype doesn't
> > have any read specialization for int values so you would need to use a
> > generic one. Finally if you changed read part you should change also
> > write part and add > 0 check which is a lot of code for not that good
> > reason.
>
> I don't want to make this type-clean.
Agreed.
> Should I add type casting as
> ==
> return (u64) mem_cgroup_swappiness(memcg);
> ==
> ?
I do not think it is necessary. The value is promoted to u64
automatically.
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-29 10:03 ` KAMEZAWA Hiroyuki
@ 2011-06-30 20:01 ` Andrew Morton
-1 siblings, 0 replies; 32+ messages in thread
From: Andrew Morton @ 2011-06-30 20:01 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
On Wed, 29 Jun 2011 19:03:25 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
x86_64 allnoconfig (aka Documentation/SubmitChecklist, section 2b):
mm/vmscan.c: In function 'vmscan_swappiness':
mm/vmscan.c:1734: error: implicit declaration of function 'mem_cgroup_swappiness'
This is pretty broken. I think we do want to implement this for
CONFIG_CGROUP_MEM_RES_CTLR=y, CONFIG_SWAP=n:
--- a/include/linux/swap.h~memcg-export-memory-cgroups-swappiness-fix
+++ a/include/linux/swap.h
@@ -365,17 +365,12 @@ static inline void put_swap_token(struct
extern void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
-extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
#else
static inline void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
{
}
-static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
-{
- return vm_swappiness;
-}
#endif
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
@@ -510,5 +505,15 @@ mem_cgroup_count_swap_user(swp_entry_t e
#endif
#endif /* CONFIG_SWAP */
+
+#ifdef CONFIG_CGROUP_MEM_RES_CTLR
+extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
+#else
+static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
+{
+ return vm_swappiness;
+}
+#endif
+
#endif /* __KERNEL__*/
#endif /* _LINUX_SWAP_H */
But what is the role of CONFIG_CGROUP_MEM_RES_CTLR_SWAP?
And in the above circumstances, vmscan_swappiness() devolves into
static int vmscan_swappiness(struct scan_control *sc)
{
if (scanning_global_lru(sc))
return vm_swappiness;
return vm_swappiness;
}
which I guess makes sense but seems a bit odd.
Anyway, my confidence level is low so I think I'll drop this patch.
Please have a think about the interplay between
CONFIG_CGROUP_MEM_RES_CTLR, CONFIG_CGROUP_MEM_RES_CTLR_SWAP and
CONFIG_SWAP.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-30 20:01 ` Andrew Morton
0 siblings, 0 replies; 32+ messages in thread
From: Andrew Morton @ 2011-06-30 20:01 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
On Wed, 29 Jun 2011 19:03:25 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
x86_64 allnoconfig (aka Documentation/SubmitChecklist, section 2b):
mm/vmscan.c: In function 'vmscan_swappiness':
mm/vmscan.c:1734: error: implicit declaration of function 'mem_cgroup_swappiness'
This is pretty broken. I think we do want to implement this for
CONFIG_CGROUP_MEM_RES_CTLR=y, CONFIG_SWAP=n:
--- a/include/linux/swap.h~memcg-export-memory-cgroups-swappiness-fix
+++ a/include/linux/swap.h
@@ -365,17 +365,12 @@ static inline void put_swap_token(struct
extern void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
-extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
#else
static inline void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
{
}
-static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
-{
- return vm_swappiness;
-}
#endif
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
@@ -510,5 +505,15 @@ mem_cgroup_count_swap_user(swp_entry_t e
#endif
#endif /* CONFIG_SWAP */
+
+#ifdef CONFIG_CGROUP_MEM_RES_CTLR
+extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
+#else
+static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
+{
+ return vm_swappiness;
+}
+#endif
+
#endif /* __KERNEL__*/
#endif /* _LINUX_SWAP_H */
But what is the role of CONFIG_CGROUP_MEM_RES_CTLR_SWAP?
And in the above circumstances, vmscan_swappiness() devolves into
static int vmscan_swappiness(struct scan_control *sc)
{
if (scanning_global_lru(sc))
return vm_swappiness;
return vm_swappiness;
}
which I guess makes sense but seems a bit odd.
Anyway, my confidence level is low so I think I'll drop this patch.
Please have a think about the interplay between
CONFIG_CGROUP_MEM_RES_CTLR, CONFIG_CGROUP_MEM_RES_CTLR_SWAP and
CONFIG_SWAP.
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-30 20:01 ` Andrew Morton
@ 2011-06-30 23:50 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-06-30 23:50 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
On Thu, 30 Jun 2011 13:01:34 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 29 Jun 2011 19:03:25 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > Each memory cgroup has 'swappiness' value and it can be accessed by
> > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > and swappiness is passed by argument. It's propagated by scan_control.
> >
> > get_swappiness is static function but some planned updates will need to
> > get swappiness from files other than memcontrol.c
> > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > By this, we can remove the argument of swapiness from try_to_free...
> > and drop swappiness from scan_control. only memcg uses it.
>
> x86_64 allnoconfig (aka Documentation/SubmitChecklist, section 2b):
>
> mm/vmscan.c: In function 'vmscan_swappiness':
> mm/vmscan.c:1734: error: implicit declaration of function 'mem_cgroup_swappiness'
>
> This is pretty broken. I think we do want to implement this for
> CONFIG_CGROUP_MEM_RES_CTLR=y, CONFIG_SWAP=n:
>
> --- a/include/linux/swap.h~memcg-export-memory-cgroups-swappiness-fix
> +++ a/include/linux/swap.h
> @@ -365,17 +365,12 @@ static inline void put_swap_token(struct
> extern void
> mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
> extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
> -extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> #else
> static inline void
> mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
> {
> }
>
> -static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
> -{
> - return vm_swappiness;
> -}
> #endif
> #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
> @@ -510,5 +505,15 @@ mem_cgroup_count_swap_user(swp_entry_t e
> #endif
>
> #endif /* CONFIG_SWAP */
> +
> +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
> +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> +#else
> +static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
> +{
> + return vm_swappiness;
> +}
> +#endif
> +
> #endif /* __KERNEL__*/
> #endif /* _LINUX_SWAP_H */
>
> But what is the role of CONFIG_CGROUP_MEM_RES_CTLR_SWAP?
>
> And in the above circumstances, vmscan_swappiness() devolves into
>
> static int vmscan_swappiness(struct scan_control *sc)
> {
> if (scanning_global_lru(sc))
> return vm_swappiness;
> return vm_swappiness;
> }
>
> which I guess makes sense but seems a bit odd.
>
> Anyway, my confidence level is low so I think I'll drop this patch.
> Please have a think about the interplay between
> CONFIG_CGROUP_MEM_RES_CTLR, CONFIG_CGROUP_MEM_RES_CTLR_SWAP and
> CONFIG_SWAP.
>
>
Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
Thanks,
-Kame
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-06-30 23:50 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-06-30 23:50 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko, Ying Han
On Thu, 30 Jun 2011 13:01:34 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 29 Jun 2011 19:03:25 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > Each memory cgroup has 'swappiness' value and it can be accessed by
> > get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> > and swappiness is passed by argument. It's propagated by scan_control.
> >
> > get_swappiness is static function but some planned updates will need to
> > get swappiness from files other than memcontrol.c
> > This patch exports get_swappiness() as mem_cgroup_swappiness().
> > By this, we can remove the argument of swapiness from try_to_free...
> > and drop swappiness from scan_control. only memcg uses it.
>
> x86_64 allnoconfig (aka Documentation/SubmitChecklist, section 2b):
>
> mm/vmscan.c: In function 'vmscan_swappiness':
> mm/vmscan.c:1734: error: implicit declaration of function 'mem_cgroup_swappiness'
>
> This is pretty broken. I think we do want to implement this for
> CONFIG_CGROUP_MEM_RES_CTLR=y, CONFIG_SWAP=n:
>
> --- a/include/linux/swap.h~memcg-export-memory-cgroups-swappiness-fix
> +++ a/include/linux/swap.h
> @@ -365,17 +365,12 @@ static inline void put_swap_token(struct
> extern void
> mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
> extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
> -extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> #else
> static inline void
> mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
> {
> }
>
> -static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
> -{
> - return vm_swappiness;
> -}
> #endif
> #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
> @@ -510,5 +505,15 @@ mem_cgroup_count_swap_user(swp_entry_t e
> #endif
>
> #endif /* CONFIG_SWAP */
> +
> +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
> +extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
> +#else
> +static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
> +{
> + return vm_swappiness;
> +}
> +#endif
> +
> #endif /* __KERNEL__*/
> #endif /* _LINUX_SWAP_H */
>
> But what is the role of CONFIG_CGROUP_MEM_RES_CTLR_SWAP?
>
> And in the above circumstances, vmscan_swappiness() devolves into
>
> static int vmscan_swappiness(struct scan_control *sc)
> {
> if (scanning_global_lru(sc))
> return vm_swappiness;
> return vm_swappiness;
> }
>
> which I guess makes sense but seems a bit odd.
>
> Anyway, my confidence level is low so I think I'll drop this patch.
> Please have a think about the interplay between
> CONFIG_CGROUP_MEM_RES_CTLR, CONFIG_CGROUP_MEM_RES_CTLR_SWAP and
> CONFIG_SWAP.
>
>
Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
Thanks,
-Kame
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-06-30 23:50 ` KAMEZAWA Hiroyuki
@ 2011-07-01 0:20 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-01 0:20 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora,
Michal Hocko, Ying Han
On Fri, 1 Jul 2011 08:50:13 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Thu, 30 Jun 2011 13:01:34 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
> Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
>
v4 here. Thank you for pointing out. I could think of several ways but
maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
to be a bug.
tested with allyesconfig/allnoconfig.
==
>From 0fb6905c288a16e99ee739f65cb486451e840637 Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Date: Wed, 29 Jun 2011 18:24:49 +0900
Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
Each memory cgroup has 'swappiness' value and it can be accessed by
get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
and swappiness is passed by argument. It's propagated by scan_control.
get_swappiness is static function but some planned updates will need to
get swappiness from files other than memcontrol.c
This patch exports get_swappiness() as mem_cgroup_swappiness().
By this, we can remove the argument of swapiness from try_to_free...
and drop swappiness from scan_control. only memcg uses it.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Changelog:
- fixed/tested allyesconfig/allnoconfig compile failure.
- adjusted signedness to vm_swappiness.
- drop swappiness from scan_control
---
include/linux/swap.h | 10 +++++++---
mm/memcontrol.c | 15 +++++++--------
mm/vmscan.c | 33 ++++++++++++++++++++-------------
3 files changed, 34 insertions(+), 24 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a273468..0299832 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -252,11 +252,9 @@ static inline void lru_cache_add_file(struct page *page)
extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
gfp_t gfp_mask, nodemask_t *mask);
extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
- gfp_t gfp_mask, bool noswap,
- unsigned int swappiness);
+ gfp_t gfp_mask, bool noswap);
extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned);
extern int __isolate_lru_page(struct page *page, int mode, int file);
@@ -365,11 +363,17 @@ static inline void put_swap_token(struct mm_struct *mm)
extern void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
+extern int mem_cgroup_swappiness(struct mem_cgroup *mem);
#else
static inline void
mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
{
}
+
+static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
+{
+ return vm_swappiness;
+}
#endif
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3e7d5e6..db70176 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -249,7 +249,7 @@ struct mem_cgroup {
atomic_t oom_lock;
atomic_t refcnt;
- unsigned int swappiness;
+ int swappiness;
/* OOM-Killer disable */
int oom_kill_disable;
@@ -1330,7 +1330,7 @@ static unsigned long mem_cgroup_margin(struct mem_cgroup *mem)
return margin >> PAGE_SHIFT;
}
-static unsigned int get_swappiness(struct mem_cgroup *memcg)
+int mem_cgroup_swappiness(struct mem_cgroup *memcg)
{
struct cgroup *cgrp = memcg->css.cgroup;
@@ -1776,12 +1776,11 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
/* we use swappiness of local cgroup */
if (check_soft) {
ret = mem_cgroup_shrink_node_zone(victim, gfp_mask,
- noswap, get_swappiness(victim), zone,
- &nr_scanned);
+ noswap, zone, &nr_scanned);
*total_scanned += nr_scanned;
} else
ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
- noswap, get_swappiness(victim));
+ noswap);
css_put(&victim->css);
/*
* At shrinking usage, we can't check we should stop here or
@@ -3826,7 +3825,7 @@ try_to_free:
goto out;
}
progress = try_to_free_mem_cgroup_pages(mem, GFP_KERNEL,
- false, get_swappiness(mem));
+ false);
if (!progress) {
nr_retries--;
/* maybe some writeback is necessary */
@@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
{
struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
- return get_swappiness(memcg);
+ return mem_cgroup_swappiness(memcg);
}
static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
@@ -4997,7 +4996,7 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
INIT_LIST_HEAD(&mem->oom_notify);
if (parent)
- mem->swappiness = get_swappiness(parent);
+ mem->swappiness = mem_cgroup_swappiness(parent);
atomic_set(&mem->refcnt, 1);
mem->move_charge_at_immigrate = 0;
mutex_init(&mem->thresholds_lock);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4f49535..3d1d733 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -95,8 +95,6 @@ struct scan_control {
/* Can pages be swapped as part of reclaim? */
int may_swap;
- int swappiness;
-
int order;
/*
@@ -1729,6 +1727,23 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
}
+#ifdef CONFIG_SWAP
+static int vmscan_swappiness(struct scan_control *sc)
+{
+ if (scanning_global_lru(sc))
+ return vm_swappiness;
+ return mem_cgroup_swappiness(sc->mem_cgroup);
+}
+#else
+static int vmscan_swappiness(struct scan_control *sc)
+{
+ /* Now, this function is never called with !CONFIG_SWAP */
+ BUG();
+ return 0;
+}
+#endif
+
+
/*
* Determine how aggressively the anon and file LRU lists should be
* scanned. The relative value of each set of LRU lists is determined
@@ -1789,8 +1804,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
* With swappiness at 100, anonymous and file have the same priority.
* This scanning priority is essentially the inverse of IO cost.
*/
- anon_prio = sc->swappiness;
- file_prio = 200 - sc->swappiness;
+ anon_prio = vmscan_swappiness(sc);
+ file_prio = 200 - vmscan_swappiness(sc);
/*
* OK, so we have swap space and a fair amount of page cache
@@ -2179,7 +2194,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
.nr_to_reclaim = SWAP_CLUSTER_MAX,
.may_unmap = 1,
.may_swap = 1,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
.nodemask = nodemask,
@@ -2203,7 +2217,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned)
{
@@ -2213,7 +2226,6 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
.may_writepage = !laptop_mode,
.may_unmap = 1,
.may_swap = !noswap,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem,
};
@@ -2242,8 +2254,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
gfp_t gfp_mask,
- bool noswap,
- unsigned int swappiness)
+ bool noswap)
{
struct zonelist *zonelist;
unsigned long nr_reclaimed;
@@ -2253,7 +2264,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
.may_unmap = 1,
.may_swap = !noswap,
.nr_to_reclaim = SWAP_CLUSTER_MAX,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem_cont,
.nodemask = NULL, /* we don't care the placement */
@@ -2403,7 +2413,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
* we want to put equal scanning pressure on each zone.
*/
.nr_to_reclaim = ULONG_MAX,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
};
@@ -2862,7 +2871,6 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
.may_writepage = 1,
.nr_to_reclaim = nr_to_reclaim,
.hibernation_mode = 1,
- .swappiness = vm_swappiness,
.order = 0,
};
struct shrink_control shrink = {
@@ -3049,7 +3057,6 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
.nr_to_reclaim = max_t(unsigned long, nr_pages,
SWAP_CLUSTER_MAX),
.gfp_mask = gfp_mask,
- .swappiness = vm_swappiness,
.order = order,
};
struct shrink_control shrink = {
--
1.7.4.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-07-01 0:20 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-01 0:20 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora,
Michal Hocko, Ying Han
On Fri, 1 Jul 2011 08:50:13 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Thu, 30 Jun 2011 13:01:34 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
> Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
>
v4 here. Thank you for pointing out. I could think of several ways but
maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
to be a bug.
tested with allyesconfig/allnoconfig.
==
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-07-01 0:20 ` KAMEZAWA Hiroyuki
@ 2011-07-01 1:06 ` Andrew Morton
-1 siblings, 0 replies; 32+ messages in thread
From: Andrew Morton @ 2011-07-01 1:06 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko,
Ying Han, Shaohua Li, KOSAKI Motohiro
On Fri, 1 Jul 2011 09:20:59 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Fri, 1 Jul 2011 08:50:13 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > On Thu, 30 Jun 2011 13:01:34 -0700
> > Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
> >
>
> v4 here. Thank you for pointing out. I could think of several ways but
> maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
> to be a bug.
No, it isn't a bug - swappiness also controls the kernel's eagerness to
unmap and reclaim mmapped pagecache.
> tested with allyesconfig/allnoconfig.
Did it break the above?
> +#ifdef CONFIG_SWAP
> +static int vmscan_swappiness(struct scan_control *sc)
> +{
> + if (scanning_global_lru(sc))
> + return vm_swappiness;
Well that's a bit ugly - it assumes that all callers set
scan_control.swappiness to vm_swappiness then never change it. That
may be true in the current code.
Ho hum, I guess that's a simplification we can make.
> + return mem_cgroup_swappiness(sc->mem_cgroup);
> +}
> +#else
> +static int vmscan_swappiness(struct scan_control *sc)
> +{
> + /* Now, this function is never called with !CONFIG_SWAP */
> + BUG();
> + return 0;
> +}
> +#endif
>
> ...
>
> @@ -1789,8 +1804,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
> * With swappiness at 100, anonymous and file have the same priority.
> * This scanning priority is essentially the inverse of IO cost.
> */
> - anon_prio = sc->swappiness;
> - file_prio = 200 - sc->swappiness;
> + anon_prio = vmscan_swappiness(sc);
> + file_prio = 200 - vmscan_swappiness(sc);
hah, this should go BUG if CONFIG_SWAP=n. But it won't, because we
broke get_scan_count(). It fails to apply vm_swappiness to file-backed
pages if there's no available swap, which is daft.
I think this happened in 76a33fc380c9a ("vmscan: prevent
get_scan_ratio() rounding errors") which claims "this patch doesn't
really change logics, but just increase precision".
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-07-01 1:06 ` Andrew Morton
0 siblings, 0 replies; 32+ messages in thread
From: Andrew Morton @ 2011-07-01 1:06 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko,
Ying Han, Shaohua Li, KOSAKI Motohiro
On Fri, 1 Jul 2011 09:20:59 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Fri, 1 Jul 2011 08:50:13 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > On Thu, 30 Jun 2011 13:01:34 -0700
> > Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
> >
>
> v4 here. Thank you for pointing out. I could think of several ways but
> maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
> to be a bug.
No, it isn't a bug - swappiness also controls the kernel's eagerness to
unmap and reclaim mmapped pagecache.
> tested with allyesconfig/allnoconfig.
Did it break the above?
> +#ifdef CONFIG_SWAP
> +static int vmscan_swappiness(struct scan_control *sc)
> +{
> + if (scanning_global_lru(sc))
> + return vm_swappiness;
Well that's a bit ugly - it assumes that all callers set
scan_control.swappiness to vm_swappiness then never change it. That
may be true in the current code.
Ho hum, I guess that's a simplification we can make.
> + return mem_cgroup_swappiness(sc->mem_cgroup);
> +}
> +#else
> +static int vmscan_swappiness(struct scan_control *sc)
> +{
> + /* Now, this function is never called with !CONFIG_SWAP */
> + BUG();
> + return 0;
> +}
> +#endif
>
> ...
>
> @@ -1789,8 +1804,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
> * With swappiness at 100, anonymous and file have the same priority.
> * This scanning priority is essentially the inverse of IO cost.
> */
> - anon_prio = sc->swappiness;
> - file_prio = 200 - sc->swappiness;
> + anon_prio = vmscan_swappiness(sc);
> + file_prio = 200 - vmscan_swappiness(sc);
hah, this should go BUG if CONFIG_SWAP=n. But it won't, because we
broke get_scan_count(). It fails to apply vm_swappiness to file-backed
pages if there's no available swap, which is daft.
I think this happened in 76a33fc380c9a ("vmscan: prevent
get_scan_ratio() rounding errors") which claims "this patch doesn't
really change logics, but just increase precision".
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-07-01 1:06 ` Andrew Morton
@ 2011-07-01 1:16 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-01 1:16 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko,
Ying Han, Shaohua Li, KOSAKI Motohiro
On Thu, 30 Jun 2011 18:06:53 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 1 Jul 2011 09:20:59 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > On Fri, 1 Jul 2011 08:50:13 +0900
> > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> >
> > > On Thu, 30 Jun 2011 13:01:34 -0700
> > > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > > Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
> > >
> >
> > v4 here. Thank you for pointing out. I could think of several ways but
> > maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
> > to be a bug.
>
> No, it isn't a bug - swappiness also controls the kernel's eagerness to
> unmap and reclaim mmapped pagecache.
>
Oh, really ? I didn't understand that.
> > tested with allyesconfig/allnoconfig.
>
> Did it break the above?
>
Hmm. If !CONFIG_SWAP, get_scan_count() will see !nr_swap_pages and
set scan ratio as
file: 100%
anon: 0%
> > +#ifdef CONFIG_SWAP
> > +static int vmscan_swappiness(struct scan_control *sc)
> > +{
> > + if (scanning_global_lru(sc))
> > + return vm_swappiness;
>
> Well that's a bit ugly - it assumes that all callers set
> scan_control.swappiness to vm_swappiness then never change it. That
> may be true in the current code.
>
> Ho hum, I guess that's a simplification we can make.
>
We don't calculate kernel internal swappiness and just use vm_swappines
which the user specified. So, I thought it should not be in scan_control.
> > + return mem_cgroup_swappiness(sc->mem_cgroup);
> > +}
> > +#else
> > +static int vmscan_swappiness(struct scan_control *sc)
> > +{
> > + /* Now, this function is never called with !CONFIG_SWAP */
> > + BUG();
> > + return 0;
> > +}
> > +#endif
> >
> > ...
> >
> > @@ -1789,8 +1804,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
> > * With swappiness at 100, anonymous and file have the same priority.
> > * This scanning priority is essentially the inverse of IO cost.
> > */
> > - anon_prio = sc->swappiness;
> > - file_prio = 200 - sc->swappiness;
> > + anon_prio = vmscan_swappiness(sc);
> > + file_prio = 200 - vmscan_swappiness(sc);
>
> hah, this should go BUG if CONFIG_SWAP=n. But it won't, because we
> broke get_scan_count(). It fails to apply vm_swappiness to file-backed
> pages if there's no available swap, which is daft.
>
> I think this happened in 76a33fc380c9a ("vmscan: prevent
> get_scan_ratio() rounding errors") which claims "this patch doesn't
> really change logics, but just increase precision".
>
Hmm, IIUC.
- the controller of unmapping file cache is now sc->may_unmap
- may_unmap is always set 1 unless zone_reclaim_mode.
- vm_swappiness doesn't affect it now.
- file LRU contains both mapped and unmapped pages in the same manner
- get_scan_count() cannot help decisiion of "map or unmap"
- Active/Inactive scan ratio is now determined by reclaim_stat.
Hmm, swappiness should affect active/inactive scan ratio ?
Thanks,
-Kame
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-07-01 1:16 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-01 1:16 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, linux-kernel, nishimura, bsingharora, Michal Hocko,
Ying Han, Shaohua Li, KOSAKI Motohiro
On Thu, 30 Jun 2011 18:06:53 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 1 Jul 2011 09:20:59 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > On Fri, 1 Jul 2011 08:50:13 +0900
> > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> >
> > > On Thu, 30 Jun 2011 13:01:34 -0700
> > > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > > Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
> > >
> >
> > v4 here. Thank you for pointing out. I could think of several ways but
> > maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
> > to be a bug.
>
> No, it isn't a bug - swappiness also controls the kernel's eagerness to
> unmap and reclaim mmapped pagecache.
>
Oh, really ? I didn't understand that.
> > tested with allyesconfig/allnoconfig.
>
> Did it break the above?
>
Hmm. If !CONFIG_SWAP, get_scan_count() will see !nr_swap_pages and
set scan ratio as
file: 100%
anon: 0%
> > +#ifdef CONFIG_SWAP
> > +static int vmscan_swappiness(struct scan_control *sc)
> > +{
> > + if (scanning_global_lru(sc))
> > + return vm_swappiness;
>
> Well that's a bit ugly - it assumes that all callers set
> scan_control.swappiness to vm_swappiness then never change it. That
> may be true in the current code.
>
> Ho hum, I guess that's a simplification we can make.
>
We don't calculate kernel internal swappiness and just use vm_swappines
which the user specified. So, I thought it should not be in scan_control.
> > + return mem_cgroup_swappiness(sc->mem_cgroup);
> > +}
> > +#else
> > +static int vmscan_swappiness(struct scan_control *sc)
> > +{
> > + /* Now, this function is never called with !CONFIG_SWAP */
> > + BUG();
> > + return 0;
> > +}
> > +#endif
> >
> > ...
> >
> > @@ -1789,8 +1804,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
> > * With swappiness at 100, anonymous and file have the same priority.
> > * This scanning priority is essentially the inverse of IO cost.
> > */
> > - anon_prio = sc->swappiness;
> > - file_prio = 200 - sc->swappiness;
> > + anon_prio = vmscan_swappiness(sc);
> > + file_prio = 200 - vmscan_swappiness(sc);
>
> hah, this should go BUG if CONFIG_SWAP=n. But it won't, because we
> broke get_scan_count(). It fails to apply vm_swappiness to file-backed
> pages if there's no available swap, which is daft.
>
> I think this happened in 76a33fc380c9a ("vmscan: prevent
> get_scan_ratio() rounding errors") which claims "this patch doesn't
> really change logics, but just increase precision".
>
Hmm, IIUC.
- the controller of unmapping file cache is now sc->may_unmap
- may_unmap is always set 1 unless zone_reclaim_mode.
- vm_swappiness doesn't affect it now.
- file LRU contains both mapped and unmapped pages in the same manner
- get_scan_count() cannot help decisiion of "map or unmap"
- Active/Inactive scan ratio is now determined by reclaim_stat.
Hmm, swappiness should affect active/inactive scan ratio ?
Thanks,
-Kame
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-07-01 1:16 ` KAMEZAWA Hiroyuki
@ 2011-07-01 1:30 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-01 1:30 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora,
Michal Hocko, Ying Han, Shaohua Li, KOSAKI Motohiro
On Fri, 1 Jul 2011 10:16:24 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Thu, 30 Jun 2011 18:06:53 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Fri, 1 Jul 2011 09:20:59 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> >
> > > On Fri, 1 Jul 2011 08:50:13 +0900
> > > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > >
> > > > On Thu, 30 Jun 2011 13:01:34 -0700
> > > > Andrew Morton <akpm@linux-foundation.org> wrote:
> > >
> > > > Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
> > > >
> > >
> > > v4 here. Thank you for pointing out. I could think of several ways but
> > > maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
> > > to be a bug.
> >
> > No, it isn't a bug - swappiness also controls the kernel's eagerness to
> > unmap and reclaim mmapped pagecache.
> >
>
> Oh, really ? I didn't understand that.
>
Hmm, anyway, this new version of fix seems better.
==
>From 7daf93a277e19026bb6edef3e0ac01bbd31dcb5e Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Date: Fri, 1 Jul 2011 10:35:57 +0900
Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
Each memory cgroup has 'swappiness' value and it can be accessed by
get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
and swappiness is passed by argument. It's propagated by scan_control.
get_swappiness is static function but some planned updates will need to
get swappiness from files other than memcontrol.c
This patch exports get_swappiness() as mem_cgroup_swappiness().
By this, we can remove the argument of swapiness from try_to_free...
and drop swappiness from scan_control. only memcg uses it.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Changelog:
- move definistions out of CONFIG_SWAP.
- fixed/tested allyesconfig/allnoconfig compile failure.
- adjusted signedness to vm_swappiness.
- drop swappiness from scan_control
---
include/linux/swap.h | 13 +++++++++----
mm/memcontrol.c | 15 +++++++--------
mm/vmscan.c | 23 ++++++++++-------------
3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a273468..28f1490 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -252,11 +252,9 @@ static inline void lru_cache_add_file(struct page *page)
extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
gfp_t gfp_mask, nodemask_t *mask);
extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
- gfp_t gfp_mask, bool noswap,
- unsigned int swappiness);
+ gfp_t gfp_mask, bool noswap);
extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned);
extern int __isolate_lru_page(struct page *page, int mode, int file);
@@ -299,7 +297,14 @@ static inline void scan_unevictable_unregister_node(struct node *node)
extern int kswapd_run(int nid);
extern void kswapd_stop(int nid);
-
+#ifdef CONFIG_MEM_CGROUP_MEM_RES_CTLR
+extern int mem_cgroup_swappiness(struct mem_cgroup *mem);
+#else
+static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
+{
+ return vm_swappiness;
+}
+#endif
#ifdef CONFIG_SWAP
/* linux/mm/page_io.c */
extern int swap_readpage(struct page *);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3e7d5e6..db70176 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -249,7 +249,7 @@ struct mem_cgroup {
atomic_t oom_lock;
atomic_t refcnt;
- unsigned int swappiness;
+ int swappiness;
/* OOM-Killer disable */
int oom_kill_disable;
@@ -1330,7 +1330,7 @@ static unsigned long mem_cgroup_margin(struct mem_cgroup *mem)
return margin >> PAGE_SHIFT;
}
-static unsigned int get_swappiness(struct mem_cgroup *memcg)
+int mem_cgroup_swappiness(struct mem_cgroup *memcg)
{
struct cgroup *cgrp = memcg->css.cgroup;
@@ -1776,12 +1776,11 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
/* we use swappiness of local cgroup */
if (check_soft) {
ret = mem_cgroup_shrink_node_zone(victim, gfp_mask,
- noswap, get_swappiness(victim), zone,
- &nr_scanned);
+ noswap, zone, &nr_scanned);
*total_scanned += nr_scanned;
} else
ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
- noswap, get_swappiness(victim));
+ noswap);
css_put(&victim->css);
/*
* At shrinking usage, we can't check we should stop here or
@@ -3826,7 +3825,7 @@ try_to_free:
goto out;
}
progress = try_to_free_mem_cgroup_pages(mem, GFP_KERNEL,
- false, get_swappiness(mem));
+ false);
if (!progress) {
nr_retries--;
/* maybe some writeback is necessary */
@@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
{
struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
- return get_swappiness(memcg);
+ return mem_cgroup_swappiness(memcg);
}
static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
@@ -4997,7 +4996,7 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
INIT_LIST_HEAD(&mem->oom_notify);
if (parent)
- mem->swappiness = get_swappiness(parent);
+ mem->swappiness = mem_cgroup_swappiness(parent);
atomic_set(&mem->refcnt, 1);
mem->move_charge_at_immigrate = 0;
mutex_init(&mem->thresholds_lock);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4f49535..fb37699 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -95,8 +95,6 @@ struct scan_control {
/* Can pages be swapped as part of reclaim? */
int may_swap;
- int swappiness;
-
int order;
/*
@@ -1729,6 +1727,13 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
}
+static int vmscan_swappiness(struct scan_control *sc)
+{
+ if (scanning_global_lru(sc))
+ return vm_swappiness;
+ return mem_cgroup_swappiness(sc->mem_cgroup);
+}
+
/*
* Determine how aggressively the anon and file LRU lists should be
* scanned. The relative value of each set of LRU lists is determined
@@ -1789,8 +1794,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
* With swappiness at 100, anonymous and file have the same priority.
* This scanning priority is essentially the inverse of IO cost.
*/
- anon_prio = sc->swappiness;
- file_prio = 200 - sc->swappiness;
+ anon_prio = vmscan_swappiness(sc);
+ file_prio = 200 - vmscan_swappiness(sc);
/*
* OK, so we have swap space and a fair amount of page cache
@@ -2179,7 +2184,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
.nr_to_reclaim = SWAP_CLUSTER_MAX,
.may_unmap = 1,
.may_swap = 1,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
.nodemask = nodemask,
@@ -2203,7 +2207,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned)
{
@@ -2213,7 +2216,6 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
.may_writepage = !laptop_mode,
.may_unmap = 1,
.may_swap = !noswap,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem,
};
@@ -2242,8 +2244,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
gfp_t gfp_mask,
- bool noswap,
- unsigned int swappiness)
+ bool noswap)
{
struct zonelist *zonelist;
unsigned long nr_reclaimed;
@@ -2253,7 +2254,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
.may_unmap = 1,
.may_swap = !noswap,
.nr_to_reclaim = SWAP_CLUSTER_MAX,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem_cont,
.nodemask = NULL, /* we don't care the placement */
@@ -2403,7 +2403,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
* we want to put equal scanning pressure on each zone.
*/
.nr_to_reclaim = ULONG_MAX,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
};
@@ -2862,7 +2861,6 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
.may_writepage = 1,
.nr_to_reclaim = nr_to_reclaim,
.hibernation_mode = 1,
- .swappiness = vm_swappiness,
.order = 0,
};
struct shrink_control shrink = {
@@ -3049,7 +3047,6 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
.nr_to_reclaim = max_t(unsigned long, nr_pages,
SWAP_CLUSTER_MAX),
.gfp_mask = gfp_mask,
- .swappiness = vm_swappiness,
.order = order,
};
struct shrink_control shrink = {
--
1.7.4.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-07-01 1:30 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-01 1:30 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora,
Michal Hocko, Ying Han, Shaohua Li, KOSAKI Motohiro
On Fri, 1 Jul 2011 10:16:24 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Thu, 30 Jun 2011 18:06:53 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Fri, 1 Jul 2011 09:20:59 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> >
> > > On Fri, 1 Jul 2011 08:50:13 +0900
> > > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > >
> > > > On Thu, 30 Jun 2011 13:01:34 -0700
> > > > Andrew Morton <akpm@linux-foundation.org> wrote:
> > >
> > > > Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
> > > >
> > >
> > > v4 here. Thank you for pointing out. I could think of several ways but
> > > maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
> > > to be a bug.
> >
> > No, it isn't a bug - swappiness also controls the kernel's eagerness to
> > unmap and reclaim mmapped pagecache.
> >
>
> Oh, really ? I didn't understand that.
>
Hmm, anyway, this new version of fix seems better.
==
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
2011-07-01 1:30 ` KAMEZAWA Hiroyuki
@ 2011-07-01 7:10 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-01 7:10 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora,
Michal Hocko, Ying Han, Shaohua Li, KOSAKI Motohiro
On Fri, 1 Jul 2011 10:30:07 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Fri, 1 Jul 2011 10:16:24 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > On Thu, 30 Jun 2011 18:06:53 -0700
> > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > > On Fri, 1 Jul 2011 09:20:59 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > >
> > > > On Fri, 1 Jul 2011 08:50:13 +0900
> > > > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > > >
> > > > > On Thu, 30 Jun 2011 13:01:34 -0700
> > > > > Andrew Morton <akpm@linux-foundation.org> wrote:
> > > >
> > > > > Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
> > > > >
> > > >
> > > > v4 here. Thank you for pointing out. I could think of several ways but
> > > > maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
> > > > to be a bug.
> > >
> > > No, it isn't a bug - swappiness also controls the kernel's eagerness to
> > > unmap and reclaim mmapped pagecache.
> > >
> >
> > Oh, really ? I didn't understand that.
> >
> Hmm, anyway, this new version of fix seems better.
Sorry, this seems still buggy. I'll send a new one in the next week :(
Thanks,
-Kame
> ==
> From 7daf93a277e19026bb6edef3e0ac01bbd31dcb5e Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Fri, 1 Jul 2011 10:35:57 +0900
> Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
>
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> Changelog:
> - move definistions out of CONFIG_SWAP.
> - fixed/tested allyesconfig/allnoconfig compile failure.
> - adjusted signedness to vm_swappiness.
> - drop swappiness from scan_control
> ---
> include/linux/swap.h | 13 +++++++++----
> mm/memcontrol.c | 15 +++++++--------
> mm/vmscan.c | 23 ++++++++++-------------
> 3 files changed, 26 insertions(+), 25 deletions(-)
>
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index a273468..28f1490 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -252,11 +252,9 @@ static inline void lru_cache_add_file(struct page *page)
> extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
> gfp_t gfp_mask, nodemask_t *mask);
> extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
> - gfp_t gfp_mask, bool noswap,
> - unsigned int swappiness);
> + gfp_t gfp_mask, bool noswap);
> extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
> gfp_t gfp_mask, bool noswap,
> - unsigned int swappiness,
> struct zone *zone,
> unsigned long *nr_scanned);
> extern int __isolate_lru_page(struct page *page, int mode, int file);
> @@ -299,7 +297,14 @@ static inline void scan_unevictable_unregister_node(struct node *node)
>
> extern int kswapd_run(int nid);
> extern void kswapd_stop(int nid);
> -
> +#ifdef CONFIG_MEM_CGROUP_MEM_RES_CTLR
> +extern int mem_cgroup_swappiness(struct mem_cgroup *mem);
> +#else
> +static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
> +{
> + return vm_swappiness;
> +}
> +#endif
> #ifdef CONFIG_SWAP
> /* linux/mm/page_io.c */
> extern int swap_readpage(struct page *);
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3e7d5e6..db70176 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -249,7 +249,7 @@ struct mem_cgroup {
> atomic_t oom_lock;
> atomic_t refcnt;
>
> - unsigned int swappiness;
> + int swappiness;
> /* OOM-Killer disable */
> int oom_kill_disable;
>
> @@ -1330,7 +1330,7 @@ static unsigned long mem_cgroup_margin(struct mem_cgroup *mem)
> return margin >> PAGE_SHIFT;
> }
>
> -static unsigned int get_swappiness(struct mem_cgroup *memcg)
> +int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> {
> struct cgroup *cgrp = memcg->css.cgroup;
>
> @@ -1776,12 +1776,11 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
> /* we use swappiness of local cgroup */
> if (check_soft) {
> ret = mem_cgroup_shrink_node_zone(victim, gfp_mask,
> - noswap, get_swappiness(victim), zone,
> - &nr_scanned);
> + noswap, zone, &nr_scanned);
> *total_scanned += nr_scanned;
> } else
> ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
> - noswap, get_swappiness(victim));
> + noswap);
> css_put(&victim->css);
> /*
> * At shrinking usage, we can't check we should stop here or
> @@ -3826,7 +3825,7 @@ try_to_free:
> goto out;
> }
> progress = try_to_free_mem_cgroup_pages(mem, GFP_KERNEL,
> - false, get_swappiness(mem));
> + false);
> if (!progress) {
> nr_retries--;
> /* maybe some writeback is necessary */
> @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> {
> struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
>
> - return get_swappiness(memcg);
> + return mem_cgroup_swappiness(memcg);
> }
>
> static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
> @@ -4997,7 +4996,7 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
> INIT_LIST_HEAD(&mem->oom_notify);
>
> if (parent)
> - mem->swappiness = get_swappiness(parent);
> + mem->swappiness = mem_cgroup_swappiness(parent);
> atomic_set(&mem->refcnt, 1);
> mem->move_charge_at_immigrate = 0;
> mutex_init(&mem->thresholds_lock);
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 4f49535..fb37699 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -95,8 +95,6 @@ struct scan_control {
> /* Can pages be swapped as part of reclaim? */
> int may_swap;
>
> - int swappiness;
> -
> int order;
>
> /*
> @@ -1729,6 +1727,13 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
> return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
> }
>
> +static int vmscan_swappiness(struct scan_control *sc)
> +{
> + if (scanning_global_lru(sc))
> + return vm_swappiness;
> + return mem_cgroup_swappiness(sc->mem_cgroup);
> +}
> +
> /*
> * Determine how aggressively the anon and file LRU lists should be
> * scanned. The relative value of each set of LRU lists is determined
> @@ -1789,8 +1794,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
> * With swappiness at 100, anonymous and file have the same priority.
> * This scanning priority is essentially the inverse of IO cost.
> */
> - anon_prio = sc->swappiness;
> - file_prio = 200 - sc->swappiness;
> + anon_prio = vmscan_swappiness(sc);
> + file_prio = 200 - vmscan_swappiness(sc);
>
> /*
> * OK, so we have swap space and a fair amount of page cache
> @@ -2179,7 +2184,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
> .nr_to_reclaim = SWAP_CLUSTER_MAX,
> .may_unmap = 1,
> .may_swap = 1,
> - .swappiness = vm_swappiness,
> .order = order,
> .mem_cgroup = NULL,
> .nodemask = nodemask,
> @@ -2203,7 +2207,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
>
> unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
> gfp_t gfp_mask, bool noswap,
> - unsigned int swappiness,
> struct zone *zone,
> unsigned long *nr_scanned)
> {
> @@ -2213,7 +2216,6 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
> .may_writepage = !laptop_mode,
> .may_unmap = 1,
> .may_swap = !noswap,
> - .swappiness = swappiness,
> .order = 0,
> .mem_cgroup = mem,
> };
> @@ -2242,8 +2244,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
>
> unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
> gfp_t gfp_mask,
> - bool noswap,
> - unsigned int swappiness)
> + bool noswap)
> {
> struct zonelist *zonelist;
> unsigned long nr_reclaimed;
> @@ -2253,7 +2254,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
> .may_unmap = 1,
> .may_swap = !noswap,
> .nr_to_reclaim = SWAP_CLUSTER_MAX,
> - .swappiness = swappiness,
> .order = 0,
> .mem_cgroup = mem_cont,
> .nodemask = NULL, /* we don't care the placement */
> @@ -2403,7 +2403,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
> * we want to put equal scanning pressure on each zone.
> */
> .nr_to_reclaim = ULONG_MAX,
> - .swappiness = vm_swappiness,
> .order = order,
> .mem_cgroup = NULL,
> };
> @@ -2862,7 +2861,6 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
> .may_writepage = 1,
> .nr_to_reclaim = nr_to_reclaim,
> .hibernation_mode = 1,
> - .swappiness = vm_swappiness,
> .order = 0,
> };
> struct shrink_control shrink = {
> @@ -3049,7 +3047,6 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
> .nr_to_reclaim = max_t(unsigned long, nr_pages,
> SWAP_CLUSTER_MAX),
> .gfp_mask = gfp_mask,
> - .swappiness = vm_swappiness,
> .order = order,
> };
> struct shrink_control shrink = {
> --
> 1.7.4.1
>
>
>
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
@ 2011-07-01 7:10 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-01 7:10 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora,
Michal Hocko, Ying Han, Shaohua Li, KOSAKI Motohiro
On Fri, 1 Jul 2011 10:30:07 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Fri, 1 Jul 2011 10:16:24 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > On Thu, 30 Jun 2011 18:06:53 -0700
> > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > > On Fri, 1 Jul 2011 09:20:59 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > >
> > > > On Fri, 1 Jul 2011 08:50:13 +0900
> > > > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > > >
> > > > > On Thu, 30 Jun 2011 13:01:34 -0700
> > > > > Andrew Morton <akpm@linux-foundation.org> wrote:
> > > >
> > > > > Ok, I'll check it. Maybe I miss !CONFIG_SWAP...
> > > > >
> > > >
> > > > v4 here. Thank you for pointing out. I could think of several ways but
> > > > maybe this one is good because using vm_swappines with !CONFIG_SWAP seems
> > > > to be a bug.
> > >
> > > No, it isn't a bug - swappiness also controls the kernel's eagerness to
> > > unmap and reclaim mmapped pagecache.
> > >
> >
> > Oh, really ? I didn't understand that.
> >
> Hmm, anyway, this new version of fix seems better.
Sorry, this seems still buggy. I'll send a new one in the next week :(
Thanks,
-Kame
> ==
> From 7daf93a277e19026bb6edef3e0ac01bbd31dcb5e Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Date: Fri, 1 Jul 2011 10:35:57 +0900
> Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
>
> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
>
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> Changelog:
> - move definistions out of CONFIG_SWAP.
> - fixed/tested allyesconfig/allnoconfig compile failure.
> - adjusted signedness to vm_swappiness.
> - drop swappiness from scan_control
> ---
> include/linux/swap.h | 13 +++++++++----
> mm/memcontrol.c | 15 +++++++--------
> mm/vmscan.c | 23 ++++++++++-------------
> 3 files changed, 26 insertions(+), 25 deletions(-)
>
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index a273468..28f1490 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -252,11 +252,9 @@ static inline void lru_cache_add_file(struct page *page)
> extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
> gfp_t gfp_mask, nodemask_t *mask);
> extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
> - gfp_t gfp_mask, bool noswap,
> - unsigned int swappiness);
> + gfp_t gfp_mask, bool noswap);
> extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
> gfp_t gfp_mask, bool noswap,
> - unsigned int swappiness,
> struct zone *zone,
> unsigned long *nr_scanned);
> extern int __isolate_lru_page(struct page *page, int mode, int file);
> @@ -299,7 +297,14 @@ static inline void scan_unevictable_unregister_node(struct node *node)
>
> extern int kswapd_run(int nid);
> extern void kswapd_stop(int nid);
> -
> +#ifdef CONFIG_MEM_CGROUP_MEM_RES_CTLR
> +extern int mem_cgroup_swappiness(struct mem_cgroup *mem);
> +#else
> +static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
> +{
> + return vm_swappiness;
> +}
> +#endif
> #ifdef CONFIG_SWAP
> /* linux/mm/page_io.c */
> extern int swap_readpage(struct page *);
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3e7d5e6..db70176 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -249,7 +249,7 @@ struct mem_cgroup {
> atomic_t oom_lock;
> atomic_t refcnt;
>
> - unsigned int swappiness;
> + int swappiness;
> /* OOM-Killer disable */
> int oom_kill_disable;
>
> @@ -1330,7 +1330,7 @@ static unsigned long mem_cgroup_margin(struct mem_cgroup *mem)
> return margin >> PAGE_SHIFT;
> }
>
> -static unsigned int get_swappiness(struct mem_cgroup *memcg)
> +int mem_cgroup_swappiness(struct mem_cgroup *memcg)
> {
> struct cgroup *cgrp = memcg->css.cgroup;
>
> @@ -1776,12 +1776,11 @@ static int mem_cgroup_hierarchical_reclaim(struct mem_cgroup *root_mem,
> /* we use swappiness of local cgroup */
> if (check_soft) {
> ret = mem_cgroup_shrink_node_zone(victim, gfp_mask,
> - noswap, get_swappiness(victim), zone,
> - &nr_scanned);
> + noswap, zone, &nr_scanned);
> *total_scanned += nr_scanned;
> } else
> ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
> - noswap, get_swappiness(victim));
> + noswap);
> css_put(&victim->css);
> /*
> * At shrinking usage, we can't check we should stop here or
> @@ -3826,7 +3825,7 @@ try_to_free:
> goto out;
> }
> progress = try_to_free_mem_cgroup_pages(mem, GFP_KERNEL,
> - false, get_swappiness(mem));
> + false);
> if (!progress) {
> nr_retries--;
> /* maybe some writeback is necessary */
> @@ -4288,7 +4287,7 @@ static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft)
> {
> struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
>
> - return get_swappiness(memcg);
> + return mem_cgroup_swappiness(memcg);
> }
>
> static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
> @@ -4997,7 +4996,7 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
> INIT_LIST_HEAD(&mem->oom_notify);
>
> if (parent)
> - mem->swappiness = get_swappiness(parent);
> + mem->swappiness = mem_cgroup_swappiness(parent);
> atomic_set(&mem->refcnt, 1);
> mem->move_charge_at_immigrate = 0;
> mutex_init(&mem->thresholds_lock);
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 4f49535..fb37699 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -95,8 +95,6 @@ struct scan_control {
> /* Can pages be swapped as part of reclaim? */
> int may_swap;
>
> - int swappiness;
> -
> int order;
>
> /*
> @@ -1729,6 +1727,13 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
> return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
> }
>
> +static int vmscan_swappiness(struct scan_control *sc)
> +{
> + if (scanning_global_lru(sc))
> + return vm_swappiness;
> + return mem_cgroup_swappiness(sc->mem_cgroup);
> +}
> +
> /*
> * Determine how aggressively the anon and file LRU lists should be
> * scanned. The relative value of each set of LRU lists is determined
> @@ -1789,8 +1794,8 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
> * With swappiness at 100, anonymous and file have the same priority.
> * This scanning priority is essentially the inverse of IO cost.
> */
> - anon_prio = sc->swappiness;
> - file_prio = 200 - sc->swappiness;
> + anon_prio = vmscan_swappiness(sc);
> + file_prio = 200 - vmscan_swappiness(sc);
>
> /*
> * OK, so we have swap space and a fair amount of page cache
> @@ -2179,7 +2184,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
> .nr_to_reclaim = SWAP_CLUSTER_MAX,
> .may_unmap = 1,
> .may_swap = 1,
> - .swappiness = vm_swappiness,
> .order = order,
> .mem_cgroup = NULL,
> .nodemask = nodemask,
> @@ -2203,7 +2207,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
>
> unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
> gfp_t gfp_mask, bool noswap,
> - unsigned int swappiness,
> struct zone *zone,
> unsigned long *nr_scanned)
> {
> @@ -2213,7 +2216,6 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
> .may_writepage = !laptop_mode,
> .may_unmap = 1,
> .may_swap = !noswap,
> - .swappiness = swappiness,
> .order = 0,
> .mem_cgroup = mem,
> };
> @@ -2242,8 +2244,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
>
> unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
> gfp_t gfp_mask,
> - bool noswap,
> - unsigned int swappiness)
> + bool noswap)
> {
> struct zonelist *zonelist;
> unsigned long nr_reclaimed;
> @@ -2253,7 +2254,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
> .may_unmap = 1,
> .may_swap = !noswap,
> .nr_to_reclaim = SWAP_CLUSTER_MAX,
> - .swappiness = swappiness,
> .order = 0,
> .mem_cgroup = mem_cont,
> .nodemask = NULL, /* we don't care the placement */
> @@ -2403,7 +2403,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
> * we want to put equal scanning pressure on each zone.
> */
> .nr_to_reclaim = ULONG_MAX,
> - .swappiness = vm_swappiness,
> .order = order,
> .mem_cgroup = NULL,
> };
> @@ -2862,7 +2861,6 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
> .may_writepage = 1,
> .nr_to_reclaim = nr_to_reclaim,
> .hibernation_mode = 1,
> - .swappiness = vm_swappiness,
> .order = 0,
> };
> struct shrink_control shrink = {
> @@ -3049,7 +3047,6 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
> .nr_to_reclaim = max_t(unsigned long, nr_pages,
> SWAP_CLUSTER_MAX),
> .gfp_mask = gfp_mask,
> - .swappiness = vm_swappiness,
> .order = order,
> };
> struct shrink_control shrink = {
> --
> 1.7.4.1
>
>
>
--
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 internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v5
2011-07-01 7:10 ` KAMEZAWA Hiroyuki
@ 2011-07-06 5:18 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-06 5:18 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora,
Michal Hocko, Ying Han, Shaohua Li, KOSAKI Motohiro
On Fri, 1 Jul 2011 16:10:51 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Sorry, this seems still buggy. I'll send a new one in the next week :(
>
tested with allnoconfig, allyesconfig, CONFIG_SWAP=y/n,
CONFIG_CGROUP_MEM_RES_CTLR=y/n
Patch is onto mmotm-0630.
==
>From 7daf93a277e19026bb6edef3e0ac01bbd31dcb5e Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Date: Fri, 1 Jul 2011 10:35:57 +0900
Subject: [PATCH] export memory cgroup's swappines by mem_cgroup_swappiness()
Each memory cgroup has 'swappiness' value and it can be accessed by
get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
and swappiness is passed by argument. It's propagated by scan_control.
get_swappiness is static function but some planned updates will need to
get swappiness from files other than memcontrol.c
This patch exports get_swappiness() as mem_cgroup_swappiness().
By this, we can remove the argument of swapiness from try_to_free...
and drop swappiness from scan_control. only memcg uses it.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Changelog:
- move definistions out of CONFIG_SWAP.
- fixed/tested allyesconfig/allnoconfig compile failure.
- adjusted signedness to vm_swappiness.
- drop swappiness from scan_control
---
include/linux/swap.h | 13 +++++++++----
mm/memcontrol.c | 15 +++++++--------
mm/vmscan.c | 23 ++++++++++-------------
3 files changed, 26 insertions(+), 25 deletions(-)
Index: mmotm-0701/include/linux/swap.h
===================================================================
--- mmotm-0701.orig/include/linux/swap.h
+++ mmotm-0701/include/linux/swap.h
@@ -254,11 +254,9 @@ static inline void lru_cache_add_file(st
extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
gfp_t gfp_mask, nodemask_t *mask);
extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
- gfp_t gfp_mask, bool noswap,
- unsigned int swappiness);
+ gfp_t gfp_mask, bool noswap);
extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned);
extern int __isolate_lru_page(struct page *page, int mode, int file);
@@ -301,7 +299,14 @@ static inline void scan_unevictable_unre
extern int kswapd_run(int nid);
extern void kswapd_stop(int nid);
-
+#ifdef CONFIG_CGROUP_MEM_RES_CTLR
+extern int mem_cgroup_swappiness(struct mem_cgroup *mem);
+#else
+static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
+{
+ return vm_swappiness;
+}
+#endif
#ifdef CONFIG_SWAP
/* linux/mm/page_io.c */
extern int swap_readpage(struct page *);
Index: mmotm-0701/mm/memcontrol.c
===================================================================
--- mmotm-0701.orig/mm/memcontrol.c
+++ mmotm-0701/mm/memcontrol.c
@@ -248,7 +248,7 @@ struct mem_cgroup {
atomic_t oom_lock;
atomic_t refcnt;
- unsigned int swappiness;
+ int swappiness;
/* OOM-Killer disable */
int oom_kill_disable;
@@ -1328,7 +1328,7 @@ static unsigned long mem_cgroup_margin(s
return margin >> PAGE_SHIFT;
}
-static unsigned int get_swappiness(struct mem_cgroup *memcg)
+int mem_cgroup_swappiness(struct mem_cgroup *memcg)
{
struct cgroup *cgrp = memcg->css.cgroup;
@@ -1775,12 +1775,11 @@ static int mem_cgroup_hierarchical_recla
/* we use swappiness of local cgroup */
if (check_soft) {
ret = mem_cgroup_shrink_node_zone(victim, gfp_mask,
- noswap, get_swappiness(victim), zone,
- &nr_scanned);
+ noswap, zone, &nr_scanned);
*total_scanned += nr_scanned;
} else
ret = try_to_free_mem_cgroup_pages(victim, gfp_mask,
- noswap, get_swappiness(victim));
+ noswap);
css_put(&victim->css);
/*
* At shrinking usage, we can't check we should stop here or
@@ -3776,7 +3775,7 @@ try_to_free:
goto out;
}
progress = try_to_free_mem_cgroup_pages(mem, GFP_KERNEL,
- false, get_swappiness(mem));
+ false);
if (!progress) {
nr_retries--;
/* maybe some writeback is necessary */
@@ -4238,7 +4237,7 @@ static u64 mem_cgroup_swappiness_read(st
{
struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
- return get_swappiness(memcg);
+ return mem_cgroup_swappiness(memcg);
}
static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
@@ -4947,7 +4946,7 @@ mem_cgroup_create(struct cgroup_subsys *
INIT_LIST_HEAD(&mem->oom_notify);
if (parent)
- mem->swappiness = get_swappiness(parent);
+ mem->swappiness = mem_cgroup_swappiness(parent);
atomic_set(&mem->refcnt, 1);
mem->move_charge_at_immigrate = 0;
mutex_init(&mem->thresholds_lock);
Index: mmotm-0701/mm/vmscan.c
===================================================================
--- mmotm-0701.orig/mm/vmscan.c
+++ mmotm-0701/mm/vmscan.c
@@ -95,8 +95,6 @@ struct scan_control {
/* Can pages be swapped as part of reclaim? */
int may_swap;
- int swappiness;
-
int order;
/*
@@ -1729,6 +1727,13 @@ static unsigned long shrink_list(enum lr
return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
}
+static int vmscan_swappiness(struct scan_control *sc)
+{
+ if (scanning_global_lru(sc))
+ return vm_swappiness;
+ return mem_cgroup_swappiness(sc->mem_cgroup);
+}
+
/*
* Determine how aggressively the anon and file LRU lists should be
* scanned. The relative value of each set of LRU lists is determined
@@ -1789,8 +1794,8 @@ static void get_scan_count(struct zone *
* With swappiness at 100, anonymous and file have the same priority.
* This scanning priority is essentially the inverse of IO cost.
*/
- anon_prio = sc->swappiness;
- file_prio = 200 - sc->swappiness;
+ anon_prio = vmscan_swappiness(sc);
+ file_prio = 200 - vmscan_swappiness(sc);
/*
* OK, so we have swap space and a fair amount of page cache
@@ -2179,7 +2184,6 @@ unsigned long try_to_free_pages(struct z
.nr_to_reclaim = SWAP_CLUSTER_MAX,
.may_unmap = 1,
.may_swap = 1,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
.nodemask = nodemask,
@@ -2203,7 +2207,6 @@ unsigned long try_to_free_pages(struct z
unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
gfp_t gfp_mask, bool noswap,
- unsigned int swappiness,
struct zone *zone,
unsigned long *nr_scanned)
{
@@ -2213,7 +2216,6 @@ unsigned long mem_cgroup_shrink_node_zon
.may_writepage = !laptop_mode,
.may_unmap = 1,
.may_swap = !noswap,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem,
};
@@ -2242,8 +2244,7 @@ unsigned long mem_cgroup_shrink_node_zon
unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
gfp_t gfp_mask,
- bool noswap,
- unsigned int swappiness)
+ bool noswap)
{
struct zonelist *zonelist;
unsigned long nr_reclaimed;
@@ -2253,7 +2254,6 @@ unsigned long try_to_free_mem_cgroup_pag
.may_unmap = 1,
.may_swap = !noswap,
.nr_to_reclaim = SWAP_CLUSTER_MAX,
- .swappiness = swappiness,
.order = 0,
.mem_cgroup = mem_cont,
.nodemask = NULL, /* we don't care the placement */
@@ -2403,7 +2403,6 @@ static unsigned long balance_pgdat(pg_da
* we want to put equal scanning pressure on each zone.
*/
.nr_to_reclaim = ULONG_MAX,
- .swappiness = vm_swappiness,
.order = order,
.mem_cgroup = NULL,
};
@@ -2873,7 +2872,6 @@ unsigned long shrink_all_memory(unsigned
.may_writepage = 1,
.nr_to_reclaim = nr_to_reclaim,
.hibernation_mode = 1,
- .swappiness = vm_swappiness,
.order = 0,
};
struct shrink_control shrink = {
@@ -3060,7 +3058,6 @@ static int __zone_reclaim(struct zone *z
.nr_to_reclaim = max_t(unsigned long, nr_pages,
SWAP_CLUSTER_MAX),
.gfp_mask = gfp_mask,
- .swappiness = vm_swappiness,
.order = order,
};
struct shrink_control shrink = {
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v5
@ 2011-07-06 5:18 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-07-06 5:18 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Andrew Morton, linux-mm, linux-kernel, nishimura, bsingharora,
Michal Hocko, Ying Han, Shaohua Li, KOSAKI Motohiro
On Fri, 1 Jul 2011 16:10:51 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Sorry, this seems still buggy. I'll send a new one in the next week :(
>
tested with allnoconfig, allyesconfig, CONFIG_SWAP=y/n,
CONFIG_CGROUP_MEM_RES_CTLR=y/n
Patch is onto mmotm-0630.
==
^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2011-07-06 5:25 UTC | newest]
Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-29 10:03 [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2 KAMEZAWA Hiroyuki
2011-06-29 10:03 ` KAMEZAWA Hiroyuki
2011-06-29 12:20 ` Michal Hocko
2011-06-29 12:20 ` Michal Hocko
2011-06-29 13:00 ` Balbir Singh
2011-06-29 13:00 ` Balbir Singh
2011-06-29 20:00 ` Andrew Morton
2011-06-29 20:00 ` Andrew Morton
2011-06-30 3:32 ` KAMEZAWA Hiroyuki
2011-06-30 3:32 ` KAMEZAWA Hiroyuki
2011-06-30 6:32 ` Michal Hocko
2011-06-30 6:32 ` Michal Hocko
2011-06-30 7:10 ` KAMEZAWA Hiroyuki
2011-06-30 7:10 ` KAMEZAWA Hiroyuki
2011-06-30 7:33 ` Michal Hocko
2011-06-30 7:33 ` Michal Hocko
2011-06-30 20:01 ` Andrew Morton
2011-06-30 20:01 ` Andrew Morton
2011-06-30 23:50 ` KAMEZAWA Hiroyuki
2011-06-30 23:50 ` KAMEZAWA Hiroyuki
2011-07-01 0:20 ` KAMEZAWA Hiroyuki
2011-07-01 0:20 ` KAMEZAWA Hiroyuki
2011-07-01 1:06 ` Andrew Morton
2011-07-01 1:06 ` Andrew Morton
2011-07-01 1:16 ` KAMEZAWA Hiroyuki
2011-07-01 1:16 ` KAMEZAWA Hiroyuki
2011-07-01 1:30 ` KAMEZAWA Hiroyuki
2011-07-01 1:30 ` KAMEZAWA Hiroyuki
2011-07-01 7:10 ` KAMEZAWA Hiroyuki
2011-07-01 7:10 ` KAMEZAWA Hiroyuki
2011-07-06 5:18 ` [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v5 KAMEZAWA Hiroyuki
2011-07-06 5:18 ` KAMEZAWA Hiroyuki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.