public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Hari LKML <hari.lkml@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Help in understanding the tasklets
Date: Thu, 24 Jun 2010 00:02:39 +0200	[thread overview]
Message-ID: <4C22847F.80109@gmail.com> (raw)
In-Reply-To: <AANLkTil7YgW3eQZ-WQ3R8k2OowZt491boAuxjPe18oFy@mail.gmail.com>

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

      reply	other threads:[~2010-06-23 22:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-19 18:36 Help in understanding the tasklets Hari LKML
2010-06-23 22:02 ` Jiri Slaby [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C22847F.80109@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=hari.lkml@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox