freebsd-nq/sys
Bosko Milekic 244f45548a Rework the way slab header storage space is calculated in UMA.
- zone_large_init() stays pretty much the same.
- zone_small_init() will try to stash the slab header in the slab page
  being allocated if the amount of calculated wasted space is less
  than UMA_MAX_WASTE (for both the UMA_ZONE_REFCNT case and regular
  case).  If the amount of wasted space is >= UMA_MAX_WASTE, then
  UMA_ZONE_OFFPAGE will be set and the slab header will be allocated
  separately for better use of space.
- uma_startup() calculates the maximum ipers required in offpage slabs
  (so that the offpage slab header zone(s) can be sized accordingly).
  The algorithm used to calculate this replaces the old calculation
  (which only happened to work coincidentally).  We now iterate over
  possible object sizes, starting from the smallest one, until we
  determine that wastedspace calculated in zone_small_init() might
  end up being greater than UMA_MAX_WASTE, at which point we use the
  found object size to compute the maximum possible ipers.  The
  reason this works is because:
      - wastedspace versus objectsize is a see-saw function with
        local minima all equal to zero and local maxima growing
        directly proportioned to objectsize.  This implies that
        for objects up to or equal a certain objectsize, the see-saw
        remains entirely below UMA_MAX_WASTE, so for those objectsizes
        it is impossible to ever go OFFPAGE for slab headers.
      - ipers (items-per-slab) versus objectsize is an inversely
        proportional function which falls off very quickly (very large
        for small objectsizes).
      - To determine the maximum ipers we'll ever need from OFFPAGE
        slab headers we first find the largest objectsize for which
        we are guaranteed to not go offpage for and use it to compute
        ipers (as though we were offpage).  Since the only objectsizes
        allowed to go offpage are bigger than the found objectsize,
        and since ipers vs objectsize is inversely proportional (and
        monotonically decreasing), then we are guaranteed that the
        ipers computed is always >= what we will ever need in offpage
        slab headers.
- Define UMA_FRITM_SZ and UMA_FRITMREF_SZ to be the actual (possibly
  padded) size of each freelist index so that offset calculations are
  fixed.

This might fix weird data corruption problems and certainly allows
ARM to now boot to at least single-user (via simulator).

Tested on i386 UP by me.
Tested on sparc64 SMP by fenner.
Tested on ARM simulator to single-user by cognet.
2004-07-29 15:25:40 +00:00
..
alpha Move a relic to its correct location(s): Put nfs diskless initialization 2004-07-28 21:54:57 +00:00
amd64 Move a relic to its correct location(s): Put nfs diskless initialization 2004-07-28 21:54:57 +00:00
arm Don't use cast as lvalue. 2004-07-29 12:33:54 +00:00
boot Define our own memcpy here instead of relying on GCC to provide one. 2004-07-28 06:03:27 +00:00
cam Quirk for SEGRAND NP-900 USB MP3Player 2004-07-18 05:39:14 +00:00
coda Avoid casts as lvalues. 2004-07-28 06:05:41 +00:00
compat Use kernel_vmount() instead of vfs_nmount(). 2004-07-27 21:38:42 +00:00
conf Allow for aggressive function inlining. This might have to be fine-tuned 2004-07-28 06:07:02 +00:00
contrib Initialize s variable early to shut up GCC warnings. 2004-07-28 06:14:44 +00:00
crypto Use __FBSDID(). 2004-06-14 00:38:54 +00:00
ddb Damage control. Correcly advance symtab and strtab pointers, not 2004-07-28 08:59:08 +00:00
dev Clean up structure packing. 2004-07-29 08:06:22 +00:00
doc Experimental support for using doxygen to generate kernel documentation. 2004-07-11 16:13:57 +00:00
fs Remove global variable rootdevs and rootvp, they are unused as such. 2004-07-28 20:21:04 +00:00
gdb Introduce the GDB debugger backend for the new KDB framework. The 2004-07-10 17:47:22 +00:00
geom Shut up the compiler and temporarily '#if 0' gv_destroy_geom(), 2004-07-29 11:32:09 +00:00
gnu Remove global variable rootdevs and rootvp, they are unused as such. 2004-07-28 20:21:04 +00:00
i4b Fix a possible hang which apparently occurs during a warm boot (cold boot 2004-07-18 20:13:31 +00:00
i386 Move a relic to its correct location(s): Put nfs diskless initialization 2004-07-28 21:54:57 +00:00
ia64 Move a relic to its correct location(s): Put nfs diskless initialization 2004-07-28 21:54:57 +00:00
isa Ignore more strange return values of the test_aux_port() function, 2004-07-16 22:04:29 +00:00
isofs/cd9660 Remove global variable rootdevs and rootvp, they are unused as such. 2004-07-28 20:21:04 +00:00
kern Remove global variable rootdevs and rootvp, they are unused as such. 2004-07-28 20:21:04 +00:00
libkern Convert the vfsconf list to a TAILQ. 2004-07-27 22:32:01 +00:00
modules Add the ACPI Panasonic extras driver. 2004-07-21 14:47:54 +00:00
net Avoid casts as lvalues. 2004-07-28 06:59:55 +00:00
net80211 Add a new network interface flag, IFF_NEEDSGIANT, which will allow 2004-07-27 23:20:45 +00:00
netatalk Further function forward declaration white space tweaks. 2004-07-19 17:18:58 +00:00
netatm Avoid casts as lvalues. 2004-07-28 06:59:55 +00:00
netgraph Address node in a less complex way. 2004-07-29 08:05:02 +00:00
netinet Disallow a particular kind of port theft described by the following scenario: 2004-07-28 13:03:07 +00:00
netinet6 Disallow a particular kind of port theft described by the following scenario: 2004-07-28 13:03:07 +00:00
netipsec Add required includes for post-sorwakeup() change to fix FAST_IPSEC 2004-06-23 01:58:22 +00:00
netipx Avoid casts as lvalues. Declare local variable as u_char * instead of 2004-07-28 06:58:23 +00:00
netkey Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
netnatm Constify send and receive space constants in natm. 2004-06-24 03:11:29 +00:00
netncp Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
netsmb Avoid casts as lvalues. 2004-07-28 06:59:55 +00:00
nfs Remove advertising clause from University of California Regent's 2004-04-07 05:00:01 +00:00
nfs4client Avoid casts as lvalues. 2004-07-28 06:59:55 +00:00
nfsclient Move a relic to its correct location(s): Put nfs diskless initialization 2004-07-28 21:54:57 +00:00
nfsserver If debug.mpsafenet is non-zero, run the NFS server callout without 2004-07-24 02:32:27 +00:00
opencrypto Push acquisition of Giant from fdrop_closed() into fo_close() so that 2004-07-22 18:35:43 +00:00
pc98 Merged from sys/dev/sio/sio.c revision 1.450. 2004-07-24 15:13:42 +00:00
pccard Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
pci Update for the KDB framework: 2004-07-10 21:47:53 +00:00
posix4
powerpc Add comment explaining struct reg and struct fpreg must match the trapframe. 2004-07-29 13:39:27 +00:00
rpc fix array index out of bounds in rpc->rc_srtt[], rpc->rc_sdrtt[] 2004-07-15 22:21:25 +00:00
security Introduce SLOT_SET macro and use it in place of casts as lvalues. 2004-07-28 07:01:33 +00:00
sparc64 Pass a thread argument into cpu_critical_{enter,exit}() rather than 2004-07-27 16:41:01 +00:00
sys Remove global variable rootdevs and rootvp, they are unused as such. 2004-07-28 20:21:04 +00:00
tools Pass doxygen doc comments through to the output. 2004-07-11 16:14:24 +00:00
ufs Remove global variable rootdevs and rootvp, they are unused as such. 2004-07-28 20:21:04 +00:00
vm Rework the way slab header storage space is calculated in UMA. 2004-07-29 15:25:40 +00:00
Makefile Try harder not to compile anything in sys/boot for arm. 2004-05-16 00:19:12 +00:00