From: george anzinger <george@mvista.com>
To: root@chaos.analogic.com
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: schedule() seems to have changed.
Date: Wed, 18 Apr 2001 09:25:46 -0700 [thread overview]
Message-ID: <3ADDC00A.2DFE366F@mvista.com> (raw)
In-Reply-To: <Pine.LNX.3.95.1010418102332.1771A-100000@chaos.analogic.com>
"Richard B. Johnson" wrote:
>
> It seems that the nature of schedule() has changed in recent
> kernels. I am trying to update my drivers to correspond to
> the latest changes. Here is an example:
>
> This waits for some hardware (interrupt sets flag), time-out in one
> second. This is in an ioctl(), i.e., user context:
>
> set_current_state(TASK_INTERRUPTIBLE);
> current->policy = SCHED_YIELD;
> timer = jiffies + HZ;
> while(time_before(jiffies, timer))
> {
> if(flag) break;
> schedule();
> }
> set_current_state(TASK_RUNNING);
>
> The problem is that schedule() never returns!!! If I use
> schedule_timeout(1), it returns, but the granularity
> of the timeout interval is such that it slows down the
> driver (0.1 ms).
>
> So, is there something that I'm not doing that is preventing
> schedule() from returning? It returns on a user-interrupt (^C),
> but otherwise gives control to the kernel forever.
>
When schedule() is entered with TASK_INTERRUPTIBLE (actually with
current state !=TASK_RUNNING) it takes the task out of the run_list. It
has been this way for a long time. The normal way for the task to move
back to the run_list is for wake_up to be called, which, of course (^C)
does. In your case it would be best if you could get what ever sets
"flag" to call wake_up.
If what you really want to do is to spin in a SCHED_YIELD waiting for
"flag" you need to a.) move the setting of SCHED_YIELD inside the while,
and b.) eliminate the setting of current_state (both of them).
George
next prev parent reply other threads:[~2001-04-18 16:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-18 14:26 schedule() seems to have changed Richard B. Johnson
2001-04-18 16:25 ` george anzinger [this message]
2001-04-18 16:44 ` Richard B. Johnson
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=3ADDC00A.2DFE366F@mvista.com \
--to=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=root@chaos.analogic.com \
/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 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.