.. | .. |
---|
63 | 63 | WORK_CPU_UNBOUND = NR_CPUS, |
---|
64 | 64 | |
---|
65 | 65 | /* |
---|
66 | | - * Reserve 7 bits off of pwq pointer w/ debugobjects turned off. |
---|
| 66 | + * Reserve 8 bits off of pwq pointer w/ debugobjects turned off. |
---|
67 | 67 | * This makes pwqs aligned to 256 bytes and allows 15 workqueue |
---|
68 | 68 | * flush colors. |
---|
69 | 69 | */ |
---|
.. | .. |
---|
396 | 396 | extern struct workqueue_struct *system_power_efficient_wq; |
---|
397 | 397 | extern struct workqueue_struct *system_freezable_power_efficient_wq; |
---|
398 | 398 | |
---|
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 | | - |
---|
403 | 399 | /** |
---|
404 | 400 | * alloc_workqueue - allocate a workqueue |
---|
405 | 401 | * @fmt: printf format for the name of the workqueue |
---|
406 | 402 | * @flags: WQ_* flags |
---|
407 | 403 | * @max_active: max in-flight work items, 0 for default |
---|
408 | | - * @args...: args for @fmt |
---|
| 404 | + * remaining args: args for @fmt |
---|
409 | 405 | * |
---|
410 | 406 | * Allocate a workqueue with the specified parameters. For detailed |
---|
411 | 407 | * information on WQ_* flags, please refer to |
---|
412 | 408 | * Documentation/core-api/workqueue.rst. |
---|
413 | 409 | * |
---|
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 | | - * |
---|
417 | 410 | * RETURNS: |
---|
418 | 411 | * Pointer to the allocated workqueue on success, %NULL on failure. |
---|
419 | 412 | */ |
---|
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, ...); |
---|
436 | 416 | |
---|
437 | 417 | /** |
---|
438 | 418 | * alloc_ordered_workqueue - allocate an ordered workqueue |
---|
.. | .. |
---|
461 | 441 | |
---|
462 | 442 | extern void destroy_workqueue(struct workqueue_struct *wq); |
---|
463 | 443 | |
---|
| 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); |
---|
464 | 448 | int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); |
---|
465 | 449 | |
---|
466 | 450 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, |
---|
467 | 451 | struct work_struct *work); |
---|
| 452 | +extern bool queue_work_node(int node, struct workqueue_struct *wq, |
---|
| 453 | + struct work_struct *work); |
---|
468 | 454 | extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, |
---|
469 | 455 | struct delayed_work *work, unsigned long delay); |
---|
470 | 456 | extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, |
---|
.. | .. |
---|
507 | 493 | * |
---|
508 | 494 | * We queue the work to the CPU on which it was submitted, but if the CPU dies |
---|
509 | 495 | * 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 |
---|
510 | 509 | */ |
---|
511 | 510 | static inline bool queue_work(struct workqueue_struct *wq, |
---|
512 | 511 | struct work_struct *work) |
---|
.. | .. |
---|
566 | 565 | * This puts a job in the kernel-global workqueue if it was not already |
---|
567 | 566 | * queued and leaves it in the same position on the kernel-global |
---|
568 | 567 | * workqueue otherwise. |
---|
| 568 | + * |
---|
| 569 | + * Shares the same memory-ordering properties of queue_work(), cf. the |
---|
| 570 | + * DocBook header of queue_work(). |
---|
569 | 571 | */ |
---|
570 | 572 | static inline bool schedule_work(struct work_struct *work) |
---|
571 | 573 | { |
---|
.. | .. |
---|
669 | 671 | int workqueue_offline_cpu(unsigned int cpu); |
---|
670 | 672 | #endif |
---|
671 | 673 | |
---|
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); |
---|
674 | 676 | |
---|
675 | 677 | #endif |
---|