From e5500565b69f21482b28ae25a9597cb89a7d338d Mon Sep 17 00:00:00 2001 From: "randomizedcoder dave.seddon.ca@gmail.com" Date: Sat, 31 Oct 2026 09:15:18 -0700 Subject: [PATCH] Use mem_cgroup_from_sk in homa_rpc_alloc_server struct sock has an sk_memcg field only when CONFIG_MEMCG is set, so homa_rpc_alloc_server failed to compile in kernels without memory cgroups (such as x86_64 and i386 defconfig). mem_cgroup_from_sk returns NULL in that case. Co-Authored-By: Claude Opus 5.5 --- homa_rpc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homa_rpc.c b/homa_rpc.c index 7804577e..100e5fa0 100644 --- a/homa_rpc.c +++ b/homa_rpc.c @@ -117,6 +117,7 @@ struct homa_rpc *homa_rpc_alloc_server(struct homa_sock *hsk, u64 id = homa_local_id(h->sender_id); struct homa_rpc_bucket *bucket; struct homa_rpc *srpc = NULL; + struct mem_cgroup *memcg; int msg_length; int err; @@ -140,8 +141,9 @@ struct homa_rpc *homa_rpc_alloc_server(struct homa_sock *hsk, } /* Initialize fields that don't require the socket lock. */ - if (hsk->sock.sk_memcg) { - struct mem_cgroup *old = set_active_memcg(hsk->sock.sk_memcg); + memcg = mem_cgroup_from_sk(&hsk->sock); + if (memcg) { + struct mem_cgroup *old = set_active_memcg(memcg); srpc = kzalloc(sizeof(*srpc), GFP_ATOMIC | __GFP_ACCOUNT); set_active_memcg(old);