Skip to content

Commit

Permalink
kprobes: Support delayed unoptimizing
Browse files Browse the repository at this point in the history
Unoptimization occurs when a probe is unregistered or disabled,
and is heavy because it recovers instructions by using
stop_machine(). This patch delays unoptimization operations and
unoptimize several probes at once by using
text_poke_smp_batch(). This can avoid unexpected system slowdown
coming from stop_machine().

Changes in v5:
- Split this patch into several cleanup patches and this patch.
- Fix some text_mutex lock miss.
- Use bool instead of int for behavior flags.
- Add additional comment for (un)optimizing path.

Changes in v2:
- Use dynamic allocated buffers and params.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: 2nddept-manager@sdl.hitachi.co.jp
LKML-Reference: <20101203095409.2961.82733.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
mhiramathitachi authored and Ingo Molnar committed Dec 6, 2010
1 parent 61f4e13 commit 6274de4
Show file tree
Hide file tree
Showing 2 changed files with 237 additions and 77 deletions.
4 changes: 4 additions & 0 deletions arch/x86/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,10 @@ static void __kprobes optimized_callback(struct optimized_kprobe *op,
{
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();

/* This is possible if op is under delayed unoptimizing */
if (kprobe_disabled(&op->kp))
return;

preempt_disable();
if (kprobe_running()) {
kprobes_inc_nmissed_count(&op->kp);
Expand Down
Loading

0 comments on commit 6274de4

Please sign in to comment.