Skip to content

Commit c635696

Browse files
klassertherbertx
authored andcommitted
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>
1 parent 65ff577 commit c635696

2 files changed

Lines changed: 23 additions & 20 deletions

File tree

‎include/linux/padata.h‎

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ struct padata_parallel_queue {
9898
int cpu_index;
9999
};
100100

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+
};
101111

102112
/**
103113
* struct parallel_data - Internal control structure, covers everything
@@ -110,8 +120,7 @@ struct padata_parallel_queue {
110120
* @reorder_objects: Number of objects waiting in the reorder queues.
111121
* @refcnt: Number of objects holding a reference on this parallel_data.
112122
* @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.
115124
* @lock: Reorder lock.
116125
* @processed: Number of already processed objects.
117126
* @timer: Reorder timer.
@@ -120,17 +129,14 @@ struct parallel_data {
120129
struct padata_instance *pinst;
121130
struct padata_parallel_queue *pqueue;
122131
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;
134140
};
135141

136142
/**
@@ -139,8 +145,7 @@ struct parallel_data {
139145
* @cpu_notifier: cpu hotplug notifier.
140146
* @wq: The workqueue in use.
141147
* @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.
144149
* @cpumask_change_notifier: Notifiers chain for user-defined notify
145150
* callbacks that will be called when either @pcpu or @cbcpu
146151
* or both cpumasks change.
@@ -152,10 +157,7 @@ struct padata_instance {
152157
struct notifier_block cpu_notifier;
153158
struct workqueue_struct *wq;
154159
struct parallel_data *pd;
155-
struct {
156-
cpumask_var_t pcpu;
157-
cpumask_var_t cbcpu;
158-
} cpumask;
160+
struct padata_cpumask cpumask;
159161
struct blocking_notifier_head cpumask_change_notifier;
160162
struct kobject kobj;
161163
struct mutex lock;

‎kernel/padata.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ static void padata_replace(struct padata_instance *pinst,
538538

539539
if (notification_mask)
540540
blocking_notifier_call_chain(&pinst->cpumask_change_notifier,
541-
notification_mask, pinst);
541+
notification_mask,
542+
&pd_new->cpumask);
542543

543544
pinst->flags &= ~PADATA_RESET;
544545
}

0 commit comments

Comments
 (0)