Hi bibo,
Thank you for your review!
bibo,mao wrote:
This patch will boost kprobe on preemptible kernel, I think
it is deserved to waster some memory for better performance
by deferring memory free after freeze_processes.
I think it doesn't waste memory so much, because it tries
to reuse garbage memories before the kernel allocates an
additional page.
[...]
+static int __kprobes collect_garbage_slots(void)
+{
+ struct kprobe_insn_page *kip;
+ struct hlist_node *pos, *next;
+ int ret = -1;
+
+#if defined(CONFIG_PREEMPT) && defined(CONFIG_PM)
+ /* Ensure no-one is preepmted on the garbages */
+ if (freeze_processes() != 0)
I do not know whether there exists non-freezeable and preemptive kernel
thread, if there exist then this thread will not be frozen.
In that case, freeze_processes() returns the positive value which
means how many processes are not frozen. If freeze_processes()
returns non-zero, this function aborts the garbage collection.