aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index bb972d254dff..91c1c8baf020 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -55,6 +55,7 @@
55#include <linux/uaccess.h> 55#include <linux/uaccess.h>
56#include <linux/memcontrol.h> 56#include <linux/memcontrol.h>
57#include <linux/res_counter.h> 57#include <linux/res_counter.h>
58#include <linux/jump_label.h>
58 59
59#include <linux/filter.h> 60#include <linux/filter.h>
60#include <linux/rculist_nulls.h> 61#include <linux/rculist_nulls.h>
@@ -226,6 +227,7 @@ struct cg_proto;
226 * @sk_ack_backlog: current listen backlog 227 * @sk_ack_backlog: current listen backlog
227 * @sk_max_ack_backlog: listen backlog set in listen() 228 * @sk_max_ack_backlog: listen backlog set in listen()
228 * @sk_priority: %SO_PRIORITY setting 229 * @sk_priority: %SO_PRIORITY setting
230 * @sk_cgrp_prioidx: socket group's priority map index
229 * @sk_type: socket type (%SOCK_STREAM, etc) 231 * @sk_type: socket type (%SOCK_STREAM, etc)
230 * @sk_protocol: which protocol this socket belongs in this network family 232 * @sk_protocol: which protocol this socket belongs in this network family
231 * @sk_peer_pid: &struct pid for this socket's peer 233 * @sk_peer_pid: &struct pid for this socket's peer
@@ -921,7 +923,7 @@ inline void sk_refcnt_debug_release(const struct sock *sk)
921#define sk_refcnt_debug_release(sk) do { } while (0) 923#define sk_refcnt_debug_release(sk) do { } while (0)
922#endif /* SOCK_REFCNT_DEBUG */ 924#endif /* SOCK_REFCNT_DEBUG */
923 925
924#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM 926#if defined(CONFIG_CGROUP_MEM_RES_CTLR_KMEM) && defined(CONFIG_NET)
925extern struct jump_label_key memcg_socket_limit_enabled; 927extern struct jump_label_key memcg_socket_limit_enabled;
926static inline struct cg_proto *parent_cg_proto(struct proto *proto, 928static inline struct cg_proto *parent_cg_proto(struct proto *proto,
927 struct cg_proto *cg_proto) 929 struct cg_proto *cg_proto)
@@ -1007,9 +1009,8 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1007 struct res_counter *fail; 1009 struct res_counter *fail;
1008 int ret; 1010 int ret;
1009 1011
1010 ret = res_counter_charge(prot->memory_allocated, 1012 ret = res_counter_charge_nofail(prot->memory_allocated,
1011 amt << PAGE_SHIFT, &fail); 1013 amt << PAGE_SHIFT, &fail);
1012
1013 if (ret < 0) 1014 if (ret < 0)
1014 *parent_status = OVER_LIMIT; 1015 *parent_status = OVER_LIMIT;
1015} 1016}
@@ -1053,12 +1054,11 @@ sk_memory_allocated_add(struct sock *sk, int amt, int *parent_status)
1053} 1054}
1054 1055
1055static inline void 1056static inline void
1056sk_memory_allocated_sub(struct sock *sk, int amt, int parent_status) 1057sk_memory_allocated_sub(struct sock *sk, int amt)
1057{ 1058{
1058 struct proto *prot = sk->sk_prot; 1059 struct proto *prot = sk->sk_prot;
1059 1060
1060 if (mem_cgroup_sockets_enabled && sk->sk_cgrp && 1061 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1061 parent_status != OVER_LIMIT) /* Otherwise was uncharged already */
1062 memcg_memory_allocated_sub(sk->sk_cgrp, amt); 1062 memcg_memory_allocated_sub(sk->sk_cgrp, amt);
1063 1063
1064 atomic_long_sub(amt, prot->memory_allocated); 1064 atomic_long_sub(amt, prot->memory_allocated);