Hi,

I read from ULK about the value of "TASKLET_STATE_RUN" for tasklet:
==

TASKLET_STATE_RUN

When set, this indicates that the tasklet is being executed; on a
uniprocessor system this flag is not used because there is no need to check
whether a specific tasklet is running.

In multiprocessor systems, checks the TASKLET_STATE_RUN flag of the tasklet.

   -

   If it is set, a tasklet of the same type is already running on another
   CPU, so the function reinserts the task descriptor in the list pointed to by
   tasklet_vec[n] or tasklet_hi_vec[n] and activates the TASKLET_SOFTIRQ or
   HI_SOFTIRQ softirq again. In this way, execution of the tasklet is
   deferred until no other tasklets of the same type are running on other CPUs.

==
Each tasklet is defined as a tasklet_struct which is linked into perCPU list
"tasklet_vec[NR_CPUS]".

My question is:  One tasklet is “attached” to ONE CPU(since one tasklet is
put into ONE perCPU tasklet_struct list). And looks tasklet_action() only
handle tasklet_struct list of local CPU. So how could there be a chance for
this tasklet to be executed at another CPU? ?

     299 struct tasklet_struct

    300 {

    301    struct tasklet_struct *next;

    302    unsigned long state;               // tasklet state sched/run

    303    atomic_t count;                     //lock

    304    void (*func)(unsigned long);

    305    unsigned long data;

    306 };


Puzzling,
Simon

Reply via email to