PROBLEM:        (ISO100191,42778)       (Patch ID: OSF360-350138)
********
When a user changes virtual memory (vm) tuning parameters due to slow
performance and reboots the machine, the system panics.  This can occur when
setting vm tuning parameters to improve X Windows performance in systems under
heavy memory loads.  This problem is commonly referred to as "window freeze"
and was first discovered on Alphastation 500/600's. Note, the problem is not
exclusive to 500/600's.

The following is an example of a system panic:

Digital UNIX boot - Tue Jan 30 21:31:11 EST 1996

Loading vmunix ...
Loading at fffffc0000230000
Current PAL Revision <0x1000000010111>
Switching to OSF PALcode Succeeded
New PAL Revision <0x1000000020115>

Sizes:
text = 4149488
data = 777600
bss  = 2298896
Starting at 0xfffffc00004cb8f0

trap: invalid memory read access from kernel mode

    faulting virtual address:     0x0000000000000040
    pc of faulting instruction:   0xfffffc00004b2080
    ra contents at time of fault: 0xfffffc00004b207c
    sp contents at time of fault: 0xffffffffffff78c0

panic (cpu 0): kernel memory fault

DUMP: No primary swap, no explicit dumpdev.
          Nowhere to put header, giving up.

halted CPU 0

halt code = 5
HALT instruction executed
PC = fffffc00004cd350
>>>

WORKAROUND:

Apply this patch and determine whether the vm tuning parameters should be
adjusted.  The guidelines for changing vm tuning parameters are listed below.

VERIFICATION / VM TUNING PARAMETER ADJUSTMENTS:

The windowing system on AlphaStation 500/600's may experience
poor window response in a heavy paging environment.  Although this problem
occurs on all platforms, it is most pronounced on AlphaStation 500/600's.

Mouse movement on the system is uneffected, but windowing operations
such as exposing a window, dragging a window, and so on, are degraded.
When this condition occurs, you may not be able to telnet or rlogin to the
system.  These symptoms can occur for some period of time (greater than 2
minutes), or may subside after a few seconds. The cause of these symptoms is
due to a memory intensive application(s) depleting the number of pages on the
free list to an absolute minimum.  When this occurs, only privileged tasks
are able to get memory (for example, free pages) and all others tasks are
blocked (in this case the window manager).

Check to see if your system is experiencing this problem by running "vmstat 2"
in a separate xterm while your application(s) are running. Your system will
display output similar to the following:

#
  vmstat 2
Virtual Memory Statistics: (pagesize = 8192)
  procs    memory         pages                          intr        cpu
 r  w  u  act  free wire fault cow zero react pin pout  in  sy  cs  us sy  id
  2 37 15  5832 4021 1108  20K 5975 4575  285 4761    0  62 196 266   1 1  98
  2 37 15  5851 4002 1108   99   13   50    0    8    0   4  13 239   0 1  99
  3 37 15  7039 2788 1134   26    0   26    0    0    0  17  51 255   1 9  90
  3 37 15  9791   10 1140 7291   17 7258    0   13   48 288  12 422   1 68  31
  3 37 15  9790    9 1149 1049    0 1048   39    1  146 472  15 527   0 32  68
  3 36 15  9784    9 1116  743    0  741    0    2  106 446  12 466   0 22  78
  3 36 15  9811    9 1096  460    0  459    0    1  107 434  12 459   0 20  79

Note the amount of free pages available under the column "free".  If this
number falls below the reserved amount (vm-page-free-reserved), your system
has hit this condition.

In the previous example, "vm-page-free-reserved" is set to its default value
of ten pages.  The previous example shows that the VM subsystem has been
overwhelmed.  If this is the case on your system, you will most likely
experience degraded window performance along with other performance
degradations. If the vmstat output on your system does not exhibit these
results (or similar ones), DO NOT tune your system per the recommendations
in this note.

GUIDELINES FOR CHANGING VM TUNING PARAMETERS:

1. Run "vmstat 2" to determine if vm tuning parameters should be changed.  
  (See previous section, "PROBLEM VERIFICATION").

2. Update the vm-page-free-target, vm-page-free-optimal, and vm-page-free-min
tuning parameters in the /etc/sysconfigtab file.  If your system has less
than 128 MB of memory, try doubling from the default values until you reach
a happy medium between application performance and user interactivity.  Note,
the default values are 128, 74, and 20, respectively.  Refer to the "System
Tuning and Performance Management Manual" for more information on system tuning.

The following parameter values provide fairly good interactivity with moderate
performance degradation on a Alphastation 6000 with 128M of physical memory:

vm:
 vm-page-free-target=4096
 vm-page-free-optimal=4096
 vm-page-free-min=2048

The numbers provided in the previous example are designed to keep a larger
than normal number of pages on the free list (as a buffer) by starting to page
earlier than normal (via a larger vm-page-free-min) and by stopping paging
later than usual (via a larger vm-page-free-target).  In addition, swapping
of tasks is enhanced to force the memory crunching task to be swapped out
occasionally (via a larger vm-page-free-optimal). You may find that your
system behaves fine with some manipulation of these parameters.  Note
that these tuning parameters were devised to provide some level of user
interactivity in a heavy paging/swapping environment.  They may not be the
best solution for your particular needs, but may provide a reasonable starting
place. Note, if your system does not have 128M of memory, pare down these
numbers. The units for these values are pages (which are 8KB) resulting in
some hefty chunks of memory (for example, 32MB).  Again, try doubling the
default values until you reach some happy medium. You can check the default
values using dbx as follows:

# dbx -k /vmunix

(dbx) p vm_page_free_target
2048
(dbx) p vm_page_free_optimal
1029
(dbx) p vm_page_free_min
20
(dbx) p vm_page_free_reserved
10

3. Reboot the system.

4. Raise the priority of the window manager (mwm or dtwn).
   a. Open a DECterm and kill the currently running manager.  For example:

      kill -9 pid

      Note that the pid is the process ID of the window manager found using
      the ps ax command.

   b. Restart the window manager using the system utility "nice".  For example:

      nice -2 mwm &

      or

      nice -2 dtwm &

If the system is tuned correctly, what you should see happen is a small
latency when the memory intensive application starts which will balance as
the memory subsystem recovers.  You should be able to expose
windows and drag them around, and so on.  If you expose a window that
has not been used for some time, expect some latency.  Remember, you are now
working in a heavy paging/swapping environment and those pages are not yet
available.

You will need to kill and restart the window manager each time you terminate
your X session.  Remember, you will need to be a privileged user (for example,
root).

After performing the previous steps, you should see marked improvement in user
interactivity when the system experiences heavy memory loads.


FILE(s):

/usr/sys/BINARY/vm_pagelru.o            subset OSFBIN365
CHECKSUM: 56306     77  RCSfile: vm_pagelru.c   RCS: 1.1.63.2
