Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
padata.c File Reference
#include <linux/export.h>
#include <linux/cpumask.h>
#include <linux/err.h>
#include <linux/cpu.h>
#include <linux/padata.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/rcupdate.h>

Go to the source code of this file.

Data Structures

struct  padata_sysfs_entry
 

Macros

#define MAX_OBJ_NUM   1000
 
#define kobj2pinst(_kobj)   container_of(_kobj, struct padata_instance, kobj)
 
#define attr2pentry(_attr)   container_of(_attr, struct padata_sysfs_entry, attr)
 
#define PADATA_ATTR_RW(_name, _show_name, _store_name)
 
#define PADATA_ATTR_RO(_name, _show_name)
 

Functions

int padata_do_parallel (struct padata_instance *pinst, struct padata_priv *padata, int cb_cpu)
 
 EXPORT_SYMBOL (padata_do_parallel)
 
void padata_do_serial (struct padata_priv *padata)
 
 EXPORT_SYMBOL (padata_do_serial)
 
int padata_register_cpumask_notifier (struct padata_instance *pinst, struct notifier_block *nblock)
 
 EXPORT_SYMBOL (padata_register_cpumask_notifier)
 
int padata_unregister_cpumask_notifier (struct padata_instance *pinst, struct notifier_block *nblock)
 
 EXPORT_SYMBOL (padata_unregister_cpumask_notifier)
 
int padata_set_cpumasks (struct padata_instance *pinst, cpumask_var_t pcpumask, cpumask_var_t cbcpumask)
 
 EXPORT_SYMBOL (padata_set_cpumasks)
 
int padata_set_cpumask (struct padata_instance *pinst, int cpumask_type, cpumask_var_t cpumask)
 
 EXPORT_SYMBOL (padata_set_cpumask)
 
int padata_add_cpu (struct padata_instance *pinst, int cpu, int mask)
 
 EXPORT_SYMBOL (padata_add_cpu)
 
int padata_remove_cpu (struct padata_instance *pinst, int cpu, int mask)
 
 EXPORT_SYMBOL (padata_remove_cpu)
 
int padata_start (struct padata_instance *pinst)
 
 EXPORT_SYMBOL (padata_start)
 
void padata_stop (struct padata_instance *pinst)
 
 EXPORT_SYMBOL (padata_stop)
 
 PADATA_ATTR_RW (serial_cpumask, show_cpumask, store_cpumask)
 
 PADATA_ATTR_RW (parallel_cpumask, show_cpumask, store_cpumask)
 
struct padata_instancepadata_alloc_possible (struct workqueue_struct *wq)
 
 EXPORT_SYMBOL (padata_alloc_possible)
 
struct padata_instancepadata_alloc (struct workqueue_struct *wq, const struct cpumask *pcpumask, const struct cpumask *cbcpumask)
 
 EXPORT_SYMBOL (padata_alloc)
 
void padata_free (struct padata_instance *pinst)
 
 EXPORT_SYMBOL (padata_free)
 

Macro Definition Documentation

#define attr2pentry (   _attr)    container_of(_attr, struct padata_sysfs_entry, attr)

Definition at line 906 of file padata.c.

#define kobj2pinst (   _kobj)    container_of(_kobj, struct padata_instance, kobj)

Definition at line 904 of file padata.c.

#define MAX_OBJ_NUM   1000

Definition at line 34 of file padata.c.

#define PADATA_ATTR_RO (   _name,
  _show_name 
)
Value:
static struct padata_sysfs_entry _name##_attr = \
__ATTR(_name, 0400, _show_name, NULL)

Definition at line 975 of file padata.c.

#define PADATA_ATTR_RW (   _name,
  _show_name,
  _store_name 
)
Value:
static struct padata_sysfs_entry _name##_attr = \
__ATTR(_name, 0644, _show_name, _store_name)

Definition at line 972 of file padata.c.

Function Documentation

EXPORT_SYMBOL ( padata_do_parallel  )
EXPORT_SYMBOL ( padata_do_serial  )
EXPORT_SYMBOL ( padata_register_cpumask_notifier  )
EXPORT_SYMBOL ( padata_set_cpumasks  )
EXPORT_SYMBOL ( padata_set_cpumask  )
EXPORT_SYMBOL ( padata_add_cpu  )
EXPORT_SYMBOL ( padata_remove_cpu  )
EXPORT_SYMBOL ( padata_start  )
EXPORT_SYMBOL ( padata_stop  )
EXPORT_SYMBOL ( padata_alloc_possible  )
EXPORT_SYMBOL ( padata_alloc  )
EXPORT_SYMBOL ( padata_free  )
int padata_add_cpu ( struct padata_instance pinst,
int  cpu,
int  mask 
)

padata_add_cpu - add a cpu to one or both(parallel and serial) padata cpumasks.

: padata instance : cpu to add : bitmask of flags specifying to which cpumask shuld be added. The may be any combination of the following flags: PADATA_CPU_SERIAL - serial cpumask PADATA_CPU_PARALLEL - parallel cpumask

Definition at line 711 of file padata.c.

struct padata_instance* padata_alloc ( struct workqueue_struct wq,
const struct cpumask pcpumask,
const struct cpumask cbcpumask 
)
read

padata_alloc - allocate and initialize a padata instance and specify cpumasks for serial and parallel workers.

: workqueue to use for the allocated padata instance : cpumask that will be used for padata parallelization : cpumask that will be used for padata serialization

Definition at line 1055 of file padata.c.

struct padata_instance* padata_alloc_possible ( struct workqueue_struct wq)
read

padata_alloc_possible - Allocate and initialize padata instance. Use the cpu_possible_mask for serial and parallel workers.

: workqueue to use for the allocated padata instance

Definition at line 1041 of file padata.c.

PADATA_ATTR_RW ( serial_cpumask  ,
show_cpumask  ,
store_cpumask   
)
PADATA_ATTR_RW ( parallel_cpumask  ,
show_cpumask  ,
store_cpumask   
)
int padata_do_parallel ( struct padata_instance pinst,
struct padata_priv padata,
int  cb_cpu 
)

padata_do_parallel - padata parallelization function

: padata instance : object to be parallelized : cpu the serialization callback function will run on, must be in the serial cpumask of padata(i.e. cpumask.cbcpu).

The parallelization callback function will run with BHs off. Note: Every object which is parallelized by padata_do_parallel must be seen by padata_do_serial.

Definition at line 107 of file padata.c.

void padata_do_serial ( struct padata_priv padata)

padata_do_serial - padata serialization function

: object to be serialized.

padata_do_serial must be called for every parallelized object. The serialization callback function will run with BHs off.

Definition at line 330 of file padata.c.

void padata_free ( struct padata_instance pinst)

padata_free - free a padata instance

: padata instance to free

Definition at line 1120 of file padata.c.

int padata_register_cpumask_notifier ( struct padata_instance pinst,
struct notifier_block nblock 
)

padata_register_cpumask_notifier - Registers a notifier that will be called if either pcpu or cbcpu or both cpumasks change.

: A poineter to padata instance : A pointer to notifier block.

Definition at line 540 of file padata.c.

int padata_remove_cpu ( struct padata_instance pinst,
int  cpu,
int  mask 
)

padata_remove_cpu - remove a cpu from the one or both(serial and parallel) padata cpumasks.

: padata instance : cpu to remove : bitmask specifying from which cpumask should be removed The may be any combination of the following flags: PADATA_CPU_SERIAL - serial cpumask PADATA_CPU_PARALLEL - parallel cpumask

Definition at line 770 of file padata.c.

int padata_set_cpumask ( struct padata_instance pinst,
int  cpumask_type,
cpumask_var_t  cpumask 
)

padata_set_cpumask: Sets specified by cpumask to the value equivalent to .

: padata instance : PADATA_CPU_SERIAL or PADATA_CPU_PARALLEL corresponding to parallel and serial cpumasks respectively. : the cpumask to use

Definition at line 647 of file padata.c.

int padata_set_cpumasks ( struct padata_instance pinst,
cpumask_var_t  pcpumask,
cpumask_var_t  cbcpumask 
)

padata_set_cpumasks - Set both parallel and serial cpumasks. The first one is used by parallel workers and the second one by the wokers doing serialization.

: padata instance : the cpumask to use for parallel workers : the cpumsak to use for serial workers

Definition at line 620 of file padata.c.

int padata_start ( struct padata_instance pinst)

padata_start - start the parallel processing

: padata instance to start

Definition at line 799 of file padata.c.

void padata_stop ( struct padata_instance pinst)

padata_stop - stop the parallel processing

: padata instance to stop

Definition at line 821 of file padata.c.

int padata_unregister_cpumask_notifier ( struct padata_instance pinst,
struct notifier_block nblock 
)

padata_unregister_cpumask_notifier - Unregisters cpumask notifier registered earlier using padata_register_cpumask_notifier

: A pointer to data instance. : A pointer to notifier block.

Definition at line 555 of file padata.c.