uprobes: fold __uprobe_unregister() into uprobe_unregister()

Fold __uprobe_unregister() into its single caller, uprobe_unregister().
A separate patch to simplify the next change.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Link: https://lore.kernel.org/r/20240801132744.GA8814@redhat.com
This commit is contained in:
Oleg Nesterov 2024-08-01 15:27:44 +02:00 committed by Peter Zijlstra
parent bb18c5de1c
commit 70408bebba

View File

@ -1085,20 +1085,6 @@ register_for_each_vma(struct uprobe *uprobe, struct uprobe_consumer *new)
return err;
}
static void
__uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *uc)
{
int err;
if (WARN_ON(!consumer_del(uprobe, uc)))
return;
err = register_for_each_vma(uprobe, NULL);
/* TODO : cant unregister? schedule a worker thread */
if (!uprobe->consumers && !err)
delete_uprobe(uprobe);
}
/**
* uprobe_unregister - unregister an already registered probe.
* @uprobe: uprobe to remove
@ -1106,9 +1092,18 @@ __uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *uc)
*/
void uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *uc)
{
int err;
get_uprobe(uprobe);
down_write(&uprobe->register_rwsem);
__uprobe_unregister(uprobe, uc);
if (WARN_ON(!consumer_del(uprobe, uc)))
err = -ENOENT;
else
err = register_for_each_vma(uprobe, NULL);
/* TODO : cant unregister? schedule a worker thread */
if (!err && !uprobe->consumers)
delete_uprobe(uprobe);
up_write(&uprobe->register_rwsem);
put_uprobe(uprobe);
}