public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: "Dieter Nützel" <Dieter.Nuetzel@hamburg.de>
Cc: Andrea Arcangeli <andrea@suse.de>, Robert Love <rml@tech9.net>,
	Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: 2.4.10-ac10-preempt lmbench output.
Date: Tue, 09 Oct 2001 22:13:58 -0700	[thread overview]
Message-ID: <3BC3D916.B0284E00@zip.com.au> (raw)
In-Reply-To: <200110100358.NAA17519@isis.its.uow.edu.au>

Dieter Nützel wrote:
> 
> Andrew have you a current version of your lowlatency patches handy?
> 

mm..  Nice people keep sending me updates.  It's at 
http://www.uow.edu.au/~andrewm/linux/schedlat.html and applies
to 2.4.11 with one little reject.  I don't know how it's
performing at present - it's time for another round of tuning
and testing.

wrt this discussion: I would assume that xmms is simply stalling
on disk access.  All it takes is for one of its text pages to be
dropped and it could have to wait a very long time indeed to
come back to life.  The disk read latency could easily exceed
any sane buffering in the sound card or its driver.

The application should be using mlockall(MCL_FUTURE) and it should
run `nice -19'  (SCHED_FIFO and SCHED_RR are rather risky - if the
app gets stuck in a loop, it's time to hit the big button).  If the
app isn't doing both these things then it just doesn't have a chance.

I don't understand why Andrea is pointing at write throttling?  xmms
doesn't do any disk writes, does it??

Andrea's VM has a rescheduling point in shrink_cache(), which is the
analogue of the other VM's page_launder().  This rescheduling point
is *absolutely critial*, because it opens up what is probably the
longest-held spinlock in the kernel (under common use).  If there
were a similar reschedulig point in page_launder(), comparisons
would be more valid...


I would imagine that for a (very) soft requirement such as audio
playback, the below patch, combined with mlockall and renicing
should fix the problems.  I would expect that this patch will
give effects which are similar to the preempt patch.  This is because
most of the other latency problems are under locks - icache/dcache
shrinking and zap_page_range(), etc.

This patch should go into the stock 2.4 kernel.

Oh.  And always remember to `renice -19' your X server.  



--- linux-2.4.11/mm/filemap.c	Tue Oct  9 21:31:40 2001
+++ linux-akpm/mm/filemap.c	Tue Oct  9 21:47:51 2001
@@ -1230,6 +1230,9 @@ found_page:
 		page_cache_get(page);
 		spin_unlock(&pagecache_lock);
 
+		if (current->need_resched)
+			schedule();
+
 		if (!Page_Uptodate(page))
 			goto page_not_up_to_date;
 		generic_file_readahead(reada_ok, filp, inode, page);
@@ -2725,6 +2728,9 @@ generic_file_write(struct file *file,con
 		if (!PageLocked(page)) {
 			PAGE_BUG(page);
 		}
+
+		if (current->need_resched)
+			schedule();
 
 		kaddr = kmap(page);
 		status = mapping->a_ops->prepare_write(file, page, offset, offset+bytes);
--- linux-2.4.11/fs/buffer.c	Tue Oct  9 21:31:40 2001
+++ linux-akpm/fs/buffer.c	Tue Oct  9 22:08:51 2001
@@ -29,6 +29,7 @@
 /* async buffer flushing, 1999 Andrea Arcangeli <andrea@suse.de> */
 
 #include <linux/config.h>
+#include <linux/compiler.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/slab.h>
@@ -231,6 +232,10 @@ static int write_some_buffers(kdev_t dev
 static void write_unlocked_buffers(kdev_t dev)
 {
 	do {
+		if (unlikely(current->need_resched)) {
+			__set_current_state(TASK_RUNNING);
+			schedule();
+		}
 		spin_lock(&lru_list_lock);
 	} while (write_some_buffers(dev));
 	run_task_queue(&tq_disk);
--- linux-2.4.11/fs/proc/array.c	Sun Sep 23 12:48:44 2001
+++ linux-akpm/fs/proc/array.c	Tue Oct  9 21:47:51 2001
@@ -414,6 +414,9 @@ static inline void statm_pte_range(pmd_t
 		pte_t page = *pte;
 		struct page *ptpage;
 
+		if (current->need_resched)
+			schedule();	/* For `top' and `ps' */
+
 		address += PAGE_SIZE;
 		pte++;
 		if (pte_none(page))
--- linux-2.4.11/fs/proc/generic.c	Sun Sep 23 12:48:44 2001
+++ linux-akpm/fs/proc/generic.c	Tue Oct  9 21:47:51 2001
@@ -98,6 +98,9 @@ proc_file_read(struct file * file, char 
 				retval = n;
 			break;
 		}
+
+		if (current->need_resched)
+			schedule();	/* Some proc files are large */
 		
 		/* This is a hack to allow mangling of file pos independent
  		 * of actual bytes read.  Simply place the data at page,

       reply	other threads:[~2001-10-10  5:14 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200110100358.NAA17519@isis.its.uow.edu.au>
2001-10-10  5:13 ` Andrew Morton [this message]
2001-10-10  5:26   ` 2.4.10-ac10-preempt lmbench output Andrea Arcangeli
2001-10-10 11:41     ` safemode
2001-10-10 12:00       ` safemode
     [not found]       ` <20011010120009.851921E7C9@Cantor.suse.de>
2001-10-10 13:36         ` Andrea Arcangeli
2001-10-10 15:37           ` Dieter Nützel
2001-10-10 20:10             ` Justin A
2001-10-10 23:42           ` safemode
2001-10-11  0:30             ` Mike Fedyk
2001-10-10 18:14   ` george anzinger
     [not found] <20011010035818.A556B1E760@Cantor.suse.de>
2001-10-10  4:23 ` Andrea Arcangeli
2001-10-10  4:42   ` Dieter Nützel
     [not found]   ` <20011010044242.82D131E768@Cantor.suse.de>
2001-10-10  4:48     ` Andrea Arcangeli
     [not found] <200110100358.f9A3wSB17421@zero.tech9.net>
2001-10-10  4:02 ` Robert Love
2001-10-10  4:04   ` Robert Love
2001-10-10  4:27   ` Andrea Arcangeli
2001-10-10  3:57 Dieter Nützel
     [not found] <200110100036.UAA128640@ufl.edu>
2001-10-10  2:02 ` Robert Love
  -- strict thread matches above, loose matches on Subject: below --
2001-10-10  0:36 safemode
2001-10-10  1:18 ` Andrea Arcangeli
2001-10-10  2:09   ` safemode
2001-10-10  2:10   ` Robert Love
2001-10-10  2:51     ` Andrea Arcangeli
     [not found]   ` <20011010020935.50DEF1E756@Cantor.suse.de>
2001-10-10  2:30     ` Andrea Arcangeli
2001-10-10  2:37       ` Robert Love
2001-10-10  3:06         ` Andrea Arcangeli
2001-10-10  3:24           ` Robert Love
2001-10-10  4:03             ` Andrea Arcangeli
2001-10-12 13:22         ` Pavel Machek
2001-10-13 20:42           ` Mike Fedyk
2001-10-13 23:21           ` Robert Love
2001-10-14  6:18             ` Pavel Machek
2001-10-10  5:25 ` Justin A

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=3BC3D916.B0284E00@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=Dieter.Nuetzel@hamburg.de \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@tech9.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox