From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [patch 12/27] set TASK_RUNNING in cond_resched()
Date: Thu, 04 Jul 2002 16:54:26 -0700 [thread overview]
Message-ID: <3D24E032.F0793112@zip.com.au> (raw)
do_select() does set_current_state(TASK_INTERRUPTIBLE) then calls
__pollwait() which calls __get_free_page() and the cond_resched() which
I added to the pagecache reclaim code never returns.
The patch makes cond_resched() more useful by setting current->state to
TASK_RUNNING before scheduling.
include/linux/sched.h | 3 ++-
kernel/ksyms.c | 1 +
kernel/sched.c | 6 ++++++
3 files changed, 9 insertions(+), 1 deletion(-)
--- 2.5.24/include/linux/sched.h~cond_resched-fix Thu Jul 4 16:17:17 2002
+++ 2.5.24-akpm/include/linux/sched.h Thu Jul 4 16:22:11 2002
@@ -837,10 +837,11 @@ static inline int need_resched(void)
return unlikely(test_thread_flag(TIF_NEED_RESCHED));
}
+extern void __cond_resched(void);
static inline void cond_resched(void)
{
if (need_resched())
- schedule();
+ __cond_resched();
}
/* Reevaluate whether the task has signals pending delivery.
--- 2.5.24/kernel/sched.c~cond_resched-fix Thu Jul 4 16:17:17 2002
+++ 2.5.24-akpm/kernel/sched.c Thu Jul 4 16:22:11 2002
@@ -1447,6 +1447,12 @@ asmlinkage long sys_sched_yield(void)
return 0;
}
+void __cond_resched(void)
+{
+ set_current_state(TASK_RUNNING);
+ schedule();
+}
+
asmlinkage long sys_sched_get_priority_max(int policy)
{
int ret = -EINVAL;
--- 2.5.24/kernel/ksyms.c~cond_resched-fix Thu Jul 4 16:17:17 2002
+++ 2.5.24-akpm/kernel/ksyms.c Thu Jul 4 16:22:11 2002
@@ -473,6 +473,7 @@ EXPORT_SYMBOL(preempt_schedule);
#endif
EXPORT_SYMBOL(schedule_timeout);
EXPORT_SYMBOL(sys_sched_yield);
+EXPORT_SYMBOL(__cond_resched);
EXPORT_SYMBOL(set_user_nice);
EXPORT_SYMBOL(task_nice);
EXPORT_SYMBOL_GPL(idle_cpu);
-
reply other threads:[~2002-07-04 23:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3D24E032.F0793112@zip.com.au \
--to=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox