Skip to content

Commit

Permalink
memcg: do not check for do_swap_account in mem_cgroup_{read,write,reset}
Browse files Browse the repository at this point in the history
Since commit 2d11085 ("memcg: do not create memsw files if swap
accounting is disabled") memsw files are created only if memcg swap
accounting is enabled so it doesn't make any sense to check for it
explicitly in mem_cgroup_read(), mem_cgroup_write() and
mem_cgroup_reset().

Signed-off-by: Michal Hocko <[email protected]>
Cc: Kamezawa Hiroyuki <[email protected]>
Cc: Tejun Heo <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Michal Hocko authored and torvalds committed Apr 29, 2013
1 parent ee5df05 commit acb6d55
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -5025,9 +5025,6 @@ static ssize_t mem_cgroup_read(struct cgroup *cont, struct cftype *cft,
type = MEMFILE_TYPE(cft->private);
name = MEMFILE_ATTR(cft->private);

if (!do_swap_account && type == _MEMSWAP)
return -EOPNOTSUPP;

switch (type) {
case _MEM:
if (name == RES_USAGE)
Expand Down Expand Up @@ -5162,9 +5159,6 @@ static int mem_cgroup_write(struct cgroup *cont, struct cftype *cft,
type = MEMFILE_TYPE(cft->private);
name = MEMFILE_ATTR(cft->private);

if (!do_swap_account && type == _MEMSWAP)
return -EOPNOTSUPP;

switch (name) {
case RES_LIMIT:
if (mem_cgroup_is_root(memcg)) { /* Can't set limit on root */
Expand Down Expand Up @@ -5241,9 +5235,6 @@ static int mem_cgroup_reset(struct cgroup *cont, unsigned int event)
type = MEMFILE_TYPE(event);
name = MEMFILE_ATTR(event);

if (!do_swap_account && type == _MEMSWAP)
return -EOPNOTSUPP;

switch (name) {
case RES_MAX_USAGE:
if (type == _MEM)
Expand Down

0 comments on commit acb6d55

Please sign in to comment.