]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
llist: make llist_add_batch() a static inline
authorJens Axboe <axboe@kernel.dk>
Fri, 23 May 2025 19:13:11 +0000 (13:13 -0600)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 28 May 2025 02:40:34 +0000 (19:40 -0700)
The function is small enough that it should be, and it's a (very) hot path
for io_uring.  Doing this actually reduces my vmlinux text size for my
standard build/test box.

Before:
axboe@r7625 ~/g/linux (test)> size vmlinux
   text    data     bss     dec     hex filename
19892174 5938310 2470432 28300916 1afd674 vmlinux

After:
axboe@r7625 ~/g/linux (test)> size vmlinux
   text    data     bss     dec     hex filename
19891878 5938310 2470436 28300624 1afd550 vmlinux

Link: https://lkml.kernel.org/r/f1d104c6-7ac8-457a-a53d-6bb741421b2f@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/llist.h
lib/llist.c

index 2c982ff7475ab0f608371eb246617767d92be340..27b17f64bceef5307681aa07aaed367887f73980 100644 (file)
@@ -223,9 +223,26 @@ static inline struct llist_node *llist_next(struct llist_node *node)
        return node->next;
 }
 
-extern bool llist_add_batch(struct llist_node *new_first,
-                           struct llist_node *new_last,
-                           struct llist_head *head);
+/**
+ * llist_add_batch - add several linked entries in batch
+ * @new_first: first entry in batch to be added
+ * @new_last:  last entry in batch to be added
+ * @head:      the head for your lock-less list
+ *
+ * Return whether list is empty before adding.
+ */
+static inline bool llist_add_batch(struct llist_node *new_first,
+                                  struct llist_node *new_last,
+                                  struct llist_head *head)
+{
+       struct llist_node *first = READ_ONCE(head->first);
+
+       do {
+               new_last->next = first;
+       } while (!try_cmpxchg(&head->first, &first, new_first));
+
+       return !first;
+}
 
 static inline bool __llist_add_batch(struct llist_node *new_first,
                                     struct llist_node *new_last,
index f21d0cfbbaaabcb85de5890e9f3d8fa976e1bde7..f574c17a238ed0aa506b50da8b5d5b9498059241 100644 (file)
 #include <linux/export.h>
 #include <linux/llist.h>
 
-
-/**
- * llist_add_batch - add several linked entries in batch
- * @new_first: first entry in batch to be added
- * @new_last:  last entry in batch to be added
- * @head:      the head for your lock-less list
- *
- * Return whether list is empty before adding.
- */
-bool llist_add_batch(struct llist_node *new_first, struct llist_node *new_last,
-                    struct llist_head *head)
-{
-       struct llist_node *first = READ_ONCE(head->first);
-
-       do {
-               new_last->next = first;
-       } while (!try_cmpxchg(&head->first, &first, new_first));
-
-       return !first;
-}
-EXPORT_SYMBOL_GPL(llist_add_batch);
-
 /**
  * llist_del_first - delete the first entry of lock-less list
  * @head:      the head for your lock-less list