Commit c635696c7c0fbc720698dbec34bb83e53df6a967

Authored by Steffen Klassert
Committed by Herbert Xu
1 parent 65ff577e6b

padata: Pass the padata cpumasks to the cpumask_change_notifier chain

We pass a pointer to the new padata cpumasks to the cpumask_change_notifier
chain. So users can access the cpumasks without the need of an extra
padata_get_cpumask function.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 2 changed files with 23 additions and 20 deletions Side-by-side Diff

include/linux/padata.h
... ... @@ -98,6 +98,16 @@
98 98 int cpu_index;
99 99 };
100 100  
  101 +/**
  102 + * struct padata_cpumask - The cpumasks for the parallel/serial workers
  103 + *
  104 + * @pcpu: cpumask for the parallel workers.
  105 + * @cbcpu: cpumask for the serial (callback) workers.
  106 + */
  107 +struct padata_cpumask {
  108 + cpumask_var_t pcpu;
  109 + cpumask_var_t cbcpu;
  110 +};
101 111  
102 112 /**
103 113 * struct parallel_data - Internal control structure, covers everything
... ... @@ -110,8 +120,7 @@
110 120 * @reorder_objects: Number of objects waiting in the reorder queues.
111 121 * @refcnt: Number of objects holding a reference on this parallel_data.
112 122 * @max_seq_nr: Maximal used sequence number.
113   - * @cpumask: Contains two cpumasks: pcpu and cbcpu for
114   - * parallel and serial workers respectively.
  123 + * @cpumask: The cpumasks in use for parallel and serial workers.
115 124 * @lock: Reorder lock.
116 125 * @processed: Number of already processed objects.
117 126 * @timer: Reorder timer.
... ... @@ -120,17 +129,14 @@
120 129 struct padata_instance *pinst;
121 130 struct padata_parallel_queue *pqueue;
122 131 struct padata_serial_queue *squeue;
123   - atomic_t seq_nr;
124   - atomic_t reorder_objects;
125   - atomic_t refcnt;
126   - unsigned int max_seq_nr;
127   - struct {
128   - cpumask_var_t pcpu;
129   - cpumask_var_t cbcpu;
130   - } cpumask;
131   - spinlock_t lock ____cacheline_aligned;
132   - unsigned int processed;
133   - struct timer_list timer;
  132 + atomic_t seq_nr;
  133 + atomic_t reorder_objects;
  134 + atomic_t refcnt;
  135 + unsigned int max_seq_nr;
  136 + struct padata_cpumask cpumask;
  137 + spinlock_t lock ____cacheline_aligned;
  138 + unsigned int processed;
  139 + struct timer_list timer;
134 140 };
135 141  
136 142 /**
... ... @@ -139,8 +145,7 @@
139 145 * @cpu_notifier: cpu hotplug notifier.
140 146 * @wq: The workqueue in use.
141 147 * @pd: The internal control structure.
142   - * @cpumask: User supplied cpumask. Contains two cpumasks: pcpu and
143   - * cbcpu for parallel and serial works respectivly.
  148 + * @cpumask: User supplied cpumasks for parallel and serial works.
144 149 * @cpumask_change_notifier: Notifiers chain for user-defined notify
145 150 * callbacks that will be called when either @pcpu or @cbcpu
146 151 * or both cpumasks change.
... ... @@ -152,10 +157,7 @@
152 157 struct notifier_block cpu_notifier;
153 158 struct workqueue_struct *wq;
154 159 struct parallel_data *pd;
155   - struct {
156   - cpumask_var_t pcpu;
157   - cpumask_var_t cbcpu;
158   - } cpumask;
  160 + struct padata_cpumask cpumask;
159 161 struct blocking_notifier_head cpumask_change_notifier;
160 162 struct kobject kobj;
161 163 struct mutex lock;
... ... @@ -538,7 +538,8 @@
538 538  
539 539 if (notification_mask)
540 540 blocking_notifier_call_chain(&pinst->cpumask_change_notifier,
541   - notification_mask, pinst);
  541 + notification_mask,
  542 + &pd_new->cpumask);
542 543  
543 544 pinst->flags &= ~PADATA_RESET;
544 545 }