Skip to content

Use mem_cgroup_from_sk in homa_rpc_alloc_server - #146

Open
randomizedcoder wants to merge 1 commit into
PlatformLab:mainfrom
randomizedcoder:fix/rpc-memcg-without-config-memcg
Open

randomizedcoder wants to merge 1 commit into
PlatformLab:mainfrom
randomizedcoder:fix/rpc-memcg-without-config-memcg

Conversation

@randomizedcoder

Copy link
Copy Markdown
Contributor

struct sock has sk_memcg only when CONFIG_MEMCG is set. In a kernel without memory cgroups (x86_64 and i386 defconfig, for example), homa_rpc_alloc_server doesn't compile:

net/homa/homa_rpc.c:134:22: error: 'struct sock' has no member named 'sk_memcg'

The out-of-tree build only passes because distro kernels enable memcg.

Fix: read it with mem_cgroup_from_sk(). Under CONFIG_MEMCG that returns sk->sk_memcg; without it, it returns NULL, so the allocation takes the existing non-accounted path. Behaviour is unchanged when memcg is on.

Checked:

No test, since it's a build fix.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant