[svn-commits] sruffell: branch linux/2.4 r9683 - in /linux/branches/2.4: drivers/dahdi/wcte...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 20 23:31:39 CST 2011


Author: sruffell
Date: Thu Jan 20 23:31:35 2011
New Revision: 9683

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9683
Log:
wcte12xp: Use interruptible waits to decrease impact on load average.

The wcte12xp does all the checking for alarm in a user space workqueue.
Most of this time is spent sleeping waiting for reads from the framer to
complete.  Tasks in uninterruptible sleeps are added to running tasks
for the purposes of calculating load average. This change makes the
sleeps interruptible so as to not affect the load average as much.

For example, the following command will load and configure the driver and
then print the load average every 10 seconds.

]# modprobe wcte12xp && dahdi_cfg && ((x=12)); while [[ $x -gt 0 ]]; do cat
/proc/loadavg; sleep 10; let x=$x-1; done

With this change:
0.29 0.10 0.02 1/101 29945
0.24 0.10 0.02 1/101 29967
0.20 0.09 0.02 1/101 30019
0.17 0.09 0.02 1/101 30041
0.15 0.09 0.02 1/101 30062
0.12 0.08 0.02 1/101 30085
0.10 0.08 0.02 1/101 30107
0.09 0.08 0.02 1/101 30129
0.07 0.08 0.02 1/101 30151
0.14 0.09 0.02 1/101 30173
0.12 0.09 0.02 1/101 30195
0.10 0.08 0.02 1/101 30217
(and I've seen it get down to 0.0)

Before this change:
0.57 0.22 0.07 1/101 31920
0.48 0.21 0.07 1/101 31942
0.48 0.22 0.07 1/101 31964
0.48 0.23 0.08 1/101 31986
0.41 0.22 0.07 1/101 32008
0.42 0.23 0.08 1/101 32030
0.43 0.24 0.08 1/101 32054
0.45 0.25 0.09 1/101 32076
0.45 0.25 0.09 1/101 32098
0.46 0.26 0.10 1/101 32120
0.47 0.27 0.10 1/101 32172
0.39 0.26 0.10 1/101 32194

(closes issue #18142)
Reported by: foxfire
Tested by: foxfire

Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=9512

Modified:
    linux/branches/2.4/drivers/dahdi/wcte12xp/base.c
    linux/branches/2.4/include/dahdi/kernel.h

Modified: linux/branches/2.4/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.4/drivers/dahdi/wcte12xp/base.c?view=diff&rev=9683&r1=9682&r2=9683
==============================================================================
--- linux/branches/2.4/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/branches/2.4/drivers/dahdi/wcte12xp/base.c Thu Jan 20 23:31:35 2011
@@ -580,7 +580,7 @@
 	cmd->data = 0x00;
 	cmd->flags = __CMD_RD;
 	submit_cmd(wc, cmd);
-	ret = wait_for_completion_timeout(&cmd->complete, HZ*10);
+	ret = wait_for_completion_interruptible_timeout(&cmd->complete, HZ*10);
 	if (unlikely(!ret)) {
 		spin_lock_irqsave(&wc->cmd_list_lock, flags);
 		if (!list_empty(&cmd->node)) {
@@ -588,12 +588,15 @@
 			 * can go ahead and free it right away. */
 			list_del_init(&cmd->node);
 			spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
-			if (printk_ratelimit()) {
-				dev_warn(&wc->vb.pdev->dev,
-					 "Timeout in %s\n", __func__);
+			free_cmd(wc, cmd);
+			if (-ERESTARTSYS != ret) {
+				if (printk_ratelimit()) {
+					dev_warn(&wc->vb.pdev->dev,
+						 "Timeout in %s\n", __func__);
+				}
+				ret = -EIO;
 			}
-			free_cmd(wc, cmd);
-			return -EIO;
+			return ret;
 		} else {
 			/* Looks like this command was removed from the list by
 			 * someone else already. Let's wait for them to complete
@@ -638,17 +641,20 @@
 	cmd->data = 0x00;
 	cmd->flags = __CMD_PINS;
 	submit_cmd(wc, cmd);
-	ret = wait_for_completion_timeout(&cmd->complete, HZ*2);
+	ret = wait_for_completion_interruptible_timeout(&cmd->complete, HZ*2);
 	if (unlikely(!ret)) {
 		spin_lock_irqsave(&wc->cmd_list_lock, flags);
 		list_del_init(&cmd->node);
 		spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
-		if (printk_ratelimit()) {
-			dev_warn(&wc->vb.pdev->dev,
-				 "Timeout in %s\n", __func__);
-		}
 		free_cmd(wc, cmd);
-		return -EIO;
+		if (-ERESTARTSYS != ret) {
+			if (printk_ratelimit()) {
+				dev_warn(&wc->vb.pdev->dev,
+					 "Timeout in %s\n", __func__);
+			}
+			ret = -EIO;
+		}
+		return ret;
 	}
 	ret = cmd->data;
 	free_cmd(wc, cmd);

Modified: linux/branches/2.4/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.4/include/dahdi/kernel.h?view=diff&rev=9683&r1=9682&r2=9683
==============================================================================
--- linux/branches/2.4/include/dahdi/kernel.h (original)
+++ linux/branches/2.4/include/dahdi/kernel.h Thu Jan 20 23:31:35 2011
@@ -1240,12 +1240,13 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
 #if !defined(HAVE_WAIT_FOR_COMPLETION_TIMEOUT)
 static inline unsigned long
-wait_for_completion_timeout(struct completion *x, unsigned long timeout)
+wait_for_completion_interruptible_timeout(struct completion *x,
+					  unsigned long timeout)
 {
 	/* There is a race condition here.  If x->done is reset to 0
 	 * before the call to wait_for_completion after this thread wakes.
 	 */
-	timeout = wait_event_timeout(x->wait, x->done, timeout);
+	timeout = wait_event_interruptible_timeout(x->wait, x->done, timeout);
 	if (timeout)
 		wait_for_completion(x);
 




More information about the svn-commits mailing list