public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Subtle MM bug
@ 2001-01-08  5:29 Wayne Whitney
  2001-01-08  5:42 ` Andi Kleen
  2001-01-08 17:16 ` Rik van Riel
  0 siblings, 2 replies; 95+ messages in thread
From: Wayne Whitney @ 2001-01-08  5:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: William A. Stein


On Sunday, January 7, 20001, Rik van Riel <riel@conectiva.com.br> wrote:

> Now if 2.4 has worse _performance_ than 2.2 due to one reason or
> another, that I'd like to hear about ;)

Well, here is a workload that performs worse on 2.4.0 than on 2.2.19pre,
and as it is the usual workload on my little cluster of 3 machines, they
are all running 2.2.19pre:

The application is some mathematics computations (modular symbols) using a
package called MAGMA;  at times this requires very large matrices.  The
RSS can get up to 870MB; for some reason a MAGMA process under linux
thinks it has run out of memory at 870MB, regardless of the actual
memory/swap in the machine.  MAGMA is single-threaded.

The typical machine is a dual Intel box with 512MB RAM and 512MB swap.
There is no problem with just one MAGMA process, it just hits that 870MB
barrier and gracefully exits.  But if I do the following test, I notice
very different behaviour under 2.2 and 2.4:  while running 'top d 1' I
simultaneously launch two instances of a job which actually requires more
than 870MB of memory to complete.  So each instance will slowly grow in
RSS until it gets killed by OOM or hits that 870MB limit.

Under 2.2, everything proceeds smoothly: before physical RAM is exhausted,
top updates every second, and the jobs have all the CPU.  When swapping
kicks in, top updates every 1-2 seconds and lists most of the CPU as
'system' (kswapd), but I perceive not much loss of interactivity.
Eventually the 1GB of virtual memory is exhausted, the OOM killer kills
one of the MAGMA's, and the other runs till it hits the 870MB barrier and
exits.

But under 2.4, interactivity suffers as soon as physical RAM is exhausted.
Top only updates every 2-10 seconds, the load average hits 3-4, and top
reports the CPUs are 90% idle.  Eventually, the OOM killer kicks in and
all returns to normal.  For practical purposes, the machine is unusual
while swapping like this.

I have heard 'vmstat' mentioned here, so below is the output of a 'vmstat
1' concommitant with the test above (top and the two MAGMA jobs).  I would
be more than happy to provide any other relevant information about this.

I read the LKML via an archive that updates once a day, so please cc: me
if you would like a speedier response.  I wish I knew of a newsgroup
interface to the LKML, then I could read it more often :-).

Cheers,
Wayne


   procs                      memory    swap          io     system         cpu
 r  b  w   swpd   free   buff  cache  si  so    bi    bo   in    cs  us  sy  id
 0  0  0  49180 447840    840  54104 269 969    84   244   76   236  10   4  86
 1  0  0  49180 443276    852  55972   0   0   470     0  163   150  15   2  83
 2  0  0  49180 440060    852  56292   0   0    80     0  115    60  93   1   6
 2  0  0  49180 438236    856  56292   0   0     1     0  107    53  99   1   0
 2  0  0  49180 429468    856  56392   0   0    25     0  109    16  99   0   0
 2  0  0  49180 421296    856  56392   0   0     0     0  104    13  98   2   0
 2  0  0  49180 421132    856  56392   0   0     0     0  108    53 100   0   0
 2  0  0  49180 421128    856  56392   0   0     0     0  108    47 100   0   0
 2  0  0  49180 397520    856  56392   0   0     0     1  107    49  96   4   0
 2  0  0  49180 364860    856  56392   0   0     0     0  106    47  95   5   0
 2  0  0  49180 332244    856  56392   0   0     0     0  106    49  95   5   0
 2  0  0  49180 299660    856  56392   0   0     0     0  106    54  92   8   0
 2  0  0  49180 267076    856  56392   0   0     0     0  109    56  95   5   0
 2  0  0  49180 234632    856  56392   0   0     0     0  110    57  94   6   0
 2  0  0  49180 202096    872  56448  32   0    18     0  117    70  95   5   0
 2  0  0  49180 169544    872  56448   0   0     0     0  103    13  96   4   0
 2  0  0  49180 137108    872  56448   0   0     0     0  107    49  93   7   0
 2  0  0  49180 104600    872  56448   0   0     0     0  107    51  94   6   0
 2  0  0  49180  72368    872  56448   0   0     0    52  136    54  93   7   0
 2  0  0  49180  39964    872  56448   0   0     0     0  110    59  92   8   0
 2  0  2   7296   1576     96  13072   0 720     0   184  130   465  74  22   4
   procs                      memory    swap          io     system         cpu
 r  b  w   swpd   free   buff  cache  si  so    bi    bo   in    cs  us  sy  id
 1  2  2  53620   1564    116  23512 1012 31876   565  7969  883  3802   1   8  92
 2  1  2  68800   1560     96  20128  68 15396    17  3850  291  2775   1   7  92
 3  0  1  99484   1556     96  26096  84 29552    21  7388  594  3832   1   4  95
 1  3  2 114708   1560    104  32528 284 14696   161  3674  374  3125   0   4  96
 1  4  2 175484   1560    124  31112 360 63000   237 15753 1404 14952   1   5  94
 1  2  2 205900   1560     96  32748  12 30080     3  7520  606  8356   1   5  94
 2  1  2 221156   1560     96  17848 412 14256   103  3564  308  8450   1  10  89
 1  2  2 222128   1564     96  12736   0 16100     7  4025  346  1010   0   5  95
 1  2  2 236580   1560    108  15220 276 13988    97  3497  347  4102   0   7  92
 2  1  2 267488   1560    104  32044 260 17376    69  4346  405  1265   0   7  93
 3  1  1 282756   1560     96  29380  16 15304     4  3827  335  4359   1   7  92
 2  1  2 282756   1580     96  11460  92 14948    23  3737  332  4120   1   5  94
 2  1  2 313496   1560    100  30476 200 15484    54  3871  318  2359   0   9  90
 2  1  2 313496   1560    100  14148   0 13076     1  3270  246  5165   1   8  91
 3  1  1 344564   1572     96  23892  16 18444    11  4613  419  1555   0   7  93
 2  1  2 375020   1560     96  25400 172 26988    43  6747  556  2910   1   7  93
 1  2  2 375020   1968     96  22760   8 17136     2  4284  378   787   0   2  98
 2  1  2 406056   1568     96  20432 212 17320    53  4330  393  2704   1  10  89
 3  0  3 421316   1560     96  25056  72 14416    18  3604  281  1731   0   5  94
 1  3  0 452120   1544    100  21216 240 31480   116  7870  715  2681   1   6  94
 2  2  2 467488   1588    108  27248 440 15056   123  3765  385  2206   0   5  94
   procs                      memory    swap          io     system         cpu
 r  b  w   swpd   free   buff  cache  si  so    bi    bo   in    cs  us  sy  id
 2  1  0 467488   1564    136  13352  88 15376    49  3844  368  2913   1   4  95
 3  0  1 482864   1560     96  15256 128 15384    32  3846  296   986   1   7  92
 3  0  1 497920   1560     96  14144   0 12636     0  3159  245  2302   1   9  90
 3  1  1 529844   1540     96  18632 940 33340   569  8336 1104  1366   1  10  88
 0  1  0 269856 205944    148  21772 2628   0  1196     2  267   313   0   3  97
 0  1  0 269856 182736    156  33180 11180   0  2854     0  309   451   6   3  91
 0  1  0 269856 158668    156  44696 11516   0  2879     0  314   462  12   4  83
 0  1  0 269856 131928    156  57588 12892   0  3223     0  312   466   8   4  88
 0  1  0 269856 105176    156  70448 12864   0  3216     0  332   506  12   3  85
 0  1  0 269856  79056    156  82644 12196   0  3049     0  456   602  10   6  83
 1  1  0 269856  46948    156  96900 14252   0  3563     0  359   518  21   7  72

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 95+ messages in thread
* Re: Subtle MM bug
@ 2001-01-10 19:57 Chris Wing
  0 siblings, 0 replies; 95+ messages in thread
From: Chris Wing @ 2001-01-10 19:57 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan:

> I've seen exactly nil cases where there are any security holes in apps caused
> by that pthreads api non adherance. 

I don't know of any exploitable bugs that were found in it, but the identd
server included in Red Hat 6.1 (pidentd 3.0.10) unintentionally ran as
root instead of nobody because its programmer used pthreads and assumed
that setuid() would affect all threads.

I pointed this out to the author and Red Hat, and it was fixed in
pidentd 3.0.11 and Red Hat 6.2.

-Chris Wing
wingc@engin.umich.edu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 95+ messages in thread
* Re: Subtle MM bug
@ 2001-01-08 20:39 Szabolcs Szakacsits
  2001-01-08 21:56 ` Wayne Whitney
  2001-01-08 22:00 ` Wayne Whitney
  0 siblings, 2 replies; 95+ messages in thread
From: Szabolcs Szakacsits @ 2001-01-08 20:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andi Kleen, Wayne Whitney


Andi Kleen <ak@suse.de> wrote:
> On Sun, Jan 07, 2001 at 09:29:29PM -0800, Wayne Whitney wrote:
> > package called MAGMA; at times this requires very large matrices. The
> > RSS can get up to 870MB; for some reason a MAGMA process under linux
> > thinks it has run out of memory at 870MB, regardless of the actual
> > memory/swap in the machine. MAGMA is single-threaded.
> I think it's caused by the way malloc maps its memory.
> Newer glibc should work a bit better by falling back to mmap even
> for smaller allocations (older does it only for very big ones)

AFAIK newer glibc = CVS glibc but the malloc() tune parameters
work via environment variables for the current stable ones as well,
e.g. to overcome the above "out of memory" one could do,
% export MALLOC_MMAP_MAX_=1000000
% export MALLOC_MMAP_THRESHOLD_=0
% magma

At default, on a 32bit Linux current stable glibc malloc uses brk
between 0x08??????-0x40000000 and max (MALLOC_MMAP_MAX_) 128 mmap if
the requested chunk is greater than 128 kB (MALLOC_MMAP_THRESHOLD_).
If MAGMA mallocs memory in less than 128 kB chunks then the above out
of memory behaviour is expected.

	Szaka

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 95+ messages in thread
* Subtle MM bug
@ 2001-01-07 20:59 Zlatko Calusic
  2001-01-07 21:37 ` Rik van Riel
  0 siblings, 1 reply; 95+ messages in thread
From: Zlatko Calusic @ 2001-01-07 20:59 UTC (permalink / raw)
  To: linux-kernel, linux-mm

I'm trying to get more familiar with the MM code in 2.4.0, as can be
seen from lots of questions I have on the subject. I discovered nasty
mm behaviour under even moderate load (2.2 didn't have troubles).

Things go berzerk if you have one big process whose working set is
around your physical memory size. Typical memory hoggers are good
enough to trigger the bad behaviour. Final effect is that physical
memory gets extremely flooded with the swap cache pages and at the
same time the system absorbs ridiculous amount of the swap space.
xmem is as usual very good at detecting this and you just need to
press Alt-SysReq-M to see that most of the memory (e.g. 90%) is
populated with the swap cache pages.

For instance on my 192MB configuration, firing up the hogmem program
which allocates let's say 170MB of memory and dirties it leads to
215MB of swap used. vmstat 1 shows that the pagecache size is
constantly growing - that is swapcache enlarging in fact - during the
second pass of the hogmem program.

...
   procs                      memory    swap          io     system         cpu
 r  b  w   swpd  free buff  cache   si   so    bi    bo   in    cs  us  sy  id
 0  1  1 131488  1592  400  62384 4172 5188  1092  1298  353  1447   2   4  94
 0  1  1 136584  1592  400  67428 5860 4104  1465  1034  322  1327   3   3  93
 0  1  1 141668  1592  388  72536 5504 4420  1376  1106  323  1423   1   3  95
 0  1  1 146724  1592  380  77592 5996 4236  1499  1060  335  1096   2   3  94
 0  1  1 151876  1600  320  82764 6264 3712  1566   936  327  1226   3   4  93
 0  1  1 157016  1600  320  87908 5284 4268  1321  1068  315  1248   1   2  96
 1  0  0 157016  1600  308  87792 1836 5168   459  1293  281  1324   3   3  94
 0  1  0 162204  1600  304  92892 7784 5236  1946  1315  385  1353   3   5  92
 0  1  0 167216  1600  304  97780 3496 5016   874  1256  301  1222   0   2  97
 0  1  1 177904  1608  284 108276 5160 5168  1290  1300  330  1453   1   4  94
 0  1  2 182008  1588  288 112264 4936 3344  1268   838  293   801   2   3  95
 0  2  1 183620  1588  260 114012 3064 1756   830   445  290   846   0  15  85
 0  2  2 185384  1596  180 115864 2320 2620   635   658  285   722   1  29  70
 0  3  2 187528  1592  220 117892 2488 2224   657   557  273   754   3  30  67
 0  4  1 190512  1592  236 120772 2524 3012   725   760  343  1080   1  14  85
 0  4  1 195780  1592  240 125868 2336 5316   613  1331  381  1624   2   2  96
 1  0  1 200992  1592  248 131052 2080 2176   623   552  234  1044   3  23  74
 0  1  0 200996  1592  252 130948 2208 3048   580   762  256  1065  10  10  80
 0  1  1 206240  1592  252 136076 2988 5252   760  1314  309  1406   7   4  8
 0  2  1 211408  1592  256 141080 5424 5180  1389  1303  395  1885   3   5  91
 0  2  0 214744  1592  264 144280 4756 3328  1223   834  327  1211   1   5  95
 1  0  0 214868  1592  244 144468 4344 5148  1087  1295  303  1189  11   2  86
 0  1  1 214900  1592  248 144496 4360 3244  1098   812  318  1467   7   4  89
 0  1  1 214916  1592  248 144520 4280 3452  1070   865  336  1602   3   3  94
 0  1  1 214964  1592  248 144580 4972 4184  1243  1054  368  1620   3   5  92
 0  2  2 214956  1592  272 144548 3700 4544  1081  1142  665  2952   1   1  98
 0  1  0 214992  1592  272 144588 1220 5088   305  1274  282  1363   1   4  95
 0  1  1 215012  1592  272 144600 3640 4420   910  1106  325  1579   3   2  9

Any thoughts on this?
-- 
Zlatko
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2001-04-17 19:40 UTC | newest]

Thread overview: 95+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-08  5:29 Subtle MM bug Wayne Whitney
2001-01-08  5:42 ` Andi Kleen
2001-01-08  6:04   ` Linus Torvalds
2001-01-08 17:44     ` Rik van Riel
2001-01-08 18:02       ` Linus Torvalds
2001-01-08 17:16 ` Rik van Riel
2001-01-08 17:58   ` Linus Torvalds
2001-01-08 23:41     ` Zlatko Calusic
2001-01-09  2:58       ` Linus Torvalds
2001-01-09  6:20       ` Eric W. Biederman
2001-01-09  7:27         ` Linus Torvalds
2001-01-09 11:38           ` Eric W. Biederman
2001-01-09 12:29           ` Zlatko Calusic
2001-01-09 18:47             ` Linus Torvalds
2001-01-09 19:09               ` Daniel Phillips
2001-01-09 19:29                 ` Trond Myklebust
2001-01-10 17:32                   ` Andi Kleen
2001-01-10 19:31                     ` Alan Cox
2001-01-10 19:33                       ` Andi Kleen
2001-01-10 19:40                         ` Alan Cox
2001-01-10 19:43                           ` Andi Kleen
2001-01-10 19:48                             ` Alan Cox
2001-01-10 19:48                               ` Andi Kleen
2001-01-11  9:51                               ` Trond Myklebust
2001-01-10 20:11                       ` Linus Torvalds
2001-01-11 12:56                         ` Stephen C. Tweedie
2001-01-11 13:10                           ` Andi Kleen
2001-01-11 13:12                           ` Trond Myklebust
2001-01-11 14:13                             ` Stephen C. Tweedie
2001-01-11 19:03                               ` Alexander Viro
2001-01-11 19:47                                 ` Stephen C. Tweedie
2001-01-11 19:57                                   ` Alexander Viro
2001-01-11 16:50                           ` Albert D. Cahalan
2001-01-11 17:35                             ` Stephen C. Tweedie
2001-01-11 19:38                               ` Albert D. Cahalan
2001-01-11 19:01                           ` Alexander Viro
2001-01-09 19:37                 ` Linus Torvalds
2001-01-17  8:46                 ` Rik van Riel
2001-01-25 22:51                   ` Daniel Phillips
2001-01-09 19:53               ` Simon Kirby
2001-01-09 20:08                 ` Linus Torvalds
2001-01-09 20:10                 ` Zlatko Calusic
2001-01-10  1:45               ` David Woodhouse
2001-01-10  2:26                 ` Andrea Arcangeli
2001-01-10  6:57                 ` Linus Torvalds
2001-01-10 11:46                   ` David Woodhouse
2001-01-10 14:56                     ` Andrea Arcangeli
2001-01-10 17:46                       ` Eric W. Biederman
2001-01-10 18:33                         ` Andrea Arcangeli
2001-01-17 14:26                           ` Rik van Riel
2001-01-10 19:03                         ` Linus Torvalds
2001-01-10 19:27                           ` David S. Miller
2001-01-10 19:36                           ` Alan Cox
2001-01-10 23:56                             ` David Weinehall
2001-01-11  0:24                               ` Alan Cox
2001-01-12  5:56                               ` Ralf Baechle
2001-01-12 16:10                                 ` Eric W. Biederman
2001-01-12 21:11                                   ` Russell King
2001-01-15  2:56                                     ` Ralf Baechle
2001-01-15  6:59                                       ` Eric W. Biederman
2001-01-15  2:53                                   ` Ralf Baechle
2001-01-15  8:41                                     ` Caches, page coloring, virtual indexed caches, and more Eric W. Biederman
2001-01-15 11:54                                       ` Ralf Baechle
2001-01-15 12:53                                         ` Anton Blanchard
2001-01-15 17:41                                           ` Ralf Baechle
2001-01-17  4:36                                             ` Anton Blanchard
2001-01-16  9:34                                           ` Eric W. Biederman
2001-01-17  4:43                                             ` Anton Blanchard
2001-01-17  8:35                                               ` Eric W. Biederman
2001-01-15 17:16                                         ` Eric W. Biederman
2001-01-16  4:58                                           ` Ralf Baechle
2001-01-15 18:22                                         ` Jamie Lokier
2001-01-15 12:51                                       ` Anton Blanchard
2001-01-17 14:28                           ` Subtle MM bug Rik van Riel
2001-01-18  1:23                             ` Linus Torvalds
2001-01-18 11:48                               ` Rik van Riel
2001-01-10 17:03                     ` Linus Torvalds
2001-01-11 14:36                       ` Jim Gettys
2001-01-08 21:30   ` Wayne Whitney
  -- strict thread matches above, loose matches on Subject: below --
2001-01-10 19:57 Chris Wing
2001-01-08 20:39 Szabolcs Szakacsits
2001-01-08 21:56 ` Wayne Whitney
2001-01-08 23:22   ` Wayne Whitney
2001-01-08 23:30     ` Andrea Arcangeli
2001-01-09  0:37       ` Linus Torvalds
2001-01-08 22:00 ` Wayne Whitney
2001-01-08 22:15   ` Andrea Arcangeli
2001-01-07 20:59 Zlatko Calusic
2001-01-07 21:37 ` Rik van Riel
2001-01-07 22:33   ` Zlatko Calusic
2001-01-09  2:01   ` Zlatko Calusic
2001-01-17  4:48     ` Rik van Riel
2001-01-17 18:53       ` Zlatko Calusic
2001-01-18  1:32         ` Rik van Riel
2001-04-17 19:37           ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox