|
@@ -1104,15 +1104,19 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int calc_inactive_ratio(struct mem_cgroup *memcg, unsigned long *present_pages)
|
|
|
|
|
|
+int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *zone)
|
|
{
|
|
{
|
|
- unsigned long active;
|
|
|
|
|
|
+ unsigned long inactive_ratio;
|
|
|
|
+ int nid = zone_to_nid(zone);
|
|
|
|
+ int zid = zone_idx(zone);
|
|
unsigned long inactive;
|
|
unsigned long inactive;
|
|
|
|
+ unsigned long active;
|
|
unsigned long gb;
|
|
unsigned long gb;
|
|
- unsigned long inactive_ratio;
|
|
|
|
|
|
|
|
- inactive = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_INACTIVE_ANON));
|
|
|
|
- active = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_ACTIVE_ANON));
|
|
|
|
|
|
+ inactive = mem_cgroup_zone_nr_lru_pages(memcg, nid, zid,
|
|
|
|
+ BIT(LRU_INACTIVE_ANON));
|
|
|
|
+ active = mem_cgroup_zone_nr_lru_pages(memcg, nid, zid,
|
|
|
|
+ BIT(LRU_ACTIVE_ANON));
|
|
|
|
|
|
gb = (inactive + active) >> (30 - PAGE_SHIFT);
|
|
gb = (inactive + active) >> (30 - PAGE_SHIFT);
|
|
if (gb)
|
|
if (gb)
|
|
@@ -1120,39 +1124,20 @@ static int calc_inactive_ratio(struct mem_cgroup *memcg, unsigned long *present_
|
|
else
|
|
else
|
|
inactive_ratio = 1;
|
|
inactive_ratio = 1;
|
|
|
|
|
|
- if (present_pages) {
|
|
|
|
- present_pages[0] = inactive;
|
|
|
|
- present_pages[1] = active;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return inactive_ratio;
|
|
|
|
|
|
+ return inactive * inactive_ratio < active;
|
|
}
|
|
}
|
|
|
|
|
|
-int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
|
|
|
|
-{
|
|
|
|
- unsigned long active;
|
|
|
|
- unsigned long inactive;
|
|
|
|
- unsigned long present_pages[2];
|
|
|
|
- unsigned long inactive_ratio;
|
|
|
|
-
|
|
|
|
- inactive_ratio = calc_inactive_ratio(memcg, present_pages);
|
|
|
|
-
|
|
|
|
- inactive = present_pages[0];
|
|
|
|
- active = present_pages[1];
|
|
|
|
-
|
|
|
|
- if (inactive * inactive_ratio < active)
|
|
|
|
- return 1;
|
|
|
|
-
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
|
|
|
|
|
|
+int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg, struct zone *zone)
|
|
{
|
|
{
|
|
unsigned long active;
|
|
unsigned long active;
|
|
unsigned long inactive;
|
|
unsigned long inactive;
|
|
|
|
+ int zid = zone_idx(zone);
|
|
|
|
+ int nid = zone_to_nid(zone);
|
|
|
|
|
|
- inactive = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_INACTIVE_FILE));
|
|
|
|
- active = mem_cgroup_nr_lru_pages(memcg, BIT(LRU_ACTIVE_FILE));
|
|
|
|
|
|
+ inactive = mem_cgroup_zone_nr_lru_pages(memcg, nid, zid,
|
|
|
|
+ BIT(LRU_INACTIVE_FILE));
|
|
|
|
+ active = mem_cgroup_zone_nr_lru_pages(memcg, nid, zid,
|
|
|
|
+ BIT(LRU_ACTIVE_FILE));
|
|
|
|
|
|
return (active > inactive);
|
|
return (active > inactive);
|
|
}
|
|
}
|
|
@@ -4192,8 +4177,6 @@ static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft,
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_VM
|
|
#ifdef CONFIG_DEBUG_VM
|
|
- cb->fill(cb, "inactive_ratio", calc_inactive_ratio(mem_cont, NULL));
|
|
|
|
-
|
|
|
|
{
|
|
{
|
|
int nid, zid;
|
|
int nid, zid;
|
|
struct mem_cgroup_per_zone *mz;
|
|
struct mem_cgroup_per_zone *mz;
|