hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/include/linux/workqueue.h
....@@ -63,7 +63,7 @@
6363 WORK_CPU_UNBOUND = NR_CPUS,
6464
6565 /*
66
- * Reserve 7 bits off of pwq pointer w/ debugobjects turned off.
66
+ * Reserve 8 bits off of pwq pointer w/ debugobjects turned off.
6767 * This makes pwqs aligned to 256 bytes and allows 15 workqueue
6868 * flush colors.
6969 */
....@@ -396,43 +396,23 @@
396396 extern struct workqueue_struct *system_power_efficient_wq;
397397 extern struct workqueue_struct *system_freezable_power_efficient_wq;
398398
399
-extern struct workqueue_struct *
400
-__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
401
- struct lock_class_key *key, const char *lock_name, ...) __printf(1, 6);
402
-
403399 /**
404400 * alloc_workqueue - allocate a workqueue
405401 * @fmt: printf format for the name of the workqueue
406402 * @flags: WQ_* flags
407403 * @max_active: max in-flight work items, 0 for default
408
- * @args...: args for @fmt
404
+ * remaining args: args for @fmt
409405 *
410406 * Allocate a workqueue with the specified parameters. For detailed
411407 * information on WQ_* flags, please refer to
412408 * Documentation/core-api/workqueue.rst.
413409 *
414
- * The __lock_name macro dance is to guarantee that single lock_class_key
415
- * doesn't end up with different namesm, which isn't allowed by lockdep.
416
- *
417410 * RETURNS:
418411 * Pointer to the allocated workqueue on success, %NULL on failure.
419412 */
420
-#ifdef CONFIG_LOCKDEP
421
-#define alloc_workqueue(fmt, flags, max_active, args...) \
422
-({ \
423
- static struct lock_class_key __key; \
424
- const char *__lock_name; \
425
- \
426
- __lock_name = "(wq_completion)"#fmt#args; \
427
- \
428
- __alloc_workqueue_key((fmt), (flags), (max_active), \
429
- &__key, __lock_name, ##args); \
430
-})
431
-#else
432
-#define alloc_workqueue(fmt, flags, max_active, args...) \
433
- __alloc_workqueue_key((fmt), (flags), (max_active), \
434
- NULL, NULL, ##args)
435
-#endif
413
+struct workqueue_struct *alloc_workqueue(const char *fmt,
414
+ unsigned int flags,
415
+ int max_active, ...);
436416
437417 /**
438418 * alloc_ordered_workqueue - allocate an ordered workqueue
....@@ -461,10 +441,16 @@
461441
462442 extern void destroy_workqueue(struct workqueue_struct *wq);
463443
444
+struct workqueue_attrs *alloc_workqueue_attrs(void);
445
+void free_workqueue_attrs(struct workqueue_attrs *attrs);
446
+int apply_workqueue_attrs(struct workqueue_struct *wq,
447
+ const struct workqueue_attrs *attrs);
464448 int workqueue_set_unbound_cpumask(cpumask_var_t cpumask);
465449
466450 extern bool queue_work_on(int cpu, struct workqueue_struct *wq,
467451 struct work_struct *work);
452
+extern bool queue_work_node(int node, struct workqueue_struct *wq,
453
+ struct work_struct *work);
468454 extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
469455 struct delayed_work *work, unsigned long delay);
470456 extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,
....@@ -507,6 +493,19 @@
507493 *
508494 * We queue the work to the CPU on which it was submitted, but if the CPU dies
509495 * it can be processed by another CPU.
496
+ *
497
+ * Memory-ordering properties: If it returns %true, guarantees that all stores
498
+ * preceding the call to queue_work() in the program order will be visible from
499
+ * the CPU which will execute @work by the time such work executes, e.g.,
500
+ *
501
+ * { x is initially 0 }
502
+ *
503
+ * CPU0 CPU1
504
+ *
505
+ * WRITE_ONCE(x, 1); [ @work is being executed ]
506
+ * r0 = queue_work(wq, work); r1 = READ_ONCE(x);
507
+ *
508
+ * Forbids: r0 == true && r1 == 0
510509 */
511510 static inline bool queue_work(struct workqueue_struct *wq,
512511 struct work_struct *work)
....@@ -566,6 +565,9 @@
566565 * This puts a job in the kernel-global workqueue if it was not already
567566 * queued and leaves it in the same position on the kernel-global
568567 * workqueue otherwise.
568
+ *
569
+ * Shares the same memory-ordering properties of queue_work(), cf. the
570
+ * DocBook header of queue_work().
569571 */
570572 static inline bool schedule_work(struct work_struct *work)
571573 {
....@@ -669,7 +671,7 @@
669671 int workqueue_offline_cpu(unsigned int cpu);
670672 #endif
671673
672
-int __init workqueue_init_early(void);
673
-int __init workqueue_init(void);
674
+void __init workqueue_init_early(void);
675
+void __init workqueue_init(void);
674676
675677 #endif