2 Tasklet的组织形式
2.1 tasklet_struct定义
tasklet由tasklet_struct结构表示。每个结构体单独代表一个tasklet,它在中定义:
260/* Tasklets --- multithreaded analogue of BHs.
262 Main feature differing them of generic softirqs: tasklet is running only on one CPU simultaneously.
265 Main feature differing them of BHs: different tasklets may be run simultaneously on different CPUs.
268 Properties:
269 * If tasklet_schedule() is called, then tasklet is guaranteed to be executed on some cpu at least once after this.
271 * If the tasklet is already scheduled, but its excecution is still not
272 started, it will be executed only once.
273 * If this tasklet is already running on another CPU (or schedule is called
274 from tasklet itself), it is rescheduled for later.
275 * Tasklet is strictly serialized wrt itself, but not wrt another tasklets. If client needs some intertask synchronization, he makes it with spinlocks.
278 */
280struct tasklet_struct
281{
282 struct tasklet_struct *next;
283 unsigned long state;
284 atomic_t count;
285 void (*func)(unsigned long);
286 unsigned long data;
287};
next:链表中的下一个tasklet;
state:tasklet的状态;
count:引用计数器;
func:tasklet处理函数;
data:给tasklet处理函数的参数