From: p.ittershagen@googlemail.com (Philipp Ittershagen)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Hung Task Timeout
Date: Tue, 17 Apr 2012 14:46:00 +0200 [thread overview]
Message-ID: <CAC157GCZgMSr1G+e_tM1Jb6CyK4StM5RS8GAQGgYBaRBBK=66g@mail.gmail.com> (raw)
In-Reply-To: <CAB+TZU-=RfoBa4T209KEJzDqVD842GnA_57-XMnrg2iLAPaSSg@mail.gmail.com>
Mani,
On Tue, Apr 17, 2012 at 1:35 PM, mani <manishrma@gmail.com> wrote:
> Thanks Philipp for the explanation and the link.
>
> But i Still have the same question:-
>
> Do scheduler schedule the tasks with TASK_INTERRUPTIBLE state ?
> As i know TASK_UNINTERRUPTIBLE & TASK_INTERRUPTIBLE? both are not in the run
> queue
> and so both type of tasks should not being scheduled by the scheduler.
> If YES, then why it is needed to schedule task in TASK_INTERRUPTIBLE state ?
think of a signal as a software interrupt. If your thread is in the
TASK_INTERRUPTIBLE state, it can be woken up by such software
interrupt handlers in order to deliver the signal to your thread. Your
thread will then be put into the runqueue ( and state will be
TASK_RUNNING) and your wait_event_interruptible() call will return
with the value -ERESTARTSYS. This is for you to be able to react to
the delivered signal (you can read the active signals using
signal_pending(current)). So, to answer your question: Yes, your
thread will be put back into the runqueue, if you mark it as
TASK_INTERRUPTIBLE and a signal is delivered to your thread. Your
thread will _not_ be interrupted by software interrupts/signals when
you mark it as TASK_UNINTERRUPTIBLE.
> What is the significance of the task->switch_count in the scheduler ?
> surely it got updated for the TASK_INTERRUPTIBLE task.
> [kernel/hung_task.c]check_hung_task()
You can see in the same source file that check_hung_task() is called
by check_hung_uninterruptible_tasks(). But the function
check_hung_task() is only called for tasks which are in the state
TASK_UNINTERRUPTIBLE:
if (t->state == TASK_UNINTERRUPTIBLE)
check_hung_task(t, timeout);
The t->last_switch_count counts the number of switches since the last
call to check_hung_task() (the value is only updated there).
I hope this answers your questions.
Greetings,
Philipp
next prev parent reply other threads:[~2012-04-17 12:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-17 4:26 Hung Task Timeout mani
2012-04-17 7:36 ` Philipp Ittershagen
2012-04-17 11:35 ` mani
2012-04-17 12:46 ` Philipp Ittershagen [this message]
2012-04-18 7:31 ` mani
2012-04-18 8:14 ` Philipp Ittershagen
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='CAC157GCZgMSr1G+e_tM1Jb6CyK4StM5RS8GAQGgYBaRBBK=66g@mail.gmail.com' \
--to=p.ittershagen@googlemail.com \
--cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).