Merge tag 'mips_6.2_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
[linux-block.git] / kernel / kprobes.c
index 3050631e528d9924c5b4574e528db98b0a2f9f03..1c18ecf9f98b10a10443bda16a54da648275560a 100644 (file)
@@ -2213,13 +2213,9 @@ int register_kretprobe(struct kretprobe *rp)
        rp->kp.post_handler = NULL;
 
        /* Pre-allocate memory for max kretprobe instances */
-       if (rp->maxactive <= 0) {
-#ifdef CONFIG_PREEMPTION
+       if (rp->maxactive <= 0)
                rp->maxactive = max_t(unsigned int, 10, 2*num_possible_cpus());
-#else
-               rp->maxactive = num_possible_cpus();
-#endif
-       }
+
 #ifdef CONFIG_KRETPROBE_ON_RETHOOK
        rp->rh = rethook_alloc((void *)rp, kretprobe_rethook_handler);
        if (!rp->rh)
@@ -2364,6 +2360,14 @@ static void kill_kprobe(struct kprobe *p)
 
        lockdep_assert_held(&kprobe_mutex);
 
+       /*
+        * The module is going away. We should disarm the kprobe which
+        * is using ftrace, because ftrace framework is still available at
+        * 'MODULE_STATE_GOING' notification.
+        */
+       if (kprobe_ftrace(p) && !kprobe_disabled(p) && !kprobes_all_disarmed)
+               disarm_kprobe_ftrace(p);
+
        p->flags |= KPROBE_FLAG_GONE;
        if (kprobe_aggrprobe(p)) {
                /*
@@ -2380,14 +2384,6 @@ static void kill_kprobe(struct kprobe *p)
         * the original probed function (which will be freed soon) any more.
         */
        arch_remove_kprobe(p);
-
-       /*
-        * The module is going away. We should disarm the kprobe which
-        * is using ftrace, because ftrace framework is still available at
-        * 'MODULE_STATE_GOING' notification.
-        */
-       if (kprobe_ftrace(p) && !kprobe_disabled(p) && !kprobes_all_disarmed)
-               disarm_kprobe_ftrace(p);
 }
 
 /* Disable one kprobe */