All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <willy@w.ods.org>
To: Con Kolivas <kernel@kolivas.org>
Cc: Soeren Sonnenburg <kernel@nn7.de>,
	Mark Hahn <hahn@physics.mcmaster.ca>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	gillb4@telusplanet.net
Subject: Re: xterm scrolling speed - scheduling weirdness in 2.6 ?!
Date: Sun, 4 Jan 2004 00:35:18 +0100	[thread overview]
Message-ID: <20040103233518.GE3728@alpha.home.local> (raw)
In-Reply-To: <200401040815.54655.kernel@kolivas.org>

On Sun, Jan 04, 2004 at 08:15:54AM +1100, Con Kolivas wrote:
> The bash bug was waiting on a pipe problem; not just bash alone. I was just 
> offering a suggestion. I have no idea what exactly to blame without evidence 
> of what's at fault.

Well, I did a few tests here with both 2.4.23 and 2.6.1rc1. In fact, it is
also partially xterm which is to blame, because it is not really that fast
on 2.4. Look below :

Context
=======

- X not reniced (0)
- cd to a directory with about 2500 files
- ls -l

1) Simple standard 'ls -l' in an xterm
======================================

2.4.23$ time ls -l

real    0m0.444s
user    0m0.090s
sys     0m0.020s

2.6.1rc1$ time ls -l

real    0m3.995s
user    0m0.081s
sys     0m0.035s

2) introduction of a pipe : ls -l | cat
=======================================

2.4.23$ time ls -l |cat

real    0m0.444s
user    0m0.090s
sys     0m0.020s

2.6.1rc1$ time ls -l|cat

real    0m0.486s
user    0m0.048s
sys     0m0.029s

3) it is not xterm which gets all the CPU either :
==================================================

2.4.23$ time xterm -e sh -c "ls -l"

real    0m0.462s
user    0m0.140s
sys     0m0.040s

2.6.1rc1$ time xterm -e sh -c "ls -l"

real    0m4.010s
user    0m0.236s
sys     0m0.079s

4) CPU is eaten by the X server itself !
========================================

It appears that on 2.4.23, xterm quickly switches over to jump scrolling
which prevents X from eating all CPU. On 2.6.1rc1, it is not the case.
If I disable jump scrolling and list 2 directories totalizing 4000 files :

2.4.23$ time xterm +j -e sh -c "ls -l incoming tmp"

real    0m7.137s
user    0m0.390s
sys     0m0.080s

2.6.1rc1$ time xterm +j -e sh -c "ls -l incoming tmp"

real    0m7.113s
user    0m0.314s
sys     0m0.121s

And here is what 'top' says during last command :

top - 23:37:54 up 17 min,  5 users,  load average: 0.72, 0.62, 0.50
Tasks:  58 total,   4 running,  54 sleeping,   0 stopped,   0 zombie
Cpu(s):  94.5% user,   5.5% system,   0.0% nice,   0.0% idle,   0.0% IO-wait
Mem:    515292k total,   510688k used,     4604k free,   175784k buffers
Swap:   265064k total,        0k used,   265064k free,    19400k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  Command           
  234 root      16   0 22400  12m  11m S 90.0  2.4   2:20.01 X                 
  417 root      19   0  4764 2660 3844 R  7.3  0.5   0:00.24 xterm             
  418 willy     20   0  1900 1100 1304 R  2.3  0.2   0:00.10 ls                
  394 willy     16   0  1692  940 1556 R  0.5  0.2   0:00.94 top               
    1 root      16   0   348  192  316 S  0.0  0.0   0:05.05 init              
    2 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0       
    3 root       5 -10     0    0    0 S  0.0  0.0   0:00.23 events/0          
    4 root       5 -10     0    0    0 S  0.0  0.0   0:00.24 kblockd/0         
    5 root      25   0     0    0    0 S  0.0  0.0   0:00.00 pdflush           

5) Tried again with X reniced to +10
====================================

2.6.1rc1$ xterm +j -e sh -c "ls -l incoming tmp"

top - 23:48:33 up 27 min,  6 users,  load average: 0.53, 0.46, 0.44
Tasks:  60 total,   2 running,  58 sleeping,   0 stopped,   0 zombie
Cpu(s):   4.9% user,   4.9% system,  90.2% nice,   0.0% idle,   0.0% IO-wait
Mem:    515292k total,   510652k used,     4640k free,   175712k buffers
Swap:   265064k total,        0k used,   265064k free,    19624k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  Command           
  234 root      35  10 22400  12m  11m R 92.0  2.4   3:58.50 X                 
  499 root      15   0  4764 2656 3844 S  4.0  0.5   0:00.24 xterm             
  500 willy     15   0  2024 1160 1416 S  3.0  0.2   0:00.10 ls                
    1 root      16   0   348  192  316 S  0.0  0.0   0:05.05 init              
    2 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0       
    3 root       5 -10     0    0    0 S  0.0  0.0   0:00.28 events/0          
    4 root       5 -10     0    0    0 S  0.0  0.0   0:00.24 kblockd/0         
    5 root      25   0     0    0    0 S  0.0  0.0   0:00.00 pdflush           
    6 root      15   0     0    0    0 S  0.0  0.0   0:00.00 pdflush           

And now with jump scrolling enabled again with X still reniced to +10 :

2.4.23$ time xterm -e sh -c "ls -l incoming tmp"

real    0m0.648s
user    0m0.230s
sys     0m0.040s

2.6.1rc1$ time xterm -e sh -c "ls -l incoming tmp"

real    0m0.691s
user    0m0.230s
sys     0m0.063s

6) Conclusion
=============

Under 2.4, xterm uses jump scrolling which it does not use by default under
2.6 if X responds fast enough. The first dirty solution which comes to mind
is to renice X to >+10 to slow it a bit so that xterm hits the high water
level and jumps.

But it's not an effect of the scheduler alone, but a side effect of the
scheduler and xterm both trying to automatically adjust their behaviour in
a different manner. If either the scheduler or xterm was a bit smarter or
used different thresholds, the problem would go away. It would also explain
why there are people who cannot reproduce it. Perhaps a somewhat faster or
slower system makes the problem go away. Honnestly, it's the first time that
I notice that my xterms are jump-scrolling, it was so much fluid anyway.

BTW, I found an even simplest way to reproduce the problem while ensuring
that it is not I/O related. For this, I use the 'seq' utility :

2.4.23$ $ time xterm -e seq 1 4000

real    0m0.142s
user    0m0.060s
sys     0m0.030s

2.4.23$ time xterm +j -e seq 1 4000

real    0m4.079s
user    0m0.100s
sys     0m0.080s

Cheers,
Willy


  reply	other threads:[~2004-01-03 23:35 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.44.0401031439060.24942-100000@coffee.psychology.mcmaster.ca>
2004-01-03 20:19 ` xterm scrolling speed - scheduling weirdness in 2.6 ?! Soeren Sonnenburg
2004-01-03 21:00   ` Con Kolivas
2004-01-03 21:10     ` Soeren Sonnenburg
2004-01-03 21:15       ` Con Kolivas
2004-01-03 23:35         ` Willy Tarreau [this message]
2004-01-04  0:11           ` Soeren Sonnenburg
2004-01-04  1:42           ` Con Kolivas
2004-01-04  3:32             ` Tim Connors
2004-01-04  5:58               ` Con Kolivas
2004-01-06  1:09                 ` Peter Osterlund
2004-01-06  1:37                   ` Nick Piggin
2004-01-06  2:28                     ` Peter Osterlund
2004-01-06  2:50                       ` Nick Piggin
2004-01-06  6:27                       ` Nick Piggin
2004-01-05 22:25               ` Bryan Whitehead
2004-01-04  8:09             ` Soeren Sonnenburg
2004-01-04  8:49               ` Con Kolivas
2004-01-04 11:13                 ` Martin Schlemmer
2004-01-04 11:24                   ` Soeren Sonnenburg
2004-01-04 12:45                   ` Con Kolivas
2004-01-04 14:42                     ` Martin Schlemmer
2004-01-04 18:40                       ` mikeg
2004-01-04 22:58                       ` szonyi calin
2004-01-04 23:33                         ` Willy Tarreau
2004-01-04 23:44                           ` Valdis.Kletnieks
2004-01-04 23:47                           ` Mike Fedyk
2004-01-05  8:39                             ` Soeren Sonnenburg
2004-01-05 20:38                               ` Martin Schlemmer
2004-01-05  9:18                             ` Soeren Sonnenburg
2004-01-05 17:20                               ` Martin Schlemmer
2004-01-05 17:21                                 ` Willy Tarreau
2004-01-05  9:50                             ` Kenneth Johansson
2004-01-05 10:17                               ` Soeren Sonnenburg
2004-04-02 18:22                               ` solved (was Re: xterm scrolling speed - scheduling weirdness in 2.6 ?!) Soeren Sonnenburg
2004-04-03  5:35                                 ` Tim Connors
2004-04-03  6:06                                   ` Tim Connors
2004-04-03 14:11                                     ` Jamie Lokier
2004-01-05  8:26                         ` xterm scrolling speed - scheduling weirdness in 2.6 ?! Soeren Sonnenburg
2004-01-04  8:54               ` Lincoln Dale
2004-01-04  9:17                 ` Nick Piggin
2004-01-04 10:24                   ` Soeren Sonnenburg
2004-01-04 11:12                     ` Mike Fedyk
2004-01-04 11:17                       ` Soeren Sonnenburg
2004-01-04 11:20                         ` Mike Fedyk
2004-01-04 11:19                       ` Willy Tarreau
2004-01-05  0:48                         ` Nick Piggin
2004-01-04 11:46                   ` Nicks's scheduler's OK [was Re: xterm scrolling speed - scheduling weirdness in 2.6 ?!] Willy Tarreau
2004-01-04 12:07                   ` xterm scrolling speed - scheduling weirdness in 2.6 ?! Willy Tarreau
2004-01-05  0:51                     ` Nick Piggin
2004-01-05 18:37                       ` Willy Tarreau
2004-01-06  0:33                         ` Nick Piggin
2004-01-04 10:11                 ` Soeren Sonnenburg
2004-01-05 10:31                   ` venom
2004-01-03 21:18     ` Willy Tarreau
2004-01-03 21:39 Bob Gill
     [not found] <Pine.LNX.4.44.0401031402210.24942-100000@coffee.psychology.mcmaster.ca>
2004-01-03 19:07 ` Soeren Sonnenburg
  -- strict thread matches above, loose matches on Subject: below --
2004-01-03 18:52 Soeren Sonnenburg
2004-01-03 19:19 ` Willy Tarreau
2004-01-04 20:47   ` Peter Chubb
2004-01-04 20:54     ` Willy TARREAU
2004-01-05  3:46       ` Peter Chubb

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=20040103233518.GE3728@alpha.home.local \
    --to=willy@w.ods.org \
    --cc=gillb4@telusplanet.net \
    --cc=hahn@physics.mcmaster.ca \
    --cc=kernel@kolivas.org \
    --cc=kernel@nn7.de \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.