public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Puranjay Mohan <puranjay@kernel.org>
To: bpf@vger.kernel.org
Cc: Puranjay Mohan <puranjay@kernel.org>,
	Puranjay Mohan <puranjay12@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>,
	kernel-team@meta.com
Subject: [PATCH bpf v2 1/4] bpf: rename mmap_unlock_irq_work to bpf_iter_mm_irq_work
Date: Mon,  9 Mar 2026 08:54:55 -0700	[thread overview]
Message-ID: <20260309155506.23490-2-puranjay@kernel.org> (raw)
In-Reply-To: <20260309155506.23490-1-puranjay@kernel.org>

The next commit will be reusing mmap_unlock_irq_work to do mmput_async()
in irq_work. Rather than creating a new structure, rename
mmap_unlock_irq_work to bpf_iter_mm_irq_work and reuse it.

This is only a rename with no functional changes.

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
---
 kernel/bpf/mmap_unlock_work.h | 12 ++++++------
 kernel/bpf/stackmap.c         |  2 +-
 kernel/bpf/task_iter.c        | 12 ++++++------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/kernel/bpf/mmap_unlock_work.h b/kernel/bpf/mmap_unlock_work.h
index 5d18d7d85bef..ba8e860f1180 100644
--- a/kernel/bpf/mmap_unlock_work.h
+++ b/kernel/bpf/mmap_unlock_work.h
@@ -6,13 +6,13 @@
 #define __MMAP_UNLOCK_WORK_H__
 #include <linux/irq_work.h>
 
-/* irq_work to run mmap_read_unlock() in irq_work */
-struct mmap_unlock_irq_work {
+/* irq_work to run mmap_read_unlock() or mmput_async() in irq_work */
+struct bpf_iter_mm_irq_work {
 	struct irq_work irq_work;
 	struct mm_struct *mm;
 };
 
-DECLARE_PER_CPU(struct mmap_unlock_irq_work, mmap_unlock_work);
+DECLARE_PER_CPU(struct bpf_iter_mm_irq_work, mmap_unlock_work);
 
 /*
  * We cannot do mmap_read_unlock() when the irq is disabled, because of
@@ -21,9 +21,9 @@ DECLARE_PER_CPU(struct mmap_unlock_irq_work, mmap_unlock_work);
  * percpu variable to do the irq_work. If the irq_work is already used
  * by another lookup, we fall over.
  */
-static inline bool bpf_mmap_unlock_get_irq_work(struct mmap_unlock_irq_work **work_ptr)
+static inline bool bpf_mmap_unlock_get_irq_work(struct bpf_iter_mm_irq_work **work_ptr)
 {
-	struct mmap_unlock_irq_work *work = NULL;
+	struct bpf_iter_mm_irq_work *work = NULL;
 	bool irq_work_busy = false;
 
 	if (irqs_disabled()) {
@@ -46,7 +46,7 @@ static inline bool bpf_mmap_unlock_get_irq_work(struct mmap_unlock_irq_work **wo
 	return irq_work_busy;
 }
 
-static inline void bpf_mmap_unlock_mm(struct mmap_unlock_irq_work *work, struct mm_struct *mm)
+static inline void bpf_mmap_unlock_mm(struct bpf_iter_mm_irq_work *work, struct mm_struct *mm)
 {
 	if (!work) {
 		mmap_read_unlock(mm);
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index da3d328f5c15..7ef1042a3448 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -166,7 +166,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
 					  u32 trace_nr, bool user, bool may_fault)
 {
 	int i;
-	struct mmap_unlock_irq_work *work = NULL;
+	struct bpf_iter_mm_irq_work *work = NULL;
 	bool irq_work_busy = bpf_mmap_unlock_get_irq_work(&work);
 	struct vm_area_struct *vma, *prev_vma = NULL;
 	const char *prev_build_id;
diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c
index 98d9b4c0daff..7c302ee78f7e 100644
--- a/kernel/bpf/task_iter.c
+++ b/kernel/bpf/task_iter.c
@@ -751,7 +751,7 @@ static struct bpf_iter_reg task_vma_reg_info = {
 BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start,
 	   bpf_callback_t, callback_fn, void *, callback_ctx, u64, flags)
 {
-	struct mmap_unlock_irq_work *work = NULL;
+	struct bpf_iter_mm_irq_work *work = NULL;
 	struct vm_area_struct *vma;
 	bool irq_work_busy = false;
 	struct mm_struct *mm;
@@ -797,7 +797,7 @@ const struct bpf_func_proto bpf_find_vma_proto = {
 struct bpf_iter_task_vma_kern_data {
 	struct task_struct *task;
 	struct mm_struct *mm;
-	struct mmap_unlock_irq_work *work;
+	struct bpf_iter_mm_irq_work *work;
 	struct vma_iterator vmi;
 };
 
@@ -1029,22 +1029,22 @@ __bpf_kfunc void bpf_iter_task_destroy(struct bpf_iter_task *it)
 
 __bpf_kfunc_end_defs();
 
-DEFINE_PER_CPU(struct mmap_unlock_irq_work, mmap_unlock_work);
+DEFINE_PER_CPU(struct bpf_iter_mm_irq_work, mmap_unlock_work);
 
 static void do_mmap_read_unlock(struct irq_work *entry)
 {
-	struct mmap_unlock_irq_work *work;
+	struct bpf_iter_mm_irq_work *work;
 
 	if (WARN_ON_ONCE(IS_ENABLED(CONFIG_PREEMPT_RT)))
 		return;
 
-	work = container_of(entry, struct mmap_unlock_irq_work, irq_work);
+	work = container_of(entry, struct bpf_iter_mm_irq_work, irq_work);
 	mmap_read_unlock_non_owner(work->mm);
 }
 
 static int __init task_iter_init(void)
 {
-	struct mmap_unlock_irq_work *work;
+	struct bpf_iter_mm_irq_work *work;
 	int ret, cpu;
 
 	for_each_possible_cpu(cpu) {
-- 
2.47.3


  reply	other threads:[~2026-03-09 15:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 15:54 [PATCH bpf v2 0/4] bpf: fix and improve open-coded task_vma iterator Puranjay Mohan
2026-03-09 15:54 ` Puranjay Mohan [this message]
2026-03-11 18:32   ` [PATCH bpf v2 1/4] bpf: rename mmap_unlock_irq_work to bpf_iter_mm_irq_work Andrii Nakryiko
2026-03-09 15:54 ` [PATCH bpf v2 2/4] bpf: fix mm lifecycle in open-coded task_vma iterator Puranjay Mohan
2026-03-09 16:48   ` Alexei Starovoitov
2026-03-09 18:02     ` Puranjay Mohan
2026-03-09 18:12       ` Alexei Starovoitov
2026-03-11 18:35   ` Andrii Nakryiko
2026-03-09 15:54 ` [PATCH bpf v2 3/4] bpf: switch task_vma iterator from mmap_lock to per-VMA locks Puranjay Mohan
2026-03-09 16:33   ` bot+bpf-ci
2026-03-11 19:00   ` Andrii Nakryiko
2026-03-11 19:25     ` Puranjay Mohan
2026-03-11 23:54       ` Andrii Nakryiko
2026-03-09 15:54 ` [PATCH bpf v2 4/4] bpf: return VMA snapshot from task_vma iterator Puranjay Mohan
2026-03-09 17:11   ` Mykyta Yatsenko
2026-03-11 19:07   ` Andrii Nakryiko
2026-03-11 19:27     ` Puranjay Mohan

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=20260309155506.23490-2-puranjay@kernel.org \
    --to=puranjay@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=martin.lau@kernel.org \
    --cc=memxor@gmail.com \
    --cc=mykyta.yatsenko5@gmail.com \
    --cc=puranjay12@gmail.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