提交 6de5a8bf 编写于 作者: S Sha Zhengju 提交者: Linus Torvalds

memcg: rename RESOURCE_MAX to RES_COUNTER_MAX

RESOURCE_MAX is far too general name, change it to RES_COUNTER_MAX.
Signed-off-by: NSha Zhengju <handai.szj@taobao.com>
Signed-off-by: NQiang Huang <h.huangqiang@huawei.com>
Acked-by: NMichal Hocko <mhocko@suse.cz>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Jeff Liu <jeff.liu@oracle.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 34ff8dc0
...@@ -54,7 +54,7 @@ struct res_counter { ...@@ -54,7 +54,7 @@ struct res_counter {
struct res_counter *parent; struct res_counter *parent;
}; };
#define RESOURCE_MAX ULLONG_MAX #define RES_COUNTER_MAX ULLONG_MAX
/** /**
* Helpers to interact with userspace * Helpers to interact with userspace
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
void res_counter_init(struct res_counter *counter, struct res_counter *parent) void res_counter_init(struct res_counter *counter, struct res_counter *parent)
{ {
spin_lock_init(&counter->lock); spin_lock_init(&counter->lock);
counter->limit = RESOURCE_MAX; counter->limit = RES_COUNTER_MAX;
counter->soft_limit = RESOURCE_MAX; counter->soft_limit = RES_COUNTER_MAX;
counter->parent = parent; counter->parent = parent;
} }
...@@ -182,12 +182,12 @@ int res_counter_memparse_write_strategy(const char *buf, ...@@ -182,12 +182,12 @@ int res_counter_memparse_write_strategy(const char *buf,
{ {
char *end; char *end;
/* return RESOURCE_MAX(unlimited) if "-1" is specified */ /* return RES_COUNTER_MAX(unlimited) if "-1" is specified */
if (*buf == '-') { if (*buf == '-') {
*res = simple_strtoull(buf + 1, &end, 10); *res = simple_strtoull(buf + 1, &end, 10);
if (*res != 1 || *end != '\0') if (*res != 1 || *end != '\0')
return -EINVAL; return -EINVAL;
*res = RESOURCE_MAX; *res = RES_COUNTER_MAX;
return 0; return 0;
} }
......
...@@ -4967,7 +4967,7 @@ static int memcg_update_kmem_limit(struct cgroup_subsys_state *css, u64 val) ...@@ -4967,7 +4967,7 @@ static int memcg_update_kmem_limit(struct cgroup_subsys_state *css, u64 val)
*/ */
mutex_lock(&memcg_create_mutex); mutex_lock(&memcg_create_mutex);
mutex_lock(&set_limit_mutex); mutex_lock(&set_limit_mutex);
if (!memcg->kmem_account_flags && val != RESOURCE_MAX) { if (!memcg->kmem_account_flags && val != RES_COUNTER_MAX) {
if (cgroup_task_count(css->cgroup) || memcg_has_children(memcg)) { if (cgroup_task_count(css->cgroup) || memcg_has_children(memcg)) {
ret = -EBUSY; ret = -EBUSY;
goto out; goto out;
...@@ -4977,7 +4977,7 @@ static int memcg_update_kmem_limit(struct cgroup_subsys_state *css, u64 val) ...@@ -4977,7 +4977,7 @@ static int memcg_update_kmem_limit(struct cgroup_subsys_state *css, u64 val)
ret = memcg_update_cache_sizes(memcg); ret = memcg_update_cache_sizes(memcg);
if (ret) { if (ret) {
res_counter_set_limit(&memcg->kmem, RESOURCE_MAX); res_counter_set_limit(&memcg->kmem, RES_COUNTER_MAX);
goto out; goto out;
} }
static_key_slow_inc(&memcg_kmem_enabled_key); static_key_slow_inc(&memcg_kmem_enabled_key);
......
...@@ -87,8 +87,8 @@ static int tcp_update_limit(struct mem_cgroup *memcg, u64 val) ...@@ -87,8 +87,8 @@ static int tcp_update_limit(struct mem_cgroup *memcg, u64 val)
if (!cg_proto) if (!cg_proto)
return -EINVAL; return -EINVAL;
if (val > RESOURCE_MAX) if (val > RES_COUNTER_MAX)
val = RESOURCE_MAX; val = RES_COUNTER_MAX;
tcp = tcp_from_cgproto(cg_proto); tcp = tcp_from_cgproto(cg_proto);
...@@ -101,9 +101,9 @@ static int tcp_update_limit(struct mem_cgroup *memcg, u64 val) ...@@ -101,9 +101,9 @@ static int tcp_update_limit(struct mem_cgroup *memcg, u64 val)
tcp->tcp_prot_mem[i] = min_t(long, val >> PAGE_SHIFT, tcp->tcp_prot_mem[i] = min_t(long, val >> PAGE_SHIFT,
net->ipv4.sysctl_tcp_mem[i]); net->ipv4.sysctl_tcp_mem[i]);
if (val == RESOURCE_MAX) if (val == RES_COUNTER_MAX)
clear_bit(MEMCG_SOCK_ACTIVE, &cg_proto->flags); clear_bit(MEMCG_SOCK_ACTIVE, &cg_proto->flags);
else if (val != RESOURCE_MAX) { else if (val != RES_COUNTER_MAX) {
/* /*
* The active bit needs to be written after the static_key * The active bit needs to be written after the static_key
* update. This is what guarantees that the socket activation * update. This is what guarantees that the socket activation
...@@ -187,7 +187,7 @@ static u64 tcp_cgroup_read(struct cgroup_subsys_state *css, struct cftype *cft) ...@@ -187,7 +187,7 @@ static u64 tcp_cgroup_read(struct cgroup_subsys_state *css, struct cftype *cft)
switch (cft->private) { switch (cft->private) {
case RES_LIMIT: case RES_LIMIT:
val = tcp_read_stat(memcg, RES_LIMIT, RESOURCE_MAX); val = tcp_read_stat(memcg, RES_LIMIT, RES_COUNTER_MAX);
break; break;
case RES_USAGE: case RES_USAGE:
val = tcp_read_usage(memcg); val = tcp_read_usage(memcg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册