* [-mm PATCH 0/32] fix-up schedule_timeout() usage
@ 2005-08-15 18:05 Nishanth Aravamudan
2005-08-15 18:06 ` [-mm PATCH 1/32] include: update jiffies/{m,u}secs conversion functions Nishanth Aravamudan
` (8 more replies)
0 siblings, 9 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:05 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
Hello Andrew,
Sorry for the lack of a combined To:/Cc: list, but it would have been
excessive if I included everyone (I won't send all of the patches to
LKML, unless there is no other list entry in MAINTAINERS - I think that
is only 9 out of the 32 patches :)
Andrew recently added schedule_timeout_interruptible() and
schedule_timeout_uninterruptible() to the -mm tree, as
schedule_timeout() called without the state set results in an immediate
return; thus, it makes little sense to ever call it that way. Almost all
the kernel invocations of schedule_timeout(), additionally, follow:
set_current_state(TASK_{,UN}INTERRUPTIBLE);
schedule_timeout(some_value_in_jiffies);
Andrew pointed out that creating non-inline wrappers for this common
usage should reduce the kernel size. The following 32 patches (split up
by directory/subsystem) convert the schedule_timeout() callers in
2.6.13-rc5-mm1, where appropriate.
Here's the list of patches as I split them up:
01/32: include/
02/32: fs/
03/32: kernel/
04/32: mm/
05/32: net/
06/32: sound/
07/32: arch/alpha
08/32: arch/i386
09/32: arch/ia64
10/32: arch/m68k
11/32: arch/mips
12/32: arch/ppc
13/32: arch/ppc64
14/32: arch/um
15/32: drivers/acpi
16/32: drivers/block
17/32: drivers/cdrom
18/32: drivers/char
19/32: drivers/dlm
20/32: drivers/net
21/32: drivers/ieee1394
22/32: drivers/isdn
23/32: drivers/macintosh
24/32: drivers/md
25/32: drivers/media
26/32: drivers/message
27/32: drivers/parport
28/32: drivers/sbus
29/32: drivers/scsi
30/32: drivers/serial
31/32: drivers/telephony
32/32: drivers/usb
Thanks,
Nish
^ permalink raw reply [flat|nested] 16+ messages in thread
* [-mm PATCH 1/32] include: update jiffies/{m,u}secs conversion functions
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
@ 2005-08-15 18:06 ` Nishanth Aravamudan
2005-08-17 23:35 ` Andrew Morton
2005-08-15 18:08 ` [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage Nishanth Aravamudan
` (7 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:06 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
Description: Clarify the human-time units to jiffies conversion
functions by using the constants in time.h. This makes many of the
subsequent patches direct copies of the current code.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
include/linux/jiffies.h | 40 ++++++++++++++++++++--------------------
include/linux/time.h | 4 ++++
2 files changed, 24 insertions(+), 20 deletions(-)
--- 2.6.13-rc5-mm1/include/linux/time.h 2005-03-01 23:38:12.000000000 -0800
+++ 2.6.13-rc5-mm1-dev/include/linux/time.h 2005-08-14 12:53:17.000000000 -0700
@@ -28,6 +28,10 @@ struct timezone {
#ifdef __KERNEL__
/* Parameters used to convert the timespec values */
+#ifndef MSEC_PER_SEC
+#define MSEC_PER_SEC (1000L)
+#endif
+
#ifndef USEC_PER_SEC
#define USEC_PER_SEC (1000000L)
#endif
diff -urpN 2.6.13-rc5-mm1/include/linux/jiffies.h 2.6.13-rc5-mm1-dev/include/linux/jiffies.h
--- 2.6.13-rc5-mm1/include/linux/jiffies.h 2005-03-01 23:37:31.000000000 -0800
+++ 2.6.13-rc5-mm1-dev/include/linux/jiffies.h 2005-08-10 23:31:04.000000000 -0700
@@ -254,23 +254,23 @@ static inline u64 get_jiffies_64(void)
*/
static inline unsigned int jiffies_to_msecs(const unsigned long j)
{
-#if HZ <= 1000 && !(1000 % HZ)
- return (1000 / HZ) * j;
-#elif HZ > 1000 && !(HZ % 1000)
- return (j + (HZ / 1000) - 1)/(HZ / 1000);
+#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
+ return (MSEC_PER_SEC / HZ) * j;
+#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
+ return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
#else
- return (j * 1000) / HZ;
+ return (j * MSEC_PER_SEC) / HZ;
#endif
}
static inline unsigned int jiffies_to_usecs(const unsigned long j)
{
-#if HZ <= 1000000 && !(1000000 % HZ)
- return (1000000 / HZ) * j;
-#elif HZ > 1000000 && !(HZ % 1000000)
- return (j + (HZ / 1000000) - 1)/(HZ / 1000000);
+#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
+ return (USEC_PER_SEC / HZ) * j;
+#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
+ return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC);
#else
- return (j * 1000000) / HZ;
+ return (j * USEC_PER_SEC) / HZ;
#endif
}
@@ -278,12 +278,12 @@ static inline unsigned long msecs_to_jif
{
if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
-#if HZ <= 1000 && !(1000 % HZ)
- return (m + (1000 / HZ) - 1) / (1000 / HZ);
-#elif HZ > 1000 && !(HZ % 1000)
- return m * (HZ / 1000);
+#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
+ return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
+#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
+ return m * (HZ / MSEC_PER_SEC);
#else
- return (m * HZ + 999) / 1000;
+ return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC;
#endif
}
@@ -291,12 +291,12 @@ static inline unsigned long usecs_to_jif
{
if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET))
return MAX_JIFFY_OFFSET;
-#if HZ <= 1000000 && !(1000000 % HZ)
- return (u + (1000000 / HZ) - 1) / (1000000 / HZ);
-#elif HZ > 1000000 && !(HZ % 1000000)
- return u * (HZ / 1000000);
+#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
+ return (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ);
+#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
+ return u * (HZ / USEC_PER_SEC);
#else
- return (u * HZ + 999999) / 1000000;
+ return (u * HZ + USEC_PER_SEC - 1) / USEC_PER_SEC;
#endif
}
^ permalink raw reply [flat|nested] 16+ messages in thread
* [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
2005-08-15 18:06 ` [-mm PATCH 1/32] include: update jiffies/{m,u}secs conversion functions Nishanth Aravamudan
@ 2005-08-15 18:08 ` Nishanth Aravamudan
2005-08-15 18:17 ` [xfs-masters] " Christoph Hellwig
2005-08-15 18:37 ` Stephen C. Tweedie
2005-08-15 18:08 ` [-mm PATCH 3/32] kernel: " Nishanth Aravamudan
` (6 subsequent siblings)
8 siblings, 2 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:08 UTC (permalink / raw)
To: sfrench, sct, okir, trond.myklebust, reiserfs-dev, urban,
xfs-masters, nathans
Cc: akpm, samba-technical, linux-kernel, reiserfs-list, samba,
linux-xfs
Description: Use schedule_timeout_{,un}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size. Also use
helper functions to convert between human time units and jiffies rather
than constant HZ division to avoid rounding errors.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
fs/cifs/cifsfs.c | 7 ++-----
fs/cifs/connect.c | 6 ++----
fs/jbd/transaction.c | 3 +--
fs/lockd/clntproc.c | 3 +--
fs/nfs/nfs3proc.c | 3 +--
fs/nfs/nfs4proc.c | 12 ++++--------
fs/reiserfs/journal.c | 3 +--
fs/smbfs/proc.c | 3 +--
fs/xfs/linux-2.6/time.h | 3 +--
fs/xfs/linux-2.6/xfs_buf.c | 6 +++---
fs/xfs/linux-2.6/xfs_super.c | 12 ++++++------
11 files changed, 23 insertions(+), 38 deletions(-)
diff -urpN 2.6.13-rc5-mm1/fs/cifs/cifsfs.c 2.6.13-rc5-mm1-dev/fs/cifs/cifsfs.c
--- 2.6.13-rc5-mm1/fs/cifs/cifsfs.c 2005-08-07 09:57:37.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/fs/cifs/cifsfs.c 2005-08-10 15:03:11.000000000 -0700
@@ -781,14 +781,11 @@ static int cifs_oplock_thread(void * dum
oplockThread = current;
do {
- set_current_state(TASK_INTERRUPTIBLE);
-
- schedule_timeout(1*HZ);
+ schedule_timeout_interruptible(1*HZ);
spin_lock(&GlobalMid_Lock);
if(list_empty(&GlobalOplock_Q)) {
spin_unlock(&GlobalMid_Lock);
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(39*HZ);
+ schedule_timeout_interruptible(39*HZ);
} else {
oplock_item = list_entry(GlobalOplock_Q.next,
struct oplock_q_entry, qhead);
diff -urpN 2.6.13-rc5-mm1/fs/cifs/connect.c 2.6.13-rc5-mm1-dev/fs/cifs/connect.c
--- 2.6.13-rc5-mm1/fs/cifs/connect.c 2005-08-07 10:05:22.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/fs/cifs/connect.c 2005-08-12 13:42:49.000000000 -0700
@@ -3215,10 +3215,8 @@ cifs_umount(struct super_block *sb, stru
}
cifs_sb->tcon = NULL;
- if (ses) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ / 2);
- }
+ if (ses)
+ schedule_timeout_interruptible(msecs_to_jiffies(500));
if (ses)
sesInfoFree(ses);
diff -urpN 2.6.13-rc5-mm1/fs/jbd/transaction.c 2.6.13-rc5-mm1-dev/fs/jbd/transaction.c
--- 2.6.13-rc5-mm1/fs/jbd/transaction.c 2005-08-07 10:05:22.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/fs/jbd/transaction.c 2005-08-10 15:03:33.000000000 -0700
@@ -1340,8 +1340,7 @@ int journal_stop(handle_t *handle)
if (handle->h_sync) {
do {
old_handle_count = transaction->t_handle_count;
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_uninterruptible(1);
} while (old_handle_count != transaction->t_handle_count);
}
diff -urpN 2.6.13-rc5-mm1/fs/lockd/clntproc.c 2.6.13-rc5-mm1-dev/fs/lockd/clntproc.c
--- 2.6.13-rc5-mm1/fs/lockd/clntproc.c 2005-08-07 09:58:15.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/fs/lockd/clntproc.c 2005-08-10 15:03:41.000000000 -0700
@@ -299,8 +299,7 @@ nlmclnt_alloc_call(void)
return call;
}
printk("nlmclnt_alloc_call: failed, waiting for memory\n");
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(5*HZ);
+ schedule_timeout_interruptible(5*HZ);
}
return NULL;
}
diff -urpN 2.6.13-rc5-mm1/fs/nfs/nfs3proc.c 2.6.13-rc5-mm1-dev/fs/nfs/nfs3proc.c
--- 2.6.13-rc5-mm1/fs/nfs/nfs3proc.c 2005-08-07 09:58:15.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/fs/nfs/nfs3proc.c 2005-08-10 15:12:50.000000000 -0700
@@ -34,8 +34,7 @@ nfs3_rpc_wrapper(struct rpc_clnt *clnt,
res = rpc_call_sync(clnt, msg, flags);
if (res != -EJUKEBOX)
break;
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(NFS_JUKEBOX_RETRY_TIME);
+ schedule_timeout_interruptible(NFS_JUKEBOX_RETRY_TIME);
res = -ERESTARTSYS;
} while (!signalled());
rpc_clnt_sigunmask(clnt, &oldset);
diff -urpN 2.6.13-rc5-mm1/fs/nfs/nfs4proc.c 2.6.13-rc5-mm1-dev/fs/nfs/nfs4proc.c
--- 2.6.13-rc5-mm1/fs/nfs/nfs4proc.c 2005-08-07 09:58:15.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/fs/nfs/nfs4proc.c 2005-08-10 15:15:04.000000000 -0700
@@ -2412,14 +2412,11 @@ static int nfs4_delay(struct rpc_clnt *c
*timeout = NFS4_POLL_RETRY_MAX;
rpc_clnt_sigmask(clnt, &oldset);
if (clnt->cl_intr) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(*timeout);
+ schedule_timeout_interruptible(*timeout);
if (signalled())
res = -ERESTARTSYS;
- } else {
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(*timeout);
- }
+ } else
+ schedule_timeout_uninterruptible(*timeout);
rpc_clnt_sigunmask(clnt, &oldset);
*timeout <<= 1;
return res;
@@ -2572,8 +2569,7 @@ int nfs4_proc_delegreturn(struct inode *
static unsigned long
nfs4_set_lock_task_retry(unsigned long timeout)
{
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(timeout);
+ schedule_timeout_interruptible(timeout);
timeout <<= 1;
if (timeout > NFS4_LOCK_MAXTIMEOUT)
return NFS4_LOCK_MAXTIMEOUT;
diff -urpN 2.6.13-rc5-mm1/fs/reiserfs/journal.c 2.6.13-rc5-mm1-dev/fs/reiserfs/journal.c
--- 2.6.13-rc5-mm1/fs/reiserfs/journal.c 2005-08-07 10:05:22.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/fs/reiserfs/journal.c 2005-08-10 15:15:11.000000000 -0700
@@ -2868,8 +2868,7 @@ static void let_transaction_grow(struct
struct reiserfs_journal *journal = SB_JOURNAL(sb);
unsigned long bcount = journal->j_bcount;
while (1) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_uninterruptible(1);
journal->j_current_jl->j_state |= LIST_COMMIT_PENDING;
while ((atomic_read(&journal->j_wcount) > 0 ||
atomic_read(&journal->j_jlock)) &&
diff -urpN 2.6.13-rc5-mm1/fs/smbfs/proc.c 2.6.13-rc5-mm1-dev/fs/smbfs/proc.c
--- 2.6.13-rc5-mm1/fs/smbfs/proc.c 2005-03-01 23:37:49.000000000 -0800
+++ 2.6.13-rc5-mm1-dev/fs/smbfs/proc.c 2005-08-12 13:43:10.000000000 -0700
@@ -2397,8 +2397,7 @@ smb_proc_readdir_long(struct file *filp,
if (req->rq_rcls == ERRSRV && req->rq_err == ERRerror) {
/* a damn Win95 bug - sometimes it clags if you
ask it too fast */
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(HZ/5);
+ schedule_timeout_interruptible(msecs_to_jiffies(200));
continue;
}
diff -urpN 2.6.13-rc5-mm1/fs/xfs/linux-2.6/time.h 2.6.13-rc5-mm1-dev/fs/xfs/linux-2.6/time.h
--- 2.6.13-rc5-mm1/fs/xfs/linux-2.6/time.h 2005-03-01 23:38:33.000000000 -0800
+++ 2.6.13-rc5-mm1-dev/fs/xfs/linux-2.6/time.h 2005-08-10 15:15:43.000000000 -0700
@@ -39,8 +39,7 @@ typedef struct timespec timespec_t;
static inline void delay(long ticks)
{
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(ticks);
+ schedule_timeout_uninterruptible(ticks);
}
static inline void nanotime(struct timespec *tvp)
diff -urpN 2.6.13-rc5-mm1/fs/xfs/linux-2.6/xfs_buf.c 2.6.13-rc5-mm1-dev/fs/xfs/linux-2.6/xfs_buf.c
--- 2.6.13-rc5-mm1/fs/xfs/linux-2.6/xfs_buf.c 2005-08-07 09:58:15.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/fs/xfs/linux-2.6/xfs_buf.c 2005-08-12 13:44:19.000000000 -0700
@@ -1778,10 +1778,10 @@ xfsbufd(
xfsbufd_force_sleep = 0;
}
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout((xfs_buf_timer_centisecs * HZ) / 100);
+ schedule_timeout_interruptible
+ (xfs_buf_timer_centisecs * msecs_to_jiffies(10));
- age = (xfs_buf_age_centisecs * HZ) / 100;
+ age = xfs_buf_age_centisecs * msecs_to_jiffies(10);
spin_lock(&pbd_delwrite_lock);
list_for_each_entry_safe(pb, n, &pbd_delwrite_queue, pb_list) {
PB_TRACE(pb, "walkq1", (long)pagebuf_ispin(pb));
diff -urpN 2.6.13-rc5-mm1/fs/xfs/linux-2.6/xfs_super.c 2.6.13-rc5-mm1-dev/fs/xfs/linux-2.6/xfs_super.c
--- 2.6.13-rc5-mm1/fs/xfs/linux-2.6/xfs_super.c 2005-08-07 09:58:15.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/fs/xfs/linux-2.6/xfs_super.c 2005-08-12 13:47:02.000000000 -0700
@@ -416,7 +416,7 @@ xfs_flush_inode(
igrab(inode);
xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work);
- delay(HZ/2);
+ delay(msecs_to_jiffies(500));
}
/*
@@ -441,7 +441,7 @@ xfs_flush_device(
igrab(inode);
xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work);
- delay(HZ/2);
+ delay(msecs_to_jiffies(500));
xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
}
@@ -478,10 +478,9 @@ xfssyncd(
wake_up(&vfsp->vfs_wait_sync_task);
INIT_LIST_HEAD(&tmp);
- timeleft = (xfs_syncd_centisecs * HZ) / 100;
+ timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10);
for (;;) {
- set_current_state(TASK_INTERRUPTIBLE);
- timeleft = schedule_timeout(timeleft);
+ timeleft = schedule_timeout_interruptible(timeleft);
/* swsusp */
try_to_freeze();
if (vfsp->vfs_flag & VFS_UMOUNT)
@@ -495,7 +494,8 @@ xfssyncd(
*/
if (!timeleft || list_empty(&vfsp->vfs_sync_list)) {
if (!timeleft)
- timeleft = (xfs_syncd_centisecs * HZ) / 100;
+ timeleft = xfs_syncd_centisecs *
+ msecs_to_jiffies(10);
INIT_LIST_HEAD(&vfsp->vfs_sync_work.w_list);
list_add_tail(&vfsp->vfs_sync_work.w_list,
&vfsp->vfs_sync_list);
^ permalink raw reply [flat|nested] 16+ messages in thread
* [-mm PATCH 3/32] kernel: fix-up schedule_timeout() usage
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
2005-08-15 18:06 ` [-mm PATCH 1/32] include: update jiffies/{m,u}secs conversion functions Nishanth Aravamudan
2005-08-15 18:08 ` [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage Nishanth Aravamudan
@ 2005-08-15 18:08 ` Nishanth Aravamudan
2005-08-15 18:09 ` [-mm PATCH 4/32] mm: " Nishanth Aravamudan
` (5 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:08 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
Description: Use schedule_timeout_{,un}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
kernel/compat.c | 9 +++------
kernel/signal.c | 3 +--
kernel/timer.c | 18 ++++++------------
3 files changed, 10 insertions(+), 20 deletions(-)
diff -urpN 2.6.13-rc5-mm1/kernel/compat.c 2.6.13-rc5-mm1-dev/kernel/compat.c
--- 2.6.13-rc5-mm1/kernel/compat.c 2005-08-07 09:57:38.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/kernel/compat.c 2005-08-10 15:21:46.000000000 -0700
@@ -48,8 +48,7 @@ static long compat_nanosleep_restart(str
if (!time_after(expire, now))
return 0;
- current->state = TASK_INTERRUPTIBLE;
- expire = schedule_timeout(expire - now);
+ expire = schedule_timeout_interruptible(expire - now);
if (expire == 0)
return 0;
@@ -82,8 +81,7 @@ asmlinkage long compat_sys_nanosleep(str
return -EINVAL;
expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);
- current->state = TASK_INTERRUPTIBLE;
- expire = schedule_timeout(expire);
+ expire = schedule_timeout_interruptible(expire);
if (expire == 0)
return 0;
@@ -795,8 +793,7 @@ compat_sys_rt_sigtimedwait (compat_sigse
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
- current->state = TASK_INTERRUPTIBLE;
- timeout = schedule_timeout(timeout);
+ timeout = schedule_timeout_interruptible(timeout);
spin_lock_irq(¤t->sighand->siglock);
sig = dequeue_signal(current, &s, &info);
diff -urpN 2.6.13-rc5-mm1/kernel/signal.c 2.6.13-rc5-mm1-dev/kernel/signal.c
--- 2.6.13-rc5-mm1/kernel/signal.c 2005-08-07 09:58:16.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/kernel/signal.c 2005-08-10 15:22:29.000000000 -0700
@@ -2228,8 +2228,7 @@ sys_rt_sigtimedwait(const sigset_t __use
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
- current->state = TASK_INTERRUPTIBLE;
- timeout = schedule_timeout(timeout);
+ timeout = schedule_timeout_interruptible(timeout);
try_to_freeze();
spin_lock_irq(¤t->sighand->siglock);
diff -urpN 2.6.13-rc5-mm1/kernel/timer.c 2.6.13-rc5-mm1-dev/kernel/timer.c
--- 2.6.13-rc5-mm1/kernel/timer.c 2005-08-07 10:05:22.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/kernel/timer.c 2005-08-10 15:23:18.000000000 -0700
@@ -1199,8 +1199,7 @@ static long __sched nanosleep_restart(st
if (!time_after(expire, now))
return 0;
- current->state = TASK_INTERRUPTIBLE;
- expire = schedule_timeout(expire - now);
+ expire = schedule_timeout_interruptible(expire - now);
ret = 0;
if (expire) {
@@ -1228,8 +1227,7 @@ asmlinkage long sys_nanosleep(struct tim
return -EINVAL;
expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);
- current->state = TASK_INTERRUPTIBLE;
- expire = schedule_timeout(expire);
+ expire = schedule_timeout_interruptible(expire);
ret = 0;
if (expire) {
@@ -1627,10 +1625,8 @@ void msleep(unsigned int msecs)
{
unsigned long timeout = msecs_to_jiffies(msecs) + 1;
- while (timeout) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- timeout = schedule_timeout(timeout);
- }
+ while (timeout)
+ timeout = schedule_timeout_uninterruptible(timeout);
}
EXPORT_SYMBOL(msleep);
@@ -1643,10 +1639,8 @@ unsigned long msleep_interruptible(unsig
{
unsigned long timeout = msecs_to_jiffies(msecs) + 1;
- while (timeout && !signal_pending(current)) {
- set_current_state(TASK_INTERRUPTIBLE);
- timeout = schedule_timeout(timeout);
- }
+ while (timeout && !signal_pending(current))
+ timeout = schedule_timeout_interruptible(timeout);
return jiffies_to_msecs(timeout);
}
^ permalink raw reply [flat|nested] 16+ messages in thread
* [-mm PATCH 4/32] mm: fix-up schedule_timeout() usage
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
` (2 preceding siblings ...)
2005-08-15 18:08 ` [-mm PATCH 3/32] kernel: " Nishanth Aravamudan
@ 2005-08-15 18:09 ` Nishanth Aravamudan
2005-08-15 18:18 ` [-mm PATCH 17/32] drivers/cdrom: " Nishanth Aravamudan
` (4 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:09 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
Description: Use schedule_timeout_{,un}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
mm/oom_kill.c | 3 +--
mm/swapfile.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff -urpN 2.6.13-rc5-mm1/mm/oom_kill.c 2.6.13-rc5-mm1-dev/mm/oom_kill.c
--- 2.6.13-rc5-mm1/mm/oom_kill.c 2005-08-07 09:58:16.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/mm/oom_kill.c 2005-08-10 15:23:34.000000000 -0700
@@ -290,6 +290,5 @@ retry:
* Give "p" a good chance of killing itself before we
* retry to allocate memory.
*/
- __set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_interruptible(1);
}
diff -urpN 2.6.13-rc5-mm1/mm/swapfile.c 2.6.13-rc5-mm1-dev/mm/swapfile.c
--- 2.6.13-rc5-mm1/mm/swapfile.c 2005-08-07 10:05:22.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/mm/swapfile.c 2005-08-10 15:23:41.000000000 -0700
@@ -1151,8 +1151,7 @@ asmlinkage long sys_swapoff(const char _
p->highest_bit = 0; /* cuts scans short */
while (p->flags >= SWP_SCANNING) {
spin_unlock(&swap_lock);
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_uninterruptible(1);
spin_lock(&swap_lock);
}
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [xfs-masters] [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage
2005-08-15 18:08 ` [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage Nishanth Aravamudan
@ 2005-08-15 18:17 ` Christoph Hellwig
2005-08-15 18:40 ` Nishanth Aravamudan
2005-08-15 18:37 ` Stephen C. Tweedie
1 sibling, 1 reply; 16+ messages in thread
From: Christoph Hellwig @ 2005-08-15 18:17 UTC (permalink / raw)
To: xfs-masters
Cc: sfrench, sct, okir, trond.myklebust, reiserfs-dev, urban, nathans,
akpm, samba-technical, linux-kernel, reiserfs-list, samba,
linux-xfs
On Mon, Aug 15, 2005 at 11:08:04AM -0700, Nishanth Aravamudan wrote:
> Description: Use schedule_timeout_{,un}interruptible() instead of
> set_current_state()/schedule_timeout() to reduce kernel size. Also use
> helper functions to convert between human time units and jiffies rather
> than constant HZ division to avoid rounding errors.
The XFS changes are still wrong for the same rason as last time,
we actually do want the daemons to do work if they're woken earlier
using wake_up_process.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [-mm PATCH 17/32] drivers/cdrom: fix-up schedule_timeout() usage
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
` (3 preceding siblings ...)
2005-08-15 18:09 ` [-mm PATCH 4/32] mm: " Nishanth Aravamudan
@ 2005-08-15 18:18 ` Nishanth Aravamudan
2005-08-15 18:19 ` [-mm PATCH 19/32] drivers/dlm: " Nishanth Aravamudan
` (3 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:18 UTC (permalink / raw)
To: axboe, emoenke; +Cc: akpm, linux-kernel
Description: Use schedule_timeout_{un,}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
drivers/cdrom/sbpcd.c | 3 +--
drivers/cdrom/sonycd535.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff -urpN 2.6.13-rc5-mm1/drivers/cdrom/sbpcd.c 2.6.13-rc5-mm1-dev/drivers/cdrom/sbpcd.c
--- 2.6.13-rc5-mm1/drivers/cdrom/sbpcd.c 2005-08-07 10:05:20.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/cdrom/sbpcd.c 2005-08-08 14:18:39.000000000 -0700
@@ -827,8 +827,7 @@ static void mark_timeout_audio(u_long i)
static void sbp_sleep(u_int time)
{
sti();
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(time);
+ schedule_interruptible_timeout(time);
sti();
}
/*==========================================================================*/
diff -urpN 2.6.13-rc5-mm1/drivers/cdrom/sonycd535.c 2.6.13-rc5-mm1-dev/drivers/cdrom/sonycd535.c
--- 2.6.13-rc5-mm1/drivers/cdrom/sonycd535.c 2005-08-07 09:57:49.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/cdrom/sonycd535.c 2005-08-12 13:30:50.000000000 -0700
@@ -1478,8 +1477,7 @@ static int __init sony535_init(void)
/* look for the CD-ROM, follows the procedure in the DOS driver */
inb(select_unit_reg);
/* wait for 40 18 Hz ticks (reverse-engineered from DOS driver) */
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout((HZ+17)*40/18);
+ schedule_timeout_interruptible((HZ+17)*40/18);
inb(result_reg);
outb(0, read_status_reg); /* does a reset? */
^ permalink raw reply [flat|nested] 16+ messages in thread
* [-mm PATCH 19/32] drivers/dlm: fix-up schedule_timeout() usage
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
` (4 preceding siblings ...)
2005-08-15 18:18 ` [-mm PATCH 17/32] drivers/cdrom: " Nishanth Aravamudan
@ 2005-08-15 18:19 ` Nishanth Aravamudan
2005-08-15 18:25 ` [-mm PATCH 26/32] message: " Nishanth Aravamudan
` (2 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:19 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
Description: Use schedule_timeout_interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
drivers/dlm/lockspace.c | 3 +--
1 files changed, 1 insertion(+), 2 deletions(-)
diff -urpN 2.6.13-rc5-mm1/drivers/dlm/lockspace.c 2.6.13-rc5-mm1-dev/drivers/dlm/lockspace.c
--- 2.6.13-rc5-mm1/drivers/dlm/lockspace.c 2005-08-07 10:05:20.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/dlm/lockspace.c 2005-08-08 14:34:39.000000000 -0700
@@ -54,8 +54,7 @@ static int dlm_scand(void *data)
while (!kthread_should_stop()) {
list_for_each_entry(ls, &lslist, ls_list)
dlm_scan_rsbs(ls);
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(dlm_config.scan_secs * HZ);
+ schedule_timeout_interruptible(dlm_config.scan_secs * HZ);
}
return 0;
}
^ permalink raw reply [flat|nested] 16+ messages in thread
* [-mm PATCH 26/32] message: fix-up schedule_timeout() usage
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
` (5 preceding siblings ...)
2005-08-15 18:19 ` [-mm PATCH 19/32] drivers/dlm: " Nishanth Aravamudan
@ 2005-08-15 18:25 ` Nishanth Aravamudan
2005-08-15 18:26 ` [-mm PATCH 28/32] drivers/sbus: " Nishanth Aravamudan
2005-08-15 18:29 ` [-mm PATCH 31/32] telephony: " Nishanth Aravamudan
8 siblings, 0 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:25 UTC (permalink / raw)
To: markus.lidel; +Cc: akpm, linux-kernel
Description: Use schedule_timeout_interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
drivers/message/fusion/mptlan.c | 10 ++++------
drivers/message/fusion/mptscsih.c | 6 ++----
drivers/message/i2o/iop.c | 15 +++++----------
3 files changed, 11 insertions(+), 20 deletions(-)
diff -urpN 2.6.13-rc5-mm1/drivers/message/fusion/mptlan.c 2.6.13-rc5-mm1-dev/drivers/message/fusion/mptlan.c
--- 2.6.13-rc5-mm1/drivers/message/fusion/mptlan.c 2005-08-07 09:57:59.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/message/fusion/mptlan.c 2005-08-08 15:49:30.000000000 -0700
@@ -506,7 +506,7 @@ mpt_lan_close(struct net_device *dev)
{
struct mpt_lan_priv *priv = netdev_priv(dev);
MPT_ADAPTER *mpt_dev = priv->mpt_dev;
- unsigned int timeout;
+ unsigned long timeout;
int i;
dlprintk((KERN_INFO MYNAM ": mpt_lan_close called\n"));
@@ -521,11 +521,9 @@ mpt_lan_close(struct net_device *dev)
mpt_lan_reset(dev);
- timeout = 2 * HZ;
- while (atomic_read(&priv->buckets_out) && --timeout) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
+ timeout = jiffies + 2 * HZ;
+ while (atomic_read(&priv->buckets_out) && time_before(jiffies, timeout))
+ schedule_timeout_interruptible(1);
for (i = 0; i < priv->max_buckets_out; i++) {
if (priv->RcvCtl[i].skb != NULL) {
diff -urpN 2.6.13-rc5-mm1/drivers/message/fusion/mptscsih.c 2.6.13-rc5-mm1-dev/drivers/message/fusion/mptscsih.c
--- 2.6.13-rc5-mm1/drivers/message/fusion/mptscsih.c 2005-08-07 10:05:20.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/message/fusion/mptscsih.c 2005-08-08 15:52:12.000000000 -0700
@@ -974,10 +974,8 @@ mptscsih_remove(struct pci_dev *pdev)
spin_lock_irqsave(&dvtaskQ_lock, flags);
if (dvtaskQ_active) {
spin_unlock_irqrestore(&dvtaskQ_lock, flags);
- while(dvtaskQ_active && --count) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
+ while(dvtaskQ_active && --count)
+ schedule_timeout_interruptible(1);
} else {
spin_unlock_irqrestore(&dvtaskQ_lock, flags);
}
diff -urpN 2.6.13-rc5-mm1/drivers/message/i2o/iop.c 2.6.13-rc5-mm1-dev/drivers/message/i2o/iop.c
--- 2.6.13-rc5-mm1/drivers/message/i2o/iop.c 2005-08-07 09:58:00.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/message/i2o/iop.c 2005-08-08 15:53:24.000000000 -0700
@@ -92,8 +92,7 @@ u32 i2o_msg_get_wait(struct i2o_controll
c->name);
return I2O_QUEUE_EMPTY;
}
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_uninterruptible(1);
}
return m;
@@ -484,8 +483,7 @@ static int i2o_iop_init_outbound_queue(s
osm_warn("%s: Timeout Initializing\n", c->name);
return -ETIMEDOUT;
}
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_uninterruptible(1);
}
m = c->out_queue.phys;
@@ -547,8 +545,7 @@ static int i2o_iop_reset(struct i2o_cont
if (time_after(jiffies, timeout))
break;
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_uninterruptible(1);
}
switch (*status) {
@@ -576,8 +573,7 @@ static int i2o_iop_reset(struct i2o_cont
rc = -ETIMEDOUT;
goto exit;
}
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_uninterruptible(1);
m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_RESET);
}
@@ -987,8 +983,7 @@ int i2o_status_get(struct i2o_controller
return -ETIMEDOUT;
}
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_uninterruptible(1);
}
#ifdef DEBUG
^ permalink raw reply [flat|nested] 16+ messages in thread
* [-mm PATCH 28/32] drivers/sbus: fix-up schedule_timeout() usage
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
` (6 preceding siblings ...)
2005-08-15 18:25 ` [-mm PATCH 26/32] message: " Nishanth Aravamudan
@ 2005-08-15 18:26 ` Nishanth Aravamudan
2005-08-15 18:29 ` [-mm PATCH 31/32] telephony: " Nishanth Aravamudan
8 siblings, 0 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:26 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
Description: Use schedule_timeout_uninterruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
drivers/sbus/char/bpp.c | 3 +--
drivers/sbus/char/vfc_i2c.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff -urpN 2.6.13-rc5-mm1/drivers/sbus/char/bpp.c 2.6.13-rc5-mm1-dev/drivers/sbus/char/bpp.c
--- 2.6.13-rc5-mm1/drivers/sbus/char/bpp.c 2005-08-07 09:58:07.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/sbus/char/bpp.c 2005-08-10 14:20:34.000000000 -0700
@@ -295,8 +295,7 @@ static unsigned short get_pins(unsigned
static void snooze(unsigned long snooze_time, unsigned minor)
{
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(snooze_time + 1);
+ schedule_timeout_uninterruptible(snooze_time + 1);
}
static int wait_for(unsigned short set, unsigned short clr,
diff -urpN 2.6.13-rc5-mm1/drivers/sbus/char/vfc_i2c.c 2.6.13-rc5-mm1-dev/drivers/sbus/char/vfc_i2c.c
--- 2.6.13-rc5-mm1/drivers/sbus/char/vfc_i2c.c 2005-08-07 10:05:21.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/sbus/char/vfc_i2c.c 2005-08-10 14:20:42.000000000 -0700
@@ -81,8 +81,7 @@ int vfc_pcf8584_init(struct vfc_dev *dev
void vfc_i2c_delay_no_busy(struct vfc_dev *dev, unsigned long usecs)
{
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(usecs_to_jiffies(usecs));
+ schedule_timeout_uninterruptible(usecs_to_jiffies(usecs));
}
void inline vfc_i2c_delay(struct vfc_dev *dev)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [-mm PATCH 31/32] telephony: fix-up schedule_timeout() usage
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
` (7 preceding siblings ...)
2005-08-15 18:26 ` [-mm PATCH 28/32] drivers/sbus: " Nishanth Aravamudan
@ 2005-08-15 18:29 ` Nishanth Aravamudan
8 siblings, 0 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:29 UTC (permalink / raw)
To: eokerson; +Cc: akpm, linux-kernel
Description: Use schedule_timeout_uninterruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
drivers/telephony/ixj.c | 54 ++++++++++++++++--------------------------------
1 files changed, 18 insertions(+), 36 deletions(-)
diff -urpN 2.6.13-rc5-mm1/drivers/telephony/ixj.c 2.6.13-rc5-mm1-dev/drivers/telephony/ixj.c
--- 2.6.13-rc5-mm1/drivers/telephony/ixj.c 2005-08-07 10:05:21.000000000 -0700
+++ 2.6.13-rc5-mm1-dev/drivers/telephony/ixj.c 2005-08-10 14:29:41.000000000 -0700
@@ -2071,8 +2071,7 @@ static int ixj_ring(IXJ *j)
j->flags.ringing = 0;
return 1;
}
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_interruptible(1);
if (signal_pending(current))
break;
}
@@ -2086,8 +2085,7 @@ static int ixj_ring(IXJ *j)
return 1;
}
}
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
+ schedule_timeout_interruptible(1);
if (signal_pending(current))
break;
}
@@ -2153,10 +2151,8 @@ static int ixj_release(struct inode *ino
* Set up locks to ensure that only one process is talking to the DSP at a time.
* This is necessary to keep the DSP from locking up.
*/
- while(test_and_set_bit(board, (void *)&j->busyflags) != 0) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
+ while(test_and_set_bit(board, (void *)&j->busyflags) != 0)
+ schedule_timeout_interruptible(1);
if (ixjdebug & 0x0002)
printk(KERN_INFO "Closing board %d\n", NUM(inode));
@@ -3286,14 +3282,10 @@ static void ixj_write_cidcw(IXJ *j)
ixj_play_tone(j, 23);
clear_bit(j->board, &j->busyflags);
- while(j->tone_state) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
- while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
+ while(j->tone_state)
+ schedule_timeout_interruptible(1);
+ while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0)
+ schedule_timeout_interruptible(1);
if(ixjdebug & 0x0200) {
printk("IXJ cidcw phone%d first tone end at %ld\n", j->board, jiffies);
}
@@ -3313,14 +3305,10 @@ static void ixj_write_cidcw(IXJ *j)
ixj_play_tone(j, 24);
clear_bit(j->board, &j->busyflags);
- while(j->tone_state) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
- while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
+ while(j->tone_state)
+ schedule_timeout_interruptible(1);
+ while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0)
+ schedule_timeout_interruptible(1);
if(ixjdebug & 0x0200) {
printk("IXJ cidcw phone%d sent second tone at %ld\n", j->board, jiffies);
}
@@ -3328,14 +3316,10 @@ static void ixj_write_cidcw(IXJ *j)
j->cidcw_wait = jiffies + ((50 * hertz) / 100);
clear_bit(j->board, &j->busyflags);
- while(!j->flags.cidcw_ack && time_before(jiffies, j->cidcw_wait)) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
- while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
+ while(!j->flags.cidcw_ack && time_before(jiffies, j->cidcw_wait))
+ schedule_timeout_interruptible(1);
+ while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0)
+ schedule_timeout_interruptible(1);
j->cidcw_wait = 0;
if(!j->flags.cidcw_ack) {
if(ixjdebug & 0x0200) {
@@ -6110,10 +6094,8 @@ static int ixj_ioctl(struct inode *inode
* Set up locks to ensure that only one process is talking to the DSP at a time.
* This is necessary to keep the DSP from locking up.
*/
- while(test_and_set_bit(board, (void *)&j->busyflags) != 0) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(1);
- }
+ while(test_and_set_bit(board, (void *)&j->busyflags) != 0)
+ schedule_timeout_interruptible(1);
if (ixjdebug & 0x0040)
printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg);
if (minor >= IXJMAX) {
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage
2005-08-15 18:08 ` [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage Nishanth Aravamudan
2005-08-15 18:17 ` [xfs-masters] " Christoph Hellwig
@ 2005-08-15 18:37 ` Stephen C. Tweedie
1 sibling, 0 replies; 16+ messages in thread
From: Stephen C. Tweedie @ 2005-08-15 18:37 UTC (permalink / raw)
To: Nishanth Aravamudan
Cc: sfrench, okir, Trond Myklebust, reiserfs-dev, urban, xfs-masters,
Nathan Scott, Andrew Morton, samba-technical, linux-kernel,
reiserfs-list, samba, linux-xfs, Stephen Tweedie
Hi,
On Mon, 2005-08-15 at 19:08, Nishanth Aravamudan wrote:
> Description: Use schedule_timeout_{,un}interruptible() instead of
> set_current_state()/schedule_timeout() to reduce kernel size.
> +++ 2.6.13-rc5-mm1-dev/fs/jbd/transaction.c 2005-08-10 15:03:33.000000000 -0700
> @@ -1340,8 +1340,7 @@ int journal_stop(handle_t *handle)
> - set_current_state(TASK_UNINTERRUPTIBLE);
> - schedule_timeout(1);
> + schedule_timeout_uninterruptible(1);
This chunk at least is fine.
--Stephen
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [xfs-masters] [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage
2005-08-15 18:17 ` [xfs-masters] " Christoph Hellwig
@ 2005-08-15 18:40 ` Nishanth Aravamudan
2005-08-15 20:36 ` Christoph Hellwig
0 siblings, 1 reply; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-15 18:40 UTC (permalink / raw)
To: Christoph Hellwig
Cc: xfs-masters, sfrench, sct, okir, trond.myklebust, reiserfs-dev,
urban, nathans, akpm, samba-technical, linux-kernel,
reiserfs-list, samba, linux-xfs
On 15.08.2005 [20:17:52 +0200], Christoph Hellwig wrote:
> On Mon, Aug 15, 2005 at 11:08:04AM -0700, Nishanth Aravamudan wrote:
> > Description: Use schedule_timeout_{,un}interruptible() instead of
> > set_current_state()/schedule_timeout() to reduce kernel size. Also use
> > helper functions to convert between human time units and jiffies rather
> > than constant HZ division to avoid rounding errors.
>
> The XFS changes are still wrong for the same rason as last time,
> we actually do want the daemons to do work if they're woken earlier
> using wake_up_process.
Hrm, I got dropped from the Cc list...? No worries, I'm subscribed in
two places :)
I think your reference to "last time" is the KJ patches which probably
used msleep{,_interruptible}() instead of schedule_timeout(). This
patchset, in contrast, should result in *no* functional changes (beyond
some more precisie conversions, where appropriate).
schedule_timeout_interruptible(some_value), for instance is nothing more than:
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(some_value);
Just in the form of a combine function call. No loops like msleep() &
co.
Is the patch still a problem?
Thanks,
Nish
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [xfs-masters] [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage
2005-08-15 18:40 ` Nishanth Aravamudan
@ 2005-08-15 20:36 ` Christoph Hellwig
0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2005-08-15 20:36 UTC (permalink / raw)
To: Nishanth Aravamudan
Cc: Christoph Hellwig, xfs-masters, sfrench, sct, okir,
trond.myklebust, reiserfs-dev, urban, nathans, akpm,
samba-technical, linux-kernel, reiserfs-list, samba, linux-xfs
On Mon, Aug 15, 2005 at 11:40:13AM -0700, Nishanth Aravamudan wrote:
> Hrm, I got dropped from the Cc list...? No worries, I'm subscribed in
> two places :)
I didn't do that manually, must haven some mail header thing.
> I think your reference to "last time" is the KJ patches which probably
> used msleep{,_interruptible}() instead of schedule_timeout(). This
> patchset, in contrast, should result in *no* functional changes (beyond
> some more precisie conversions, where appropriate).
> schedule_timeout_interruptible(some_value), for instance is nothing more than:
>
> set_current_state(TASK_INTERRUPTIBLE);
> schedule_timeout(some_value);
>
> Just in the form of a combine function call. No loops like msleep() &
> co.
>
> Is the patch still a problem?
No, it's fine. Sorry for the noise.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [-mm PATCH 1/32] include: update jiffies/{m,u}secs conversion functions
2005-08-15 18:06 ` [-mm PATCH 1/32] include: update jiffies/{m,u}secs conversion functions Nishanth Aravamudan
@ 2005-08-17 23:35 ` Andrew Morton
2005-08-18 3:19 ` Nishanth Aravamudan
0 siblings, 1 reply; 16+ messages in thread
From: Andrew Morton @ 2005-08-17 23:35 UTC (permalink / raw)
To: Nishanth Aravamudan; +Cc: linux-kernel
Nishanth Aravamudan <nacc@us.ibm.com> wrote:
>
> Description: Clarify the human-time units to jiffies conversion
> functions by using the constants in time.h. This makes many of the
> subsequent patches direct copies of the current code.
>
>
> /* Parameters used to convert the timespec values */
> +#ifndef MSEC_PER_SEC
> +#define MSEC_PER_SEC (1000L)
> +#endif
> +
> #ifndef USEC_PER_SEC
> #define USEC_PER_SEC (1000000L)
> #endif
Bah. There's no MSEC_PER_SEC defined anywhere in the tree, so the ifndef
isn't needed. Nor is the one for USEC_PER_SEC, come to that. I'll kill
them.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [-mm PATCH 1/32] include: update jiffies/{m,u}secs conversion functions
2005-08-17 23:35 ` Andrew Morton
@ 2005-08-18 3:19 ` Nishanth Aravamudan
0 siblings, 0 replies; 16+ messages in thread
From: Nishanth Aravamudan @ 2005-08-18 3:19 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
On 17.08.2005 [16:35:06 -0700], Andrew Morton wrote:
> Nishanth Aravamudan <nacc@us.ibm.com> wrote:
> >
> > Description: Clarify the human-time units to jiffies conversion
> > functions by using the constants in time.h. This makes many of the
> > subsequent patches direct copies of the current code.
> >
> >
> > /* Parameters used to convert the timespec values */
> > +#ifndef MSEC_PER_SEC
> > +#define MSEC_PER_SEC (1000L)
> > +#endif
> > +
> > #ifndef USEC_PER_SEC
> > #define USEC_PER_SEC (1000000L)
> > #endif
>
> Bah. There's no MSEC_PER_SEC defined anywhere in the tree, so the ifndef
> isn't needed. Nor is the one for USEC_PER_SEC, come to that. I'll kill
> them.
Yup, that's fine by me. Thanks!
-Nish
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2005-08-18 3:19 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-15 18:05 [-mm PATCH 0/32] fix-up schedule_timeout() usage Nishanth Aravamudan
2005-08-15 18:06 ` [-mm PATCH 1/32] include: update jiffies/{m,u}secs conversion functions Nishanth Aravamudan
2005-08-17 23:35 ` Andrew Morton
2005-08-18 3:19 ` Nishanth Aravamudan
2005-08-15 18:08 ` [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage Nishanth Aravamudan
2005-08-15 18:17 ` [xfs-masters] " Christoph Hellwig
2005-08-15 18:40 ` Nishanth Aravamudan
2005-08-15 20:36 ` Christoph Hellwig
2005-08-15 18:37 ` Stephen C. Tweedie
2005-08-15 18:08 ` [-mm PATCH 3/32] kernel: " Nishanth Aravamudan
2005-08-15 18:09 ` [-mm PATCH 4/32] mm: " Nishanth Aravamudan
2005-08-15 18:18 ` [-mm PATCH 17/32] drivers/cdrom: " Nishanth Aravamudan
2005-08-15 18:19 ` [-mm PATCH 19/32] drivers/dlm: " Nishanth Aravamudan
2005-08-15 18:25 ` [-mm PATCH 26/32] message: " Nishanth Aravamudan
2005-08-15 18:26 ` [-mm PATCH 28/32] drivers/sbus: " Nishanth Aravamudan
2005-08-15 18:29 ` [-mm PATCH 31/32] telephony: " Nishanth Aravamudan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox