From hsu@clinet.fi  Mon Jan 30 14:34:12 1995
Received: from clinet.fi (root@clinet.fi [193.64.6.1]) by freefall.cdrom.com (8.6.9/8.6.6) with ESMTP id OAA13407 for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Jan 1995 14:33:50 -0800
Received: from smile.clinet.fi (smile.clinet.fi [193.64.6.11]) by clinet.fi (8.6.9/8.6.4) with ESMTP id HAA02042 for <FreeBSD-gnats-submit@freebsd.org>; Sun, 29 Jan 1995 07:36:53 +0200
Received: (root@localhost) by smile.clinet.fi (8.6.9/8.6.4) id HAA28009; Sun, 29 Jan 1995 07:36:07 +0200
Message-Id: <199501290536.HAA28009@smile.clinet.fi>
Date: Sun, 29 Jan 1995 07:36:07 +0200
From: Heikki Suonsivu <hsu@clinet.fi>
Reply-To: hsu@clinet.fi
To: FreeBSD-gnats-submit@freebsd.org
Subject: 8M random access process makes 16M system swap
X-Send-Pr-Version: 3.2

>Number:         197
>Category:       kern
>Synopsis:       8M random access process makes 16M system swap
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 30 14:40:01 1995
>Closed-Date:    Mon Jan 30 19:44:21 PST 1995
>Last-Modified:
>Originator:     Heikki Suonsivu
>Release:        FreeBSD 2.0-RELEASE i386
>Organization:
Helsinki University of Technology, Finland
>Environment:

Jan 21 23:59:54 smile /kernel: FreeBSD 2.1.0-Development #1: Thu Jan 12 03:45:48 EET 1995
Jan 21 23:59:54 smile /kernel:     hsu@smile.clinet.fi:/usr/src/sys/compile/CLINET
Jan 21 23:59:54 smile /kernel: CPU: i486DX (486-class CPU)  Id = 0x435  Origin = "GenuineIntel"
Jan 21 23:59:54 smile /kernel: real memory  = 16384000 (4000 pages)
Jan 21 23:59:54 smile /kernel: avail memory = 14168064 (3459 pages)
Jan 21 23:59:54 smile /kernel: using 290 buffers containing 2379776 bytes of memory
Jan 21 23:59:54 smile /kernel: Probing for devices on the ISA bus:
Jan 21 23:59:54 smile /kernel: sc0 at 0x60-0x6f irq 1 on motherboard
Jan 21 23:59:54 smile /kernel: sc0: VGA color <4 virtual consoles>
Jan 21 23:59:54 smile /kernel: ed0 at 0x280-0x29f irq 5 maddr 0xd8000 msize 16384 on isa
Jan 21 23:59:55 smile /kernel: ed0: address 00:00:c0:bd:c1:23, type WD8013EP (16 bit) 
Jan 21 23:59:55 smile /kernel: bpf: ed0 attached
Jan 21 23:59:55 smile /kernel: ed1 not probed due to maddr conflict with ed0 at 0xd8000
Jan 21 23:59:55 smile /kernel: sio0 at 0x3f8-0x3ff irq 4 on isa
Jan 21 23:59:55 smile /kernel: sio0: type 16450
Jan 21 23:59:55 smile /kernel: sio1 at 0x2f8-0x2ff irq 3 on isa
Jan 21 23:59:55 smile /kernel: sio1: type 16550A
Jan 21 23:59:55 smile /kernel: sio2 not found at 0x3e8
Jan 21 23:59:55 smile /kernel: sio3 not found at 0x2e8
Jan 21 23:59:55 smile /kernel: cy0 at 0x0 irq 10 maddr 0xd4000lpt0 at 0x378-0x37f irq 7 on isa
Jan 21 23:59:55 smile /kernel: lpt0: Interrupt-driven port
Jan 21 23:59:55 smile /kernel: lp0: TCP/IP capable interface
Jan 21 23:59:55 smile /kernel: lpt1 not found at 0xffffffff
Jan 21 23:59:55 smile /kernel: lpt2 not found at 0xffffffff
Jan 21 23:59:55 smile /kernel: fdc0 at 0x3f0-0x3f7 irq 6 drq 2 on isa
Jan 21 23:59:55 smile /kernel: fdc0: [0: fd0: 1.44MB 3.5in]
Jan 21 23:59:55 smile /kernel: wdc0 at 0x1f0-0x1f7 irq 14 on isa
Jan 21 23:59:56 smile /kernel: wdc0: unit 0 (wd0): <DSAA-3540>
Jan 21 23:59:56 smile /kernel: wd0: 504MB (1032192 total sec), 1024 cyl, 16 head, 63 sec, bytes/sec 512
Jan 21 23:59:56 smile /kernel: wdc0: unit 1 (wd1): <ST3491A-XR>
Jan 21 23:59:56 smile /kernel: wd1: 408MB (836070 total sec), 899 cyl, 15 head, 62 sec, bytes/sec 512
Jan 21 23:59:56 smile /kernel: wdc1 not found at 0x170
Jan 21 23:59:56 smile /kernel: bt0 not found at 0x330
Jan 21 23:59:56 smile /kernel: uha0 not found at 0x330
Jan 21 23:59:56 smile /kernel: ahc0 not probed due to I/O address conflict with cy0 at 0x0
Jan 21 23:59:56 smile /kernel: ahb0 not probed due to I/O address conflict with cy0 at 0x0
Jan 21 23:59:56 smile /kernel: aha0: reading board settings, dma=5 int=11  (bus speed defaulted)
Jan 21 23:59:56 smile /kernel: aha0 at 0x330-0x333 irq 11 drq 5 on isa
Jan 21 23:59:56 smile /kernel: aha0 waiting for scsi devices to settle
Jan 21 23:59:56 smile /kernel: aha0 targ 4 lun 0: type 1(sequential) removable SCSI2
Jan 21 23:59:56 smile /kernel: aha0 targ 4 lun 0: <WangDAT Model 3400DX    1.10>
Jan 21 23:59:56 smile /kernel: st0: density code 0x13,  drive empty
Jan 21 23:59:56 smile /kernel: aic0 not found at 0x340
Jan 21 23:59:57 smile /kernel: pas0 not found at 0x1f88
Jan 21 23:59:57 smile /kernel: sea0 not probed due to I/O address conflict with cy0 at 0x0
Jan 21 23:59:57 smile /kernel: wt0 not found at 0x300
Jan 21 23:59:57 smile /kernel: mcd0: timeout getting status
Jan 21 23:59:57 smile /kernel: mcd0 not found at 0x300
Jan 21 23:59:57 smile /kernel: mcd1: timeout getting status
Jan 21 23:59:57 smile /kernel: mcd1 not found at 0x340
Jan 21 23:59:57 smile /kernel: ie0 not found at 0x360
Jan 21 23:59:57 smile /kernel: ep0 not found at 0x300
Jan 21 23:59:57 smile /kernel: is0 not probed due to I/O address conflict with ed0 at 0x280
Jan 21 23:59:57 smile /kernel: le0: no board found at 0x300
Jan 21 23:59:57 smile /kernel: le0 not found at 0x300
Jan 21 23:59:57 smile /kernel: ze0 not probed due to maddr conflict with ed0 at 0xd8000
Jan 21 23:59:57 smile /kernel: npx0 on motherboard
Jan 21 23:59:57 smile /kernel: npx0: INT 16 interface
Jan 21 23:59:57 smile /kernel: wd1: changing size of 'd' partition from 410130 to 836070
Jan 21 23:59:57 smile /kernel: bpf: ds0 attached
Jan 21 23:59:58 smile /kernel: bpf: lo0 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp0 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp1 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp2 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp3 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp4 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp5 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp6 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp7 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp8 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp9 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp10 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp11 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp12 attached
Jan 21 23:59:58 smile /kernel: bpf: ppp13 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp14 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp15 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp16 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp17 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp18 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp19 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp20 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp21 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp22 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp23 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp24 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp25 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp26 attached
Jan 21 23:59:59 smile /kernel: bpf: ppp27 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp28 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp29 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp30 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp31 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp32 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp33 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp34 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp35 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp36 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp37 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp38 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp39 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp40 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp41 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp42 attached
Jan 22 00:00:00 smile /kernel: bpf: ppp43 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp44 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp45 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp46 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp47 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp48 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp49 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp50 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp51 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp52 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp53 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp54 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp55 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp56 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp57 attached
Jan 22 00:00:01 smile /kernel: bpf: ppp58 attached
Jan 22 00:00:02 smile /kernel: bpf: ppp59 attached
Jan 22 00:00:02 smile /kernel: bpf: ppp60 attached
Jan 22 00:00:02 smile /kernel: bpf: ppp61 attached
Jan 22 00:00:02 smile /kernel: bpf: ppp62 attached
Jan 22 00:00:02 smile /kernel: bpf: ppp63 attached
Jan 22 00:00:02 smile /kernel: bpf: sl0 attached
Jan 22 00:00:02 smile /kernel: bpf: sl1 attached
Jan 22 00:00:02 smile /kernel: bpf: sl2 attached
Jan 22 00:00:02 smile /kernel: bpf: sl3 attached
Jan 22 00:00:02 smile /kernel: bpf: sl4 attached
Jan 22 00:00:02 smile /kernel: bpf: sl5 attached
Jan 22 00:00:02 smile /kernel: bpf: sl6 attached
Jan 22 00:00:02 smile /kernel: bpf: sl7 attached

>Description:

	Running a process which does random access through a 8M area
	in a 16M machine makes the system swap wildly.  This can be 
	reproduced by a simple program, and running X with several windows and
	doing a kernel compile the same time in a 16M machine also makes
	the system swap (this does't happen with Linux, cc stays cpu-
	limited).

	Top output follows:

load averages:   2.18,  1.55,  1.90                                    07:09:42
36 processes:  6 running, 29 sleeping, 1 zombie
Cpu states:  2.7% user,  0.0% nice, 64.8% system, 32.3% interrupt,  0.2% idle
Memory: 7420K Act 1004K Inact 4904K Wired 76K Free 16% Swap, 2232K/2600K SWIO

  PID USERNAME PRI NICE   SIZE   RES STATE   TIME   WCPU    CPU COMMAND
27852 hsu       74    0  8328K 7024K run     0:17 39.20% 36.57% tahma
    2 root     -18    0     0K   12K sleep   8:12 36.23% 36.23% pagedaemon
    3 root      28    0     0K   12K sleep   8:26 25.39% 25.39% vmdaemon
27649 hsu      -18    0  2120K  288K sleep   2:20  7.91%  7.91% emacs
27607 root      32    0   252K   76K run     2:27  4.54%  4.54% dd
27851 root     -18  -20   420K  164K run     0:02  2.51%  2.44% top
27659 hsu        2    0   508K   28K sleep   0:14  0.49%  0.49% xterm
    0 root     -18    0     0K    0K sleep   0:15  0.34%  0.34% swapper
27650 hsu       18    0   204K   92K sleep   0:05  0.00%  0.00% wakeup
27736 root      18    0   712K   40K sleep   0:05  0.00%  0.00% tcsh
27660 hsu       18    0   696K   40K sleep   0:03  0.00%  0.00% tcsh
27648 hsu       18    0   688K   12K sleep   0:01  0.00%  0.00% <tcsh>
27606 root      18    0   432K   12K sleep   0:00  0.00%  0.00% csh
   61 root      18    0   368K   12K sleep   0:14  0.00%  0.00% cron
  566 nippp     18    0   268K    0K sleep   0:00  0.00%  0.00% <pppd>

What is Inactive memory and why is the kernel keeping it idle?
If BSD memory management is really supposed to work like this, then it
probably needs a redesign.

Neither Linux nor SunOS do this.

>How-To-Repeat:

Run this on a 16M machine.

#define BUFFER_SIZE (8 * 1024 * 1024)

main()
{
  static char buffer[BUFFER_SIZE];
  int x;
  
  for (;;)
    {
      int offset = random() % BUFFER_SIZE;
      x += buffer[offset];
    }
}


>Fix:
	
Don't know.  Memory prices still being largest single consideration in
most configurations running Free OS'es it is a problem to get only half
of the available memory into use.

1.1.5.1 behaved similarly, but it seemed to be different problem.  top
said 16M free, 12M wired (?) in a loaded 32M system.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: davidg 
State-Changed-When: Mon Jan 30 19:44:21 PST 1995 
State-Changed-Why:  
This report doesn't mention a bug and shouldn't have been filed in the 
first place. 
>Unformatted:



