Thread (6 messages) 6 messages, 4 authors, 2004-03-05

Re: [PATCH] md - 1 of 2 - Use "shedule_timeout(2)" instead of yield() as it seems to wait for less time.

From: Andrew Morton <hidden>
Date: 2004-03-05 06:16:21

NeilBrown [off-list ref] wrote:
+		schedule_timeout(2);
Are you sure we want to sleep for 20-30 milliseconds on a 100 Hz machine?

Wouldn't it be better to do

diff -puN drivers/md/raid5.c~md-use-schedule_timeout drivers/md/raid5.c
--- 25/drivers/md/raid5.c~md-use-schedule_timeout	2004-03-04 22:15:14.000000000 -0800
+++ 25-akpm/drivers/md/raid5.c	2004-03-04 22:15:41.000000000 -0800
@@ -1409,7 +1409,8 @@ static int sync_request (mddev_t *mddev,
 		/* make sure we don't swamp the stripe cache if someone else
 		 * is trying to get access 
 		 */
-		yield();
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(max(HZ/500, 1));
 	}
 	spin_lock(&sh->lock);	
 	set_bit(STRIPE_SYNCING, &sh->state);
diff -puN drivers/md/raid6main.c~md-use-schedule_timeout drivers/md/raid6main.c
--- 25/drivers/md/raid6main.c~md-use-schedule_timeout	2004-03-04 22:15:14.000000000 -0800
+++ 25-akpm/drivers/md/raid6main.c	2004-03-04 22:15:50.000000000 -0800
@@ -1571,7 +1571,8 @@ static int sync_request (mddev_t *mddev,
 		/* make sure we don't swamp the stripe cache if someone else
 		 * is trying to get access
 		 */
-		yield();
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(max(HZ/500, 1));
 	}
 	spin_lock(&sh->lock);
 	set_bit(STRIPE_SYNCING, &sh->state);
_

?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help