Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278746
b: refs/heads/master
c: ffea59e
h: refs/heads/master
v: v3
  • Loading branch information
Glauber Costa authored and David S. Miller committed Dec 13, 2011
1 parent 062430a commit 21e5110
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a6dd343770d2ae2c25f7a4b1998c091e6252f42
refs/heads/master: ffea59e50494198a0db4d6ad8f6721b8fd994f65
31 changes: 31 additions & 0 deletions trunk/net/ipv4/tcp_memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
static u64 tcp_cgroup_read(struct cgroup *cont, struct cftype *cft);
static int tcp_cgroup_write(struct cgroup *cont, struct cftype *cft,
const char *buffer);
static int tcp_cgroup_reset(struct cgroup *cont, unsigned int event);

static struct cftype tcp_files[] = {
{
Expand All @@ -22,6 +23,12 @@ static struct cftype tcp_files[] = {
.read_u64 = tcp_cgroup_read,
.private = RES_USAGE,
},
{
.name = "kmem.tcp.failcnt",
.private = RES_FAILCNT,
.trigger = tcp_cgroup_reset,
.read_u64 = tcp_cgroup_read,
},
};

static inline struct tcp_memcontrol *tcp_from_cgproto(struct cg_proto *cg_proto)
Expand Down Expand Up @@ -197,12 +204,36 @@ static u64 tcp_cgroup_read(struct cgroup *cont, struct cftype *cft)
case RES_USAGE:
val = tcp_read_usage(memcg);
break;
case RES_FAILCNT:
val = tcp_read_stat(memcg, RES_FAILCNT, 0);
break;
default:
BUG();
}
return val;
}

static int tcp_cgroup_reset(struct cgroup *cont, unsigned int event)
{
struct mem_cgroup *memcg;
struct tcp_memcontrol *tcp;
struct cg_proto *cg_proto;

memcg = mem_cgroup_from_cont(cont);
cg_proto = tcp_prot.proto_cgroup(memcg);
if (!cg_proto)
return 0;
tcp = tcp_from_cgproto(cg_proto);

switch (event) {
case RES_FAILCNT:
res_counter_reset_failcnt(&tcp->tcp_memory_allocated);
break;
}

return 0;
}

unsigned long long tcp_max_memory(const struct mem_cgroup *memcg)
{
struct tcp_memcontrol *tcp;
Expand Down

0 comments on commit 21e5110

Please sign in to comment.