aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 20e3619870a..c7b0b1b803a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -388,9 +388,12 @@ enum charge_type {
388}; 388};
389 389
390/* for encoding cft->private value on file */ 390/* for encoding cft->private value on file */
391#define _MEM (0) 391enum res_type {
392#define _MEMSWAP (1) 392 _MEM,
393#define _OOM_TYPE (2) 393 _MEMSWAP,
394 _OOM_TYPE,
395};
396
394#define MEMFILE_PRIVATE(x, val) ((x) << 16 | (val)) 397#define MEMFILE_PRIVATE(x, val) ((x) << 16 | (val))
395#define MEMFILE_TYPE(val) ((val) >> 16 & 0xffff) 398#define MEMFILE_TYPE(val) ((val) >> 16 & 0xffff)
396#define MEMFILE_ATTR(val) ((val) & 0xffff) 399#define MEMFILE_ATTR(val) ((val) & 0xffff)
@@ -3952,7 +3955,8 @@ static ssize_t mem_cgroup_read(struct cgroup *cont, struct cftype *cft,
3952 struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); 3955 struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
3953 char str[64]; 3956 char str[64];
3954 u64 val; 3957 u64 val;
3955 int type, name, len; 3958 int name, len;
3959 enum res_type type;
3956 3960
3957 type = MEMFILE_TYPE(cft->private); 3961 type = MEMFILE_TYPE(cft->private);
3958 name = MEMFILE_ATTR(cft->private); 3962 name = MEMFILE_ATTR(cft->private);
@@ -3988,7 +3992,8 @@ static int mem_cgroup_write(struct cgroup *cont, struct cftype *cft,
3988 const char *buffer) 3992 const char *buffer)
3989{ 3993{
3990 struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); 3994 struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
3991 int type, name; 3995 enum res_type type;
3996 int name;
3992 unsigned long long val; 3997 unsigned long long val;
3993 int ret; 3998 int ret;
3994 3999
@@ -4064,7 +4069,8 @@ out:
4064static int mem_cgroup_reset(struct cgroup *cont, unsigned int event) 4069static int mem_cgroup_reset(struct cgroup *cont, unsigned int event)
4065{ 4070{
4066 struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); 4071 struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
4067 int type, name; 4072 int name;
4073 enum res_type type;
4068 4074
4069 type = MEMFILE_TYPE(event); 4075 type = MEMFILE_TYPE(event);
4070 name = MEMFILE_ATTR(event); 4076 name = MEMFILE_ATTR(event);
@@ -4400,7 +4406,7 @@ static int mem_cgroup_usage_register_event(struct cgroup *cgrp,
4400 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); 4406 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
4401 struct mem_cgroup_thresholds *thresholds; 4407 struct mem_cgroup_thresholds *thresholds;
4402 struct mem_cgroup_threshold_ary *new; 4408 struct mem_cgroup_threshold_ary *new;
4403 int type = MEMFILE_TYPE(cft->private); 4409 enum res_type type = MEMFILE_TYPE(cft->private);
4404 u64 threshold, usage; 4410 u64 threshold, usage;
4405 int i, size, ret; 4411 int i, size, ret;
4406 4412
@@ -4483,7 +4489,7 @@ static void mem_cgroup_usage_unregister_event(struct cgroup *cgrp,
4483 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); 4489 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
4484 struct mem_cgroup_thresholds *thresholds; 4490 struct mem_cgroup_thresholds *thresholds;
4485 struct mem_cgroup_threshold_ary *new; 4491 struct mem_cgroup_threshold_ary *new;
4486 int type = MEMFILE_TYPE(cft->private); 4492 enum res_type type = MEMFILE_TYPE(cft->private);
4487 u64 usage; 4493 u64 usage;
4488 int i, j, size; 4494 int i, j, size;
4489 4495
@@ -4561,7 +4567,7 @@ static int mem_cgroup_oom_register_event(struct cgroup *cgrp,
4561{ 4567{
4562 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); 4568 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
4563 struct mem_cgroup_eventfd_list *event; 4569 struct mem_cgroup_eventfd_list *event;
4564 int type = MEMFILE_TYPE(cft->private); 4570 enum res_type type = MEMFILE_TYPE(cft->private);
4565 4571
4566 BUG_ON(type != _OOM_TYPE); 4572 BUG_ON(type != _OOM_TYPE);
4567 event = kmalloc(sizeof(*event), GFP_KERNEL); 4573 event = kmalloc(sizeof(*event), GFP_KERNEL);
@@ -4586,7 +4592,7 @@ static void mem_cgroup_oom_unregister_event(struct cgroup *cgrp,
4586{ 4592{
4587 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); 4593 struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
4588 struct mem_cgroup_eventfd_list *ev, *tmp; 4594 struct mem_cgroup_eventfd_list *ev, *tmp;
4589 int type = MEMFILE_TYPE(cft->private); 4595 enum res_type type = MEMFILE_TYPE(cft->private);
4590 4596
4591 BUG_ON(type != _OOM_TYPE); 4597 BUG_ON(type != _OOM_TYPE);
4592 4598