Lines Matching defs:nna
1720 static bool tryinc_node_nr_active(struct wq_node_nr_active *nna)
1722 int max = READ_ONCE(nna->max);
1723 int old = atomic_read(&nna->nr);
1728 } while (!atomic_try_cmpxchg_relaxed(&nna->nr, &old, old + 1));
1745 struct wq_node_nr_active *nna = wq_node_nr_active(wq, pool->node);
1750 if (!nna) {
1760 * Unbound workqueue uses per-node shared nr_active $nna. If @pwq is
1761 * already waiting on $nna, pwq_dec_nr_active() will maintain the
1771 obtained = tryinc_node_nr_active(nna);
1776 * Lockless acquisition failed. Lock, add ourself to $nna->pending_pwqs
1779 * we see the decremented $nna->nr or they see non-empty
1780 * $nna->pending_pwqs.
1782 raw_spin_lock(&nna->lock);
1785 list_add_tail(&pwq->pending_node, &nna->pending_pwqs);
1791 obtained = tryinc_node_nr_active(nna);
1801 raw_spin_unlock(&nna->lock);
1871 * pwq to nna->pending_pwqs if the count can't be
1887 * @nna: wq_node_nr_active to activate a pending pwq for
1890 * Activate a pwq in @nna->pending_pwqs. Called with @caller_pool locked.
1893 static void node_activate_pending_pwq(struct wq_node_nr_active *nna,
1902 raw_spin_lock(&nna->lock);
1904 pwq = list_first_entry_or_null(&nna->pending_pwqs,
1912 * / lock dance. For that, we also need to release @nna->lock as it's
1919 raw_spin_unlock(&nna->lock);
1921 raw_spin_lock(&nna->lock);
1944 if (likely(tryinc_node_nr_active(nna))) {
1951 list_move_tail(&pwq->pending_node, &nna->pending_pwqs);
1959 raw_spin_unlock(&nna->lock);
1976 struct wq_node_nr_active *nna = wq_node_nr_active(pwq->wq, pool->node);
1990 if (!nna) {
1999 * $nna->pending_pwqs. The following atomic_dec_return()'s implied
2002 * decremented $nna->nr.
2004 * $nna->max may change as CPUs come online/offline and @pwq->wq's
2009 if (atomic_dec_return(&nna->nr) >= READ_ONCE(nna->max))
2012 if (!list_empty(&nna->pending_pwqs))
2013 node_activate_pending_pwq(nna, pool);
4979 static void init_node_nr_active(struct wq_node_nr_active *nna)
4981 nna->max = WQ_DFL_MIN_ACTIVE;
4982 atomic_set(&nna->nr, 0);
4983 raw_spin_lock_init(&nna->lock);
4984 INIT_LIST_HEAD(&nna->pending_pwqs);
4993 struct wq_node_nr_active *nna;
4997 nna = kzalloc_node(sizeof(*nna), GFP_KERNEL, node);
4998 if (!nna)
5000 init_node_nr_active(nna);
5001 nna_ar[node] = nna;
5005 nna = kzalloc_node(sizeof(*nna), GFP_KERNEL, NUMA_NO_NODE);
5006 if (!nna)
5008 init_node_nr_active(nna);
5009 nna_ar[nr_node_ids] = nna;
5222 struct wq_node_nr_active *nna =
5225 raw_spin_lock_irq(&nna->lock);
5227 raw_spin_unlock_irq(&nna->lock);