mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: andrea@suse.de, mjy@geizhals.at, linux-kernel@vger.kernel.org
Subject: Re: CONFIG_PREEMPT and server workloads
Date: Thu, 18 Mar 2004 11:01:59 -0800	[thread overview]
Message-ID: <20040318110159.321754d8.akpm@osdl.org> (raw)
In-Reply-To: <s5hlllycgz3.wl@alsa2.suse.de>

Takashi Iwai <tiwai@suse.de> wrote:
>
> > These fixes from Takashi Iwai brings 2.6 back in line with 2.4, I
> > suggested to use EIP dumps from interrupts to get the hotspots, he
> > promptly used the RTC for that and he could fixup all the spots, great
> > job he did since now we've a very low worst case sched latency in 2.6
> > too:
> > 
> > --- linux/fs/mpage.c-dist	2004-03-10 16:26:54.293647478 +0100
> > +++ linux/fs/mpage.c	2004-03-10 16:27:07.405673634 +0100
> > @@ -695,6 +695,7 @@ mpage_writepages(struct address_space *m
> >  			unlock_page(page);
> >  		}
> >  		page_cache_release(page);
> > +		cond_resched();
> >  		spin_lock(&mapping->page_lock);
> >  	}
> >  	/*
> 
> the above one is the major source of RT-latency.

This one's fine.

> for ext3, these two spots are relevant.
> 
> --- linux-2.6.4-8/fs/jbd/commit.c-dist	2004-03-16 23:00:40.000000000 +0100
> +++ linux-2.6.4-8/fs/jbd/commit.c	2004-03-18 02:42:41.043448624 +0100
> @@ -290,6 +290,9 @@ write_out_data_locked:
>  			commit_transaction->t_sync_datalist = jh;
>  			break;
>  		}
> +
> +		if (need_resched())
> +			break;
>  	} while (jh != last_jh);
>  
>  	if (bufs || need_resched()) {

This one I need to think about.  Perhaps we can remove the yield point a
few lines above.

One needs to be really careful with the lock-dropping trick - there are
weird situations in which the kernel fails to make any forward progress. 
I've been meaning to do another round of latency tuneups for ages, so I'll
check this one out, thanks.

There's also the SMP problem: this CPU could be spinning on a lock with
need_resched() true, but the other CPU is hanging on the lock for ages
because its need_resched() is false.  In the 2.4 ll patch I solved that via
the scary hack of broadcasting a reschedule instruction to all CPUs if an
rt-prio task just became runnable.  In 2.6-preempt we use
preempt_spin_lock().

But in 2.6 non-preempt we have no solution to this, so worst-case
scheduling latencies on 2.6 SMP CONFIG_PREEMPT=n are high.


Last time I looked the worst-case latency is in fact over in the ext3
checkpoint code.  It's under spinlock and tricky to fix.

> --- linux-2.6.4-8/fs/ext3/inode.c-dist	2004-03-18 02:33:38.000000000 +0100
> +++ linux-2.6.4-8/fs/ext3/inode.c	2004-03-18 02:33:40.000000000 +0100
> @@ -1987,6 +1987,7 @@ static void ext3_free_branches(handle_t 
>  	if (is_handle_aborted(handle))
>  		return;
>  
> +	cond_resched();
>  	if (depth--) {
>  		struct buffer_head *bh;
>  		int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb);
> 

This one's OK.

btw, several months ago we discussed the idea of adding a sysctl to the
ALSA drivers which would cause a dump_stack() to be triggered if the audio
ISR detected a sound underrun.

This would be a very useful feature, because it increases the number of
low-latency developers from O(2) to O(lots).  If some user is complaining
of underruns we can just ask them to turn on the sysctl and we get a trace
pointing at the culprit code.

And believe me, we need the coverage.  There are all sorts of weird code
paths which were found during the development of the 2.4 low-latency patch.
i2c drivers, fbdev drivers, all sorts of things which you and I don't
test.

I know it's a matter of

	if (sysctl_is_set)
		dump_stack();

in snd_pcm_update_hw_ptr_post() somewhere, but my brain burst when working
out the ALSA sysctl architecture.

Is this something you could add please?


  parent reply	other threads:[~2004-03-18 19:02 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18  4:00 Marinos J. Yannikos
2004-03-18  5:12 ` Andrew Morton
2004-03-18  6:03 ` Andrea Arcangeli
2004-03-18  9:50   ` Andrew Morton
2004-03-18 14:51     ` Andrea Arcangeli
2004-03-18 15:34       ` Robert Love
2004-03-18 16:01         ` Andrea Arcangeli
2004-03-18 17:39       ` Andrew Morton
2004-03-18 17:58         ` Andrea Arcangeli
2004-03-18 18:26           ` Andrew Morton
2004-03-18 18:38             ` Andrea Arcangeli
2004-03-18 18:47               ` Andrew Morton
2004-03-18 19:01                 ` Andrea Arcangeli
2004-03-18 17:48       ` Robert Love
2004-03-18 18:00         ` Andrea Arcangeli
2004-03-20 10:48         ` Jamie Lokier
2004-03-19  2:17       ` Nick Piggin
     [not found]         ` <20040319050948.GN2045@holomorphy.com>
2004-03-20 12:14           ` Andrea Arcangeli
2004-03-20 14:51             ` William Lee Irwin III
2004-03-20 15:03               ` Andrea Arcangeli
2004-03-20 15:09                 ` William Lee Irwin III
2004-03-24 13:57                 ` Takashi Iwai
2004-03-24 14:52                   ` Andrea Arcangeli
2004-03-24 15:11                   ` William Lee Irwin III
2004-03-18 15:20     ` Tom Sightler
2004-03-18 15:37       ` Andrea Arcangeli
2004-03-18 23:54         ` Tom Sightler
2004-03-18 15:39       ` Robert Love
2004-03-18 15:28   ` Takashi Iwai
2004-03-18 15:40     ` Robert Love
2004-03-18 15:42     ` Andrea Arcangeli
2004-03-18 19:01     ` Andrew Morton [this message]
2004-03-18 19:08       ` Takashi Iwai
2004-03-18 19:18         ` Andrew Morton
2004-03-18 19:20           ` Takashi Iwai
2004-03-18 19:43             ` Andrea Arcangeli
2004-03-18 19:50               ` Takashi Iwai
2004-03-18 19:24         ` Robert Love
2004-03-19 22:03           ` Valdis.Kletnieks
2004-03-19 22:12             ` Robert Love
2004-03-24 15:00               ` Takashi Iwai
2004-03-18 19:16       ` Takashi Iwai
2004-03-18 19:29         ` Andrew Morton
2004-03-18 19:48           ` Chris Mason
2004-03-19 11:37             ` Takashi Iwai
2004-03-19 13:46               ` Chris Mason
2004-03-19 14:06                 ` Takashi Iwai
     [not found]         ` <20040318221006.74246648.akpm@osdl.org>
2004-03-19 10:30           ` Takashi Iwai
2004-03-23  9:14             ` Dipankar Sarma
2004-03-19 17:22           ` Dipankar Sarma
2004-03-19 18:03             ` Andrew Morton
2004-03-20 12:24             ` Andrea Arcangeli
2004-03-20 13:13               ` Dipankar Sarma
2004-03-18 19:39       ` Andrea Arcangeli
2004-03-18 22:32     ` Andrew Morton
2004-03-18 22:54       ` Chris Mason
2004-03-18 23:57         ` Andrew Morton
2004-03-19 20:46           ` Takashi Iwai
2004-03-19 21:08             ` Andrew Morton
2004-03-19  3:07     ` Eric St-Laurent
2004-03-19 11:23       ` Takashi Iwai
2004-03-19 13:35         ` Chris Mason

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=20040318110159.321754d8.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjy@geizhals.at \
    --cc=tiwai@suse.de \
    /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

all inboxes | Powered by JetHome®