From: Martin KaFai Lau <martin.lau@linux.dev>
To: Shakeel Butt <shakeel.butt@linux.dev>,
Kuniyuki Iwashima <kuniyu@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Neal Cardwell" <ncardwell@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Willem de Bruijn" <willemb@google.com>,
"Matthieu Baerts" <matttbe@kernel.org>,
"Mat Martineau" <martineau@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Hocko" <mhocko@kernel.org>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Michal Koutný" <mkoutny@suse.com>, "Tejun Heo" <tj@kernel.org>,
"Simon Horman" <horms@kernel.org>,
"Geliang Tang" <geliang@kernel.org>,
"Muchun Song" <muchun.song@linux.dev>,
"Mina Almasry" <almasrymina@google.com>,
"Kuniyuki Iwashima" <kuni1840@gmail.com>,
netdev@vger.kernel.org, mptcp@lists.linux.dev,
cgroups@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org
Subject: Re: [PATCH v3 net-next 12/12] net-memcg: Decouple controlled memcg from global protocol memory accounting.
Date: Wed, 13 Aug 2025 17:54:43 -0700 [thread overview]
Message-ID: <e6c8fa06-c76c-49e7-a027-0a7b610f1e9c@linux.dev> (raw)
In-Reply-To: <oafk5om7v5vtxjmo5rtwy6ullprfaf6mk2lh4km7alj3dtainn@jql2rih5es4n>
On 8/13/25 1:53 PM, Shakeel Butt wrote:
> What I think is the right approach is to have BPF struct ops based
> approach with possible callback 'is this socket under pressure' or maybe
> 'is this socket isolated' and then you can do whatever you want in those
> callbacks. In this way your can follow the same approach of caching the
> result in kernel (lower bits of sk->sk_memcg).
>
> I am CCing bpf list to get some suggestions or concerns on this
> approach.
I have quickly looked at the set. In patch 11, it sets a bit in sk->sk_memcg.
On the bpf side, there are already cgroup bpf progs that can do bpf_setsockopt
on a sk, so the same can be done here. The bpf_setsockopt does not have to set
option/knob that is only available in the uapi in case we don't want to expose
this to the user space.
The cgroup bpf prog (BPF_CGROUP_INET_SOCK_CREATE) can already be run when a
"inet" sock is created. This hook (i.e. attach_type) does not have access to
bpf_setsockopt but should be easy to add.
For more comprehensive mem charge policy that needs new bpf hook, that probably
will need struct_ops instead of another cgroup attach_type but that will be
implementation details.
next prev parent reply other threads:[~2025-08-14 0:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250812175848.512446-1-kuniyu@google.com>
[not found] ` <20250812175848.512446-13-kuniyu@google.com>
[not found] ` <w6klr435a4rygmnifuujg6x4k77ch7cwoq6dspmyknqt24cpjz@bbz4wzmxjsfk>
[not found] ` <CAAVpQUCU=VJxA6NKx+O1_zwzzZOxUEsG9mY+SNK+bzb=dj9s5w@mail.gmail.com>
2025-08-13 20:53 ` [PATCH v3 net-next 12/12] net-memcg: Decouple controlled memcg from global protocol memory accounting Shakeel Butt
2025-08-14 0:54 ` Martin KaFai Lau [this message]
2025-08-14 4:34 ` Kuniyuki Iwashima
2025-08-14 17:10 ` Shakeel Butt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e6c8fa06-c76c-49e7-a027-0a7b610f1e9c@linux.dev \
--to=martin.lau@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=kuniyu@google.com \
--cc=linux-mm@kvack.org \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=mhocko@kernel.org \
--cc=mkoutny@suse.com \
--cc=mptcp@lists.linux.dev \
--cc=muchun.song@linux.dev \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=tj@kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).