# \[PATCH 1/1\] uprobe: fix comment of uprobe\_apply()

- Subsystems: UPROBES, PERFORMANCE EVENTS SUBSYSTEM, THE REST
- Maintainers: Masami Hiramatsu, Oleg Nesterov, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Linus Torvalds
- List: linux-trace-kernel
- 3 messages, 2 authors
- Page: https://ratatoskr.run/linux-trace-kernel/2024/08/2714921/t

## \[PATCH 1/1\] uprobe: fix comment of uprobe\_apply()

- From: Zhen Lei \<hidden\>
- Date: 2024-08-20 13:52:38 
- Message: https://ratatoskr.run/linux-trace-kernel/2024/08/2714921.md

```text
Depending on the argument 'add', uprobe_apply() may be registering or
unregistering a probe. The current comment misses the description of the
registration.

Signed-off-by: Zhen Lei <redacted>
---
 kernel/events/uprobes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 73cc47708679f0c..c9de255e56e777f 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1201,8 +1201,8 @@ int uprobe_register_refctr(struct inode *inode, loff_t offset,
 EXPORT_SYMBOL_GPL(uprobe_register_refctr);
 
 /*
- * uprobe_apply - unregister an already registered probe.
- * @inode: the file in which the probe has to be removed.
+ * uprobe_apply - register a probe or unregister an already registered probe.
+ * @inode: the file in which the probe has to be placed or removed.
  * @offset: offset from the start of the file.
  * @uc: consumer which wants to add more or remove some breakpoints
  * @add: add or remove the breakpoints
-- 
2.34.1

```

## Re: \[PATCH 1/1\] uprobe: fix comment of uprobe\_apply()

- From: Oleg Nesterov \<oleg@redhat.com\>
- Date: 2024-08-20 14:30:23 
- Message: https://ratatoskr.run/linux-trace-kernel/2024/08/2714975.md

```text
On 08/20, Zhen Lei wrote:
>
> Depending on the argument 'add', uprobe_apply() may be registering or
> unregistering a probe.

...

>  /*
> - * uprobe_apply - unregister an already registered probe.
> - * @inode: the file in which the probe has to be removed.
> + * uprobe_apply - register a probe or unregister an already registered probe.

Not really.

See the commit 3c83a9ad0295eb63bd ("uprobes: make uprobe_register() return struct uprobe *")
in tip/perf/core which changed this description

	* uprobe_apply - add or remove the breakpoints according to @uc->filter

still looks confusing, yes...

Oleg.

```

## Re: \[PATCH 1/1\] uprobe: fix comment of uprobe\_apply()

- From: Leizhen (ThunderTown) \<hidden\>
- Date: 2024-08-21 01:39:20 
- Message: https://ratatoskr.run/linux-trace-kernel/2024/08/2715597.md

```text


On 2024/8/20 22:30, Oleg Nesterov wrote:
> On 08/20, Zhen Lei wrote:
>>
>> Depending on the argument 'add', uprobe_apply() may be registering or
>> unregistering a probe.
> 
> ...
> 
>>  /*
>> - * uprobe_apply - unregister an already registered probe.
>> - * @inode: the file in which the probe has to be removed.
>> + * uprobe_apply - register a probe or unregister an already registered probe.
> 
> Not really.
> 
> See the commit 3c83a9ad0295eb63bd ("uprobes: make uprobe_register() return struct uprobe *")
> in tip/perf/core which changed this description
> 
> 	* uprobe_apply - add or remove the breakpoints according to @uc->filter
> 
> still looks confusing, yes...

OK, I got it. I mistakenly thought the comment was based on register_for_each_vma.
It seems necessary to rename 'register_for_each_vma' to 'apply_for_each_vma',
or some other more appropriate name.

> 
> Oleg.
> 
> 
> .
> 

-- 
Regards,
  Zhen Lei
```
