linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Too many disk writes in 2.4.8-pre8
@ 2001-08-10 20:04 Peter Osterlund
  2001-08-10 21:28 ` how to check whether other threads are waiting Imran Badr
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Osterlund @ 2001-08-10 20:04 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

There is a problem in sync_old_buffers() in kernel 2.4.8-pre8.
write_some_buffers() is always called at least once, which means that
under low/moderate I/O load, b_flushtime doesn't have any effect.
Everything is flushed to disk as soon as possible.

The result is unnecessary I/O and slowdown in a lot of cases. For example,
while configuring gcc, the system is paging out 400-500Kb/s constantly,
while in previous kernels the pageout rate was more like 10-20Kb/s.

The patch below fixes this problem:

--- linux/fs/buffer.c.orig	Fri Aug 10 21:42:52 2001
+++ linux/fs/buffer.c	Fri Aug 10 21:34:47 2001
@@ -2601,20 +2601,20 @@
 	sync_supers(0);
 	unlock_kernel();

-	spin_lock(&lru_list_lock);
 	for (;;) {
-		if (write_some_buffers(NODEV)) {
-			struct buffer_head *bh;
+		struct buffer_head *bh;

-			spin_lock(&lru_list_lock);
-			bh = lru_list[BUF_DIRTY];
-			if (bh && !time_before(jiffies, bh->b_flushtime))
-				continue;
+		spin_lock(&lru_list_lock);
+		bh = lru_list[BUF_DIRTY];
+		if (!bh || time_before(jiffies, bh->b_flushtime)) {
 			spin_unlock(&lru_list_lock);
+			break;
 		}
-		run_task_queue(&tq_disk);
-		return 0;
+		if (!write_some_buffers(NODEV))
+			break;
 	}
+	run_task_queue(&tq_disk);
+	return 0;
 }

 int block_sync_page(struct page *page)

-- 
Peter Österlund             peter.osterlund@mailbox.swipnet.se
Sköndalsvägen 35            http://home1.swipnet.se/~w-15919
S-128 66 Sköndal            +46 8 942647
Sweden



^ permalink raw reply	[flat|nested] 3+ messages in thread

* how to check whether other threads are waiting ..
  2001-08-10 20:04 [PATCH] Too many disk writes in 2.4.8-pre8 Peter Osterlund
@ 2001-08-10 21:28 ` Imran Badr
  2001-08-10 21:49   ` Jeff Hartmann
  0 siblings, 1 reply; 3+ messages in thread
From: Imran Badr @ 2001-08-10 21:28 UTC (permalink / raw)
  To: linux-kernel

Hi,

How can I find out in my kernel code that if mutiple threads are waiting for
a particular semaphore?

Thanks,
imran.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to check whether other threads are waiting ..
  2001-08-10 21:28 ` how to check whether other threads are waiting Imran Badr
@ 2001-08-10 21:49   ` Jeff Hartmann
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Hartmann @ 2001-08-10 21:49 UTC (permalink / raw)
  To: imran.badr; +Cc: linux-kernel

Imran Badr wrote:

> Hi,
> 
> How can I find out in my kernel code that if mutiple threads are waiting for
> a particular semaphore?
> 
> Thanks,
> imran.
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
I haven't looked at the semaphore implementation for other arch's 
closely, but on the ia32 there is a waitqueue in struct semaphore.  
Examine that to detrimine if there are processes waiting, how many, etc.

-Jeff



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-08-10 21:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-10 20:04 [PATCH] Too many disk writes in 2.4.8-pre8 Peter Osterlund
2001-08-10 21:28 ` how to check whether other threads are waiting Imran Badr
2001-08-10 21:49   ` Jeff Hartmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).