Bug 112194

Summary: [vm] [patch] VM handles systems with sparse physical memory poorly
Product: Base System Reporter: Nathan Whitehorn <nathanw>
Component: kernAssignee: Alan Cox <alc>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Nathan Whitehorn 2007-04-27 23:20:04 UTC
On systems with sparse physical memory (UltraSPARC IIIi systems map
each DIMM to 8 GB boundaries, and each CPU's RAM to 64 GB boundaries,
for instance), the page table allocates an enormous number of page
table entries for the RAM that isn't there. On UltraSPARC IIIi in
particular, storing this array exceeds the maximum available contiguous
physical memory, which causes early kernel panics. I believe this is
also a problem on IA64.

The attached patch only allocates page table entries for physical RAM
that exists -- the price is slowing down PHYS_TO_VM_PAGE proportional
to the number of entries in phys_avail. Because phys_avail should only
be large on systems with very discontiguous physical memory (where this
approach most matters), and PHYS_TO_VM_PAGE is called rarely, I think
this is a price worth paying.

Fix: Patch attached with submission follows:
Comment 1 Kris Kennaway freebsd_committer freebsd_triage 2007-04-28 01:45:54 UTC
Responsible Changed
From-To: freebsd-bugs->alc

Assign to alc for evaluation
Comment 2 dfilter service freebsd_committer freebsd_triage 2007-05-05 20:50:46 UTC
alc         2007-05-05 19:50:28 UTC

  FreeBSD src repository

  Modified files:
    sys/amd64/include    vmparam.h 
    sys/arm/include      vmparam.h 
    sys/i386/include     vmparam.h 
    sys/ia64/ia64        machdep.c 
    sys/ia64/include     vmparam.h 
    sys/powerpc/include  vmparam.h 
    sys/sparc64/include  vmparam.h 
    sys/sun4v/include    vmparam.h 
    sys/vm               vm_page.c vm_page.h 
  Log:
  Define every architecture as either VM_PHYSSEG_DENSE or
  VM_PHYSSEG_SPARSE depending on whether the physical address space is
  densely or sparsely populated with memory.  The effect of this
  definition is to determine which of two implementations of
  vm_page_array and PHYS_TO_VM_PAGE() is used.  The legacy
  implementation is obtained by defining VM_PHYSSEG_DENSE, and a new
  implementation that trades off time for space is obtained by defining
  VM_PHYSSEG_SPARSE.  For now, all architectures except for ia64 and
  sparc64 define VM_PHYSSEG_DENSE.  Defining VM_PHYSSEG_SPARSE on ia64
  allows the entirety of my Itanium 2's memory to be used.  Previously,
  only the first 1 GB could be used.  Defining VM_PHYSSEG_SPARSE on
  sparc64 allows USIIIi-based systems to boot without crashing.
  
  This change is a combination of Nathan Whitehorn's patch and my own
  work in perforce.
  
  Discussed with: kmacy, marius, Nathan Whitehorn
  PR:             112194
  
  Revision  Changes    Path
  1.47      +5 -0      src/sys/amd64/include/vmparam.h
  1.8       +5 -0      src/sys/arm/include/vmparam.h
  1.42      +5 -0      src/sys/i386/include/vmparam.h
  1.215     +0 -15     src/sys/ia64/ia64/machdep.c
  1.14      +5 -0      src/sys/ia64/include/vmparam.h
  1.6       +5 -0      src/sys/powerpc/include/vmparam.h
  1.16      +5 -0      src/sys/sparc64/include/vmparam.h
  1.3       +5 -0      src/sys/sun4v/include/vmparam.h
  1.342     +8 -0      src/sys/vm/vm_page.c
  1.148     +20 -2     src/sys/vm/vm_page.h
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Alan Cox freebsd_committer freebsd_triage 2007-05-12 18:25:19 UTC
State Changed
From-To: open->patched

A patch has been applied to the HEAD of CVS that addresses 
this issue on both ia64 and sparc64.  This PR should be closed 
after the submitter has had an opportunity to provide feedback.
Comment 4 Nathan Whitehorn 2007-05-13 05:06:23 UTC
The patch currently in CVS works perfectly on my US IIIi machine. Thanks!
Comment 5 Alan Cox freebsd_committer freebsd_triage 2007-05-14 06:55:43 UTC
State Changed
From-To: patched->closed

The originator of the PR has verified that the patch committed 
to the HEAD of CVS works for him.