linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Roman Gushchin <roman.gushchin@linux.dev>
Cc: bpf <bpf@vger.kernel.org>, linux-mm <linux-mm@kvack.org>,
	 LKML <linux-kernel@vger.kernel.org>,
	JP Kobryn <inwardvessel@gmail.com>,
	 Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	 Shakeel Butt <shakeel.butt@linux.dev>,
	Michal Hocko <mhocko@kernel.org>,
	 Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH bpf-next v2 5/7] mm: introduce BPF kfunc to access memory events
Date: Sun, 21 Dec 2025 16:49:46 -0800	[thread overview]
Message-ID: <CAADnVQJo3HspB9-_R5yWKWLdExDmFayDpNZ4JnoBpCw6aRNTrA@mail.gmail.com> (raw)
In-Reply-To: <20251220041250.372179-6-roman.gushchin@linux.dev>

On Fri, Dec 19, 2025 at 6:13 PM Roman Gushchin <roman.gushchin@linux.dev> wrote:
>
> From: JP Kobryn <inwardvessel@gmail.com>
>
> Introduce BPF kfunc to access memory events, e.g.:
> MEMCG_LOW, MEMCG_MAX, MEMCG_OOM, MEMCG_OOM_KILL etc.
>
> Signed-off-by: JP Kobryn <inwardvessel@gmail.com>
> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
> ---
>  mm/bpf_memcontrol.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/mm/bpf_memcontrol.c b/mm/bpf_memcontrol.c
> index d84fe6f3ed43..858eb43766ce 100644
> --- a/mm/bpf_memcontrol.c
> +++ b/mm/bpf_memcontrol.c
> @@ -103,6 +103,22 @@ __bpf_kfunc unsigned long bpf_mem_cgroup_usage(struct mem_cgroup *memcg)
>         return mem_cgroup_usage(memcg, false) * PAGE_SIZE;
>  }
>
> +/**
> + * bpf_mem_cgroup_memory_events - Read memory cgroup's memory event value
> + * @memcg: memory cgroup
> + * @event: memory event id
> + *
> + * Returns current memory event count.
> + */
> +__bpf_kfunc unsigned long bpf_mem_cgroup_memory_events(struct mem_cgroup *memcg,
> +                                               enum memcg_memory_event event)
> +{
> +       if (event >= MEMCG_NR_MEMORY_EVENTS)
> +               return (unsigned long)-1;
> +
> +       return atomic_long_read(&memcg->memory_events[event]);
> +}

Why is patch 5 not squashed with patch 4?
I'd think placing bpf_mem_cgroup_memory_events()
right next to bpf_mem_cgroup_vm_events() in the same patch
will make the difference more clear.
For non-mm people the names are very close and on the first glance
it looks like a duplicate.


  parent reply	other threads:[~2025-12-22  0:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-20  4:12 [PATCH bpf-next v2 0/7] mm: bpf kfuncs to access memcg data Roman Gushchin
2025-12-20  4:12 ` [PATCH bpf-next v2 1/7] mm: declare memcg_page_state_output() in memcontrol.h Roman Gushchin
2025-12-20  4:12 ` [PATCH bpf-next v2 2/7] mm: introduce BPF kfuncs to deal with memcg pointers Roman Gushchin
2025-12-20  5:20   ` Shakeel Butt
2025-12-22  0:39   ` Alexei Starovoitov
2025-12-20  4:12 ` [PATCH bpf-next v2 3/7] mm: introduce bpf_get_root_mem_cgroup() BPF kfunc Roman Gushchin
2025-12-20  5:21   ` Shakeel Butt
2025-12-20  4:12 ` [PATCH bpf-next v2 4/7] mm: introduce BPF kfuncs to access memcg statistics and events Roman Gushchin
2025-12-20  4:29   ` bot+bpf-ci
2025-12-20  4:39     ` Roman Gushchin
2025-12-20  5:22   ` Shakeel Butt
2025-12-20  4:12 ` [PATCH bpf-next v2 5/7] mm: introduce BPF kfunc to access memory events Roman Gushchin
2025-12-20  4:29   ` bot+bpf-ci
2025-12-20  4:41     ` Roman Gushchin
2025-12-20 13:19       ` Chris Mason
2025-12-20 18:43         ` Roman Gushchin
2025-12-20 19:59           ` Chris Mason
2025-12-22 22:23             ` Roman Gushchin
2025-12-23 14:09               ` Chris Mason
2025-12-22  0:49   ` Alexei Starovoitov [this message]
2025-12-22  0:51     ` Alexei Starovoitov
2025-12-20  4:12 ` [PATCH bpf-next v2 6/7] bpf: selftests: selftests for memcg stat kfuncs Roman Gushchin
2025-12-20  5:23   ` Shakeel Butt
2025-12-20  4:12 ` [PATCH bpf-next v2 7/7] MAINTAINERS: add an entry for MM BPF extensions Roman Gushchin
2025-12-20  5:26   ` 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=CAADnVQJo3HspB9-_R5yWKWLdExDmFayDpNZ4JnoBpCw6aRNTrA@mail.gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hannes@cmpxchg.org \
    --cc=inwardvessel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    /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