diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 21:34:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 21:34:42 -0500 |
commit | b6da0076bab5a12afb19312ffee41c95490af2a0 (patch) | |
tree | 52a5675b9c2ff95d88b981d5b9a3822f6073c112 /include/net | |
parent | cbfe0de303a55ed96d8831c2d5f56f8131cd6612 (diff) | |
parent | a53b831549141aa060a8b54b76e3a42870d74cc0 (diff) |
Merge branch 'akpm' (patchbomb from Andrew)
Merge first patchbomb from Andrew Morton:
- a few minor cifs fixes
- dma-debug upadtes
- ocfs2
- slab
- about half of MM
- procfs
- kernel/exit.c
- panic.c tweaks
- printk upates
- lib/ updates
- checkpatch updates
- fs/binfmt updates
- the drivers/rtc tree
- nilfs
- kmod fixes
- more kernel/exit.c
- various other misc tweaks and fixes
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (190 commits)
exit: pidns: fix/update the comments in zap_pid_ns_processes()
exit: pidns: alloc_pid() leaks pid_namespace if child_reaper is exiting
exit: exit_notify: re-use "dead" list to autoreap current
exit: reparent: call forget_original_parent() under tasklist_lock
exit: reparent: avoid find_new_reaper() if no children
exit: reparent: introduce find_alive_thread()
exit: reparent: introduce find_child_reaper()
exit: reparent: document the ->has_child_subreaper checks
exit: reparent: s/while_each_thread/for_each_thread/ in find_new_reaper()
exit: reparent: fix the cross-namespace PR_SET_CHILD_SUBREAPER reparenting
exit: reparent: fix the dead-parent PR_SET_CHILD_SUBREAPER reparenting
exit: proc: don't try to flush /proc/tgid/task/tgid
exit: release_task: fix the comment about group leader accounting
exit: wait: drop tasklist_lock before psig->c* accounting
exit: wait: don't use zombie->real_parent
exit: wait: cleanup the ptrace_reparented() checks
usermodehelper: kill the kmod_thread_locker logic
usermodehelper: don't use CLONE_VFORK for ____call_usermodehelper()
fs/hfs/catalog.c: fix comparison bug in hfs_cat_keycmp
nilfs2: fix the nilfs_iget() vs. nilfs_new_inode() races
...
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/sock.h | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index e6f235ebf6c9..7ff44e062a38 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -54,8 +54,8 @@ | |||
54 | #include <linux/security.h> | 54 | #include <linux/security.h> |
55 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
56 | #include <linux/uaccess.h> | 56 | #include <linux/uaccess.h> |
57 | #include <linux/page_counter.h> | ||
57 | #include <linux/memcontrol.h> | 58 | #include <linux/memcontrol.h> |
58 | #include <linux/res_counter.h> | ||
59 | #include <linux/static_key.h> | 59 | #include <linux/static_key.h> |
60 | #include <linux/aio.h> | 60 | #include <linux/aio.h> |
61 | #include <linux/sched.h> | 61 | #include <linux/sched.h> |
@@ -1062,7 +1062,7 @@ enum cg_proto_flags { | |||
1062 | }; | 1062 | }; |
1063 | 1063 | ||
1064 | struct cg_proto { | 1064 | struct cg_proto { |
1065 | struct res_counter memory_allocated; /* Current allocated memory. */ | 1065 | struct page_counter memory_allocated; /* Current allocated memory. */ |
1066 | struct percpu_counter sockets_allocated; /* Current number of sockets. */ | 1066 | struct percpu_counter sockets_allocated; /* Current number of sockets. */ |
1067 | int memory_pressure; | 1067 | int memory_pressure; |
1068 | long sysctl_mem[3]; | 1068 | long sysctl_mem[3]; |
@@ -1214,34 +1214,26 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot, | |||
1214 | unsigned long amt, | 1214 | unsigned long amt, |
1215 | int *parent_status) | 1215 | int *parent_status) |
1216 | { | 1216 | { |
1217 | struct res_counter *fail; | 1217 | page_counter_charge(&prot->memory_allocated, amt); |
1218 | int ret; | ||
1219 | 1218 | ||
1220 | ret = res_counter_charge_nofail(&prot->memory_allocated, | 1219 | if (page_counter_read(&prot->memory_allocated) > |
1221 | amt << PAGE_SHIFT, &fail); | 1220 | prot->memory_allocated.limit) |
1222 | if (ret < 0) | ||
1223 | *parent_status = OVER_LIMIT; | 1221 | *parent_status = OVER_LIMIT; |
1224 | } | 1222 | } |
1225 | 1223 | ||
1226 | static inline void memcg_memory_allocated_sub(struct cg_proto *prot, | 1224 | static inline void memcg_memory_allocated_sub(struct cg_proto *prot, |
1227 | unsigned long amt) | 1225 | unsigned long amt) |
1228 | { | 1226 | { |
1229 | res_counter_uncharge(&prot->memory_allocated, amt << PAGE_SHIFT); | 1227 | page_counter_uncharge(&prot->memory_allocated, amt); |
1230 | } | ||
1231 | |||
1232 | static inline u64 memcg_memory_allocated_read(struct cg_proto *prot) | ||
1233 | { | ||
1234 | u64 ret; | ||
1235 | ret = res_counter_read_u64(&prot->memory_allocated, RES_USAGE); | ||
1236 | return ret >> PAGE_SHIFT; | ||
1237 | } | 1228 | } |
1238 | 1229 | ||
1239 | static inline long | 1230 | static inline long |
1240 | sk_memory_allocated(const struct sock *sk) | 1231 | sk_memory_allocated(const struct sock *sk) |
1241 | { | 1232 | { |
1242 | struct proto *prot = sk->sk_prot; | 1233 | struct proto *prot = sk->sk_prot; |
1234 | |||
1243 | if (mem_cgroup_sockets_enabled && sk->sk_cgrp) | 1235 | if (mem_cgroup_sockets_enabled && sk->sk_cgrp) |
1244 | return memcg_memory_allocated_read(sk->sk_cgrp); | 1236 | return page_counter_read(&sk->sk_cgrp->memory_allocated); |
1245 | 1237 | ||
1246 | return atomic_long_read(prot->memory_allocated); | 1238 | return atomic_long_read(prot->memory_allocated); |
1247 | } | 1239 | } |
@@ -1255,7 +1247,7 @@ sk_memory_allocated_add(struct sock *sk, int amt, int *parent_status) | |||
1255 | memcg_memory_allocated_add(sk->sk_cgrp, amt, parent_status); | 1247 | memcg_memory_allocated_add(sk->sk_cgrp, amt, parent_status); |
1256 | /* update the root cgroup regardless */ | 1248 | /* update the root cgroup regardless */ |
1257 | atomic_long_add_return(amt, prot->memory_allocated); | 1249 | atomic_long_add_return(amt, prot->memory_allocated); |
1258 | return memcg_memory_allocated_read(sk->sk_cgrp); | 1250 | return page_counter_read(&sk->sk_cgrp->memory_allocated); |
1259 | } | 1251 | } |
1260 | 1252 | ||
1261 | return atomic_long_add_return(amt, prot->memory_allocated); | 1253 | return atomic_long_add_return(amt, prot->memory_allocated); |