Merge tag 'probes-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 2 Nov 2023 02:15:42 +0000 (16:15 -1000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 2 Nov 2023 02:15:42 +0000 (16:15 -1000)
Pull probes updates from Masami Hiramatsu:
 "Cleanups:

   - kprobes: Fixes typo in kprobes samples

   - tracing/eprobes: Remove 'break' after return

  kretprobe/fprobe performance improvements:

   - lib: Introduce new `objpool`, which is a high performance lockless
     object queue. This uses per-cpu ring array to allocate/release
     objects from the pre-allocated object pool.

     Since the index of ring array is a 32bit sequential counter, we can
     retry to push/pop the object pointer from the ring without lock (as
     seq-lock does)

   - lib: Add an objpool test module to test the functionality and
     evaluate the performance under some circumstances

   - kprobes/fprobe: Improve kretprobe and rethook scalability
     performance with objpool.

     This improves both legacy kretprobe and fprobe exit handler (which
     is based on rethook) to be scalable on SMP systems. Even with
     8-threads parallel test, it shows a great scalability improvement

   - Remove unneeded freelist.h which is replaced by objpool

   - objpool: Add maintainers entry for the objpool

   - objpool: Fix to remove unused include header lines"

* tag 'probes-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  kprobes: unused header files removed
  MAINTAINERS: objpool added
  kprobes: freelist.h removed
  kprobes: kretprobe scalability improvement
  lib: objpool test module added
  lib: objpool added: ring-array based lockless MPMC
  tracing/eprobe: drop unneeded breaks
  samples: kprobes: Fixes a typo

1  2 
MAINTAINERS
kernel/trace/fprobe.c
lib/Kconfig.debug
lib/Makefile

diff --cc MAINTAINERS
Simple merge
index 881f90f0cbcfac92831e97bca869347d52b15e3e,6890f4fd17fc837a73656aa4f252a21c825552f5..6cd2a4e3afb8fb6045dbf27543a67147dea20900
@@@ -187,9 -187,9 +187,9 @@@ static void fprobe_init(struct fprobe *
  
  static int fprobe_init_rethook(struct fprobe *fp, int num)
  {
-       int i, size;
+       int size;
  
 -      if (num < 0)
 +      if (num <= 0)
                return -EINVAL;
  
        if (!fp->exit_handler) {
                size = fp->nr_maxactive;
        else
                size = num * num_possible_cpus() * 2;
 -      if (size < 0)
 -              return -E2BIG;
 +      if (size <= 0)
 +              return -EINVAL;
  
-       fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler);
-       if (!fp->rethook)
-               return -ENOMEM;
-       for (i = 0; i < size; i++) {
-               struct fprobe_rethook_node *node;
-               node = kzalloc(sizeof(*node) + fp->entry_data_size, GFP_KERNEL);
-               if (!node) {
-                       rethook_free(fp->rethook);
-                       fp->rethook = NULL;
-                       return -ENOMEM;
-               }
-               rethook_add_node(fp->rethook, &node->node);
-       }
+       /* Initialize rethook */
+       fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler,
+                               sizeof(struct fprobe_rethook_node), size);
+       if (IS_ERR(fp->rethook))
+               return PTR_ERR(fp->rethook);
        return 0;
  }
  
Simple merge
diff --cc lib/Makefile
Simple merge