All of lore.kernel.org
 help / color / mirror / Atom feed
* Help in understanding the tasklets
@ 2010-06-19 18:36 Hari LKML
  2010-06-23 22:02 ` Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Hari LKML @ 2010-06-19 18:36 UTC (permalink / raw)
  To: linux-kernel

After reading some of the books and the codes here is my understanding
about the tasklet_action function

the function statrs some thing like this

1. If the tasklet is not running in another processor set the Bit
TASKLET_STATE_RUN;     <<if (tasklet_trylock(t))>>
2. clear the TASKLET_STATE_SCHED bit;       <<if (!test_and_clear_bit(TASKLET_
STATE_SCHED, &t->state))>>
3. start the tasklet     <<(    t->func(t->data))>>


Now when the tasklets function is running and the same interrupt is
raised again but now handled by a different processor (in a SMP
system) the tasklet is now scheduled in a different processor (because
the TASKLET_STATE_SCHED is already cleared in step 2)
and there are every chance of the same type of  taklet running
concurently in different processors thus braking the promise that same
types of tasklets do not ever run simultaniously.

I think i have misunderstood one or the other concept so please
correct me and help me in understanding the Linux Kernel code more
clearly.


Please personally CC me all answers/comments posted to the list, to my
mail id hari.lkml@gmail.com.

Hari

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Help in understanding the tasklets
  2010-06-19 18:36 Help in understanding the tasklets Hari LKML
@ 2010-06-23 22:02 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2010-06-23 22:02 UTC (permalink / raw)
  To: Hari LKML; +Cc: linux-kernel

On 06/19/2010 08:36 PM, Hari LKML wrote:
> After reading some of the books and the codes here is my understanding
> about the tasklet_action function
> 
> the function statrs some thing like this
> 
> 1. If the tasklet is not running in another processor set the Bit
> TASKLET_STATE_RUN;     <<if (tasklet_trylock(t))>>
> 2. clear the TASKLET_STATE_SCHED bit;       <<if (!test_and_clear_bit(TASKLET_
> STATE_SCHED, &t->state))>>
> 3. start the tasklet     <<(    t->func(t->data))>>
> 
> 
> Now when the tasklets function is running and the same interrupt is
> raised again but now handled by a different processor (in a SMP
> system) the tasklet is now scheduled in a different processor (because
> the TASKLET_STATE_SCHED is already cleared in step 2)
> and there are every chance of the same type of  taklet running
> concurently in different processors thus braking the promise that same
> types of tasklets do not ever run simultaniously.
> 
> I think i have misunderstood one or the other concept so please
> correct me and help me in understanding the Linux Kernel code more
> clearly.

But tasklet_trylock will return 0 when t->func is running on another
processor already because of step 1. Thus the tasklet gets to the end of
the tasklet list and is tried again later.

-- 
js

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-23 22:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-19 18:36 Help in understanding the tasklets Hari LKML
2010-06-23 22:02 ` Jiri Slaby

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.