Skip to contentSkip to conversation

base/dmapool: replace schedule_timeout()

PATCH In review Nishanth Aravamudan 2 participants 2 messages Sep 15, 2004 – Sep 21, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 base/dmapool: replace schedule_timeout()

Any comments would be appreciated.

Description: msleep_interruptible() is used instead of schedule_timeout() to guarantee the task delays as expected. To achieve this, the timeout variable is converted from jiffies to msecs. Also, set_current_state() is used instead of direct assignment.

drivers/base/dmapool.c +3 -3
@@ -34,7 +34,7 @@ struct dma_page {	/* cacheable header fo
 	unsigned long		bitmap [0];
 };
 
-#define	POOL_TIMEOUT_JIFFIES	((100 /* msec */ * HZ) / 1000)
+#define	POOL_TIMEOUT_MSECS	(100)   /* msec */
 #define	POOL_POISON_FREED	0xa7	/* !inuse */
 #define	POOL_POISON_ALLOCATED	0xa9	/* !initted */
 
@@ -293,11 +293,11 @@ restart:
 		if (mem_flags & __GFP_WAIT) {
 			DECLARE_WAITQUEUE (wait, current);
 
-			current->state = TASK_INTERRUPTIBLE;
+			set_current_state (TASK_INTERRUPTIBLE);
 			add_wait_queue (&pool->waitq, &wait);
 			spin_unlock_irqrestore (&pool->lock, flags);
 
-			schedule_timeout (POOL_TIMEOUT_JIFFIES);
+			msleep_interruptible(POOL_TIMEOUT_MSECS);
 
 			remove_wait_queue (&pool->waitq, &wait);
 			goto restart;

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

Re: [Kernel-janitors] [PATCH] base/dmapool: replace

Quoted 22 lines · Nishanth Aravamudan

Any comments would be appreciated.

Description: msleep_interruptible() is used instead of schedule_timeout() to guarantee the task delays as expected. To achieve this, the timeout variable is converted from jiffies to msecs. Also, set_current_state() is used instead of direct assignment.

drivers/base/dmapool.c +1 -1
@@ -34,7 +34,7 @@ struct dma_page {	/* cacheable header fo
 	unsigned long		bitmap [0];
 };
 
-#define	POOL_TIMEOUT_JIFFIES	((100 /* msec */ * HZ) / 1000)
+#define	POOL_TIMEOUT_MSECS	(100)   /* msec */
 #define	POOL_POISON_FREED	0xa7	/* !inuse */
 #define	POOL_POISON_ALLOCATED	0xa9	/* !initted */
 
@@ -293,11 +293,11 @@ restart:
 		if (mem_flags & __GFP_WAIT) {
 			DECLARE_WAITQUEUE (wait, current);
 

drivers/base/dmapool.c restart: · line 303

Quoted 10 lines
drivers/base/dmapool.c +2 -2
-			current->state = TASK_INTERRUPTIBLE;
+			set_current_state (TASK_INTERRUPTIBLE);
 			add_wait_queue (&pool->waitq, &wait);
 			spin_unlock_irqrestore (&pool->lock, flags);
 
-			schedule_timeout (POOL_TIMEOUT_JIFFIES);
+			msleep_interruptible(POOL_TIMEOUT_MSECS);
 
 			remove_wait_queue (&pool->waitq, &wait);
 			goto restart;

added include for kjt.
a++ maks

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors