From: Nishanth Aravamudan <nacc@us.ibm.com>
To: sfrench@samba.org, sct@redhat.com, okir@monad.swb.de,
trond.myklebust@fys.uio.no, reiserfs-dev@namesys.com,
urban@teststation.com, xfs-masters@oss.sgi.com, nathans@sgi.com
Cc: akpm@osdl.org, samba-technical@lists.samba.org,
linux-kernel@vger.kernel.org, reiserfs-list@namesys.com,
samba@samba.org, linux-xfs@oss.sgi.com
Subject: [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage
Date: Mon, 15 Aug 2005 11:08:04 -0700 [thread overview]
Message-ID: <20050815180804.GE2854@us.ibm.com> (raw)
In-Reply-To: <20050815180514.GC2854@us.ibm.com>
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);
next prev parent reply other threads:[~2005-08-15 18:08 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Nishanth Aravamudan [this message]
2005-08-15 18:17 ` [xfs-masters] [-mm PATCH 2/32] fs: fix-up schedule_timeout() usage 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 20:23 ` Steven French
2005-08-15 18:08 ` [-mm PATCH 3/32] kernel: " Nishanth Aravamudan
2005-08-15 18:09 ` [-mm PATCH 4/32] mm: " Nishanth Aravamudan
[not found] ` <20050815180514.GC2854-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2005-08-15 18:10 ` [-mm PATCH 05/32] net: " Nishanth Aravamudan
2005-08-15 18:16 ` [-mm PATCH 15/32] drivers/acpi: " Nishanth Aravamudan
2005-08-15 18:10 ` [-mm PATCH 06/32] sound: " Nishanth Aravamudan
2005-08-15 18:14 ` [-mm PATCH 11/32] mips: " Nishanth Aravamudan
2005-08-15 18:15 ` [-mm PATCH 12/32] ppc: " Nishanth Aravamudan
2005-08-15 18:16 ` [uml-devel] [-mm PATCH 14/32] um: " Nishanth Aravamudan
2005-08-15 18:54 ` Jeff Dike
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:23 ` [-mm PATCH 23/32] drivers/macintosh: " Nishanth Aravamudan
2005-08-15 18:24 ` [-mm PATCH 24/32] drivers/md: " 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:27 ` [-mm PATCH 29/32] drivers/scsi: " Nishanth Aravamudan
2005-08-15 20:34 ` Willem Riede
2005-08-15 20:42 ` Nishanth Aravamudan
2005-08-15 18:28 ` [-mm PATCH 30/32] serial: " Nishanth Aravamudan
2005-08-15 18:29 ` [-mm PATCH 31/32] telephony: " Nishanth Aravamudan
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=20050815180804.GE2854@us.ibm.com \
--to=nacc@us.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@oss.sgi.com \
--cc=nathans@sgi.com \
--cc=okir@monad.swb.de \
--cc=reiserfs-dev@namesys.com \
--cc=reiserfs-list@namesys.com \
--cc=samba-technical@lists.samba.org \
--cc=samba@samba.org \
--cc=sct@redhat.com \
--cc=sfrench@samba.org \
--cc=trond.myklebust@fys.uio.no \
--cc=urban@teststation.com \
--cc=xfs-masters@oss.sgi.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.