2 * padata.h - header for the padata parallelization interface
4 * Copyright (C) 2008, 2009 secunet Security Networks AG
5 * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24 #include <linux/workqueue.h>
25 #include <linux/spinlock.h>
26 #include <linux/list.h>
29 struct list_head list
;
30 struct parallel_data
*pd
;
34 void (*parallel
)(struct padata_priv
*padata
);
35 void (*serial
)(struct padata_priv
*padata
);
39 struct list_head list
;
44 struct padata_list parallel
;
45 struct padata_list reorder
;
46 struct padata_list serial
;
47 struct work_struct pwork
;
48 struct work_struct swork
;
49 struct parallel_data
*pd
;
54 struct parallel_data
{
55 struct padata_instance
*pinst
;
56 struct padata_queue
*queue
;
58 atomic_t reorder_objects
;
60 unsigned int max_seq_nr
;
61 cpumask_var_t cpumask
;
65 struct padata_instance
{
66 struct notifier_block cpu_notifier
;
67 struct workqueue_struct
*wq
;
68 struct parallel_data
*pd
;
69 cpumask_var_t cpumask
;
73 #define PADATA_RESET 2
76 extern struct padata_instance
*padata_alloc(const struct cpumask
*cpumask
,
77 struct workqueue_struct
*wq
);
78 extern void padata_free(struct padata_instance
*pinst
);
79 extern int padata_do_parallel(struct padata_instance
*pinst
,
80 struct padata_priv
*padata
, int cb_cpu
);
81 extern void padata_do_serial(struct padata_priv
*padata
);
82 extern int padata_set_cpumask(struct padata_instance
*pinst
,
83 cpumask_var_t cpumask
);
84 extern int padata_add_cpu(struct padata_instance
*pinst
, int cpu
);
85 extern int padata_remove_cpu(struct padata_instance
*pinst
, int cpu
);
86 extern void padata_start(struct padata_instance
*pinst
);
87 extern void padata_stop(struct padata_instance
*pinst
);