Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: fix socket memcg build with !CONFIG_NET

There is still a build bug with the sock memcg code, that triggers
with !CONFIG_NET, that survived my series of randconfig builds.

Signed-off-by: Glauber Costa <glommer@parallels.com>
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Glauber Costa and committed by
David S. Miller
376be5ff 1a3bc369

+3 -3
+1 -1
include/net/sock.h
··· 922 922 #define sk_refcnt_debug_release(sk) do { } while (0) 923 923 #endif /* SOCK_REFCNT_DEBUG */ 924 924 925 - #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM 925 + #if defined(CONFIG_CGROUP_MEM_RES_CTLR_KMEM) && defined(CONFIG_NET) 926 926 extern struct jump_label_key memcg_socket_limit_enabled; 927 927 static inline struct cg_proto *parent_cg_proto(struct proto *proto, 928 928 struct cg_proto *cg_proto)
+2 -2
mm/memcontrol.c
··· 379 379 static bool mem_cgroup_is_root(struct mem_cgroup *memcg); 380 380 void sock_update_memcg(struct sock *sk) 381 381 { 382 - if (static_branch(&memcg_socket_limit_enabled)) { 382 + if (mem_cgroup_sockets_enabled) { 383 383 struct mem_cgroup *memcg; 384 384 385 385 BUG_ON(!sk->sk_prot->proto_cgroup); ··· 411 411 412 412 void sock_release_memcg(struct sock *sk) 413 413 { 414 - if (static_branch(&memcg_socket_limit_enabled) && sk->sk_cgrp) { 414 + if (mem_cgroup_sockets_enabled && sk->sk_cgrp) { 415 415 struct mem_cgroup *memcg; 416 416 WARN_ON(!sk->sk_cgrp->memcg); 417 417 memcg = sk->sk_cgrp->memcg;