Commit Graph

96 Commits

Author SHA1 Message Date
thorpej 3cd310ba0f Remove PR_IMMEDRELEASE, since setting the high water mark will achieve
the same thing.

Pointed out back in January by YAMAMOTO Takashi.
2004-06-20 18:19:27 +00:00
atatat dcf1a79f46 Add a DIAGNOSTIC check to detect un-initialized pools. 2004-05-20 05:08:29 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
dbj 436daafe7e add splvm() around a few pa_slock and psppool calls since they
may be shared with pools that can be used in interrupt context.
2004-03-08 22:48:09 +00:00
enami 06107df871 Modify pool page header allocation strategy as follows:
In addition to current one (i.e., don't wast so large part of the page),
- if the header fitsin the page without wasting any items, put it there.
- don't put the header in the page if it may consume rather big item.

For example, on i386, header is now allocated in the page for the pools
like fdescpl or sigapl, and allocated off the page for the pools like
buf1k or buf2k.
2004-02-22 00:19:48 +00:00
yamt 047fc0b378 - fix locking order problem. (pa_slock -> pr_slock)
- protect pr_phtree with pr_slock.
- add some LOCK_ASSERTs.
2004-01-16 12:47:37 +00:00
thorpej 7f125220f4 Add a new pool initialization flag, PR_IMMEDRELEASE. This flag causes
idle pool pages to be returned to the system immediately upon becoming
de-fragmented.

Also, in pool_do_put(), don't free back an idle page unless we are over
our minimum page claim.
2004-01-09 19:00:16 +00:00
yamt 192843ffc2 pool_prime_page: initialize ph_time to mono_time instead of zero
as it's a mono_time relative value.
2003-12-29 16:04:58 +00:00
chs 709a3b4e52 two changes in improve scalability:
(1) split the single list of pages allocated to a pool into three lists:
     completely full, partially full, and completely empty.
     there is no longer any need to traverse any list looking for a
     certain type of page.

 (2) replace the 8-element hash table for out-of-page page headers
     with a splay tree.

these two changes (together with the recent enhancements to the wait code)
give us linear scaling for a fork+exit microbenchmark.
2003-11-13 02:44:01 +00:00
thorpej a0aee79a1d Add the ability for pool caches to cache the physical address of
objects.  Clients of the pool_cache API must consistently use
the "paddr" variants or not, otherwise behavior is undefined.

Enable this on Alpha, ARM, MIPS, and x86.  Other platforms must
define POOL_VTOPHYS() in the appropriate manner in order to enable
the feature.

Part 1 of a series of simple patches contributed by Wasabi Systems
to improve network performance.
2003-04-09 18:22:13 +00:00
matt 137a763c9b Only define POOL_LOGSIZE/pool_size if POOL_DIAGNOSTIC is defined. 2003-03-16 08:06:51 +00:00
pk 8f9c32194c Use splvm() instead of splhigh() when accessing the internal page header pool. 2003-02-23 21:25:19 +00:00
thorpej e0d8d366df Merge the nathanw_sa branch. 2003-01-18 10:06:22 +00:00
scw 0f91ed3dfa Quell uninitialised variable warnings. 2002-11-24 11:37:54 +00:00
thorpej ff114c4a59 Fix signed/unsigned comparison warnings. 2002-11-09 20:06:07 +00:00
enami c07ab7ce9f Parse the modifier of ddb command as documented. 2002-11-08 02:08:57 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
thorpej 4bec56201d Fix signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 22:51:05 +00:00
thorpej 4c9de392fd Bring down a fix from the "newlock" branch, slightly modified:
* In pool_prime_page(), assert that the object being placed onto the
  free list meets the alignment constraints (that "ioff" within the
  object is aligned to "align").
* In pool_init(), round up the object size to the alignment value (or
  ALIGN(1), if no special alignment is needed) so that the above invariant
  holds true.
2002-07-30 01:41:00 +00:00
matt 79d770a01a Add wchan to a panic (must have NOWAIT). 2002-07-11 17:18:48 +00:00
simonb f81b8604f8 Move 'struct pool_cache_group' definition into <sys/pool.h> 2002-03-13 10:57:18 +00:00
simonb 4067afd322 Remove two instances of an "error" variable that is only ever assigned to
but not used.
2002-03-13 08:12:58 +00:00
thorpej d100f2ae43 Put back pool_prime(); the i386 mp pmap uses it. 2002-03-09 18:06:54 +00:00
thorpej 59a96297ef Fix a couple of typos in simple_{,un}lock()'s. 2002-03-09 05:14:33 +00:00
thorpej c4a2ca6a3e Remove pool_prime(). Nothing uses it, and how it should be used it not
really well-defined in the absense of PR_STATIC.
2002-03-09 01:56:27 +00:00
thorpej 4be86fcc13 If, when a page becomes idle, the backend allocator is waiting for
resources, release the page immediately, rather than letting it sit
around cached.

From art@openbsd.org.
2002-03-09 01:37:19 +00:00
thorpej d54150e78a Remove PR_MALLOCOK and PR_STATIC. The former wasn't actually used,
and the latter, while there was some code tested the bit, was woefully
incomplete and also unused by anything.  Besides, PR_STATIC functionality
could be better handled by backend allocators anyhow.

From art@openbsd.org
2002-03-09 01:33:33 +00:00
thorpej ce635a702a Add a missing simple_unlock. 2002-03-08 21:43:54 +00:00
thorpej 8cdc6121b7 Add an optional "drain" client callback, which can be set by the new
pool_set_drain_hook().  This hook is called in three cases:
* When a pool has hit the hard limit, just before either erroring
  out or sleeping.
* When a backend allocator fails to allocate memory.
* Just before trying to reclaim pages in pool_reclaim().

This hook requests the client to try and free some items back to
the pool.

From art@openbsd.org.
2002-03-08 21:41:59 +00:00
thorpej 7c94c68f10 Remove PR_FREEHEADER; nothing uses it anymore.
From art@openbsd.org.
2002-03-08 20:51:25 +00:00
thorpej a180cee23b Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.
2002-03-08 20:48:27 +00:00
enami 39ab348507 Call pr_log(PRLOG_GET) when POOL_DIAGNOSTIC is defined instead of DIAGNOSTIC
for consistency.
2001-11-20 06:57:04 +00:00
lukem adc783d537 add RCSIDs 2001-11-12 15:25:01 +00:00
chs 6bc926aa9e in pool_drain(), call pool_reclaim() while we still have interrupts blocked
since the pool in question might be one used in interrupt context.
2001-10-21 00:06:05 +00:00
bjh21 d0844f93bb Add support for allocating pool memory in units smaller than a whole page.
This is activated by defining POOL_SUBPAGE to the size of the new allocation
unit, and makes pools much more efficient on machines with obscenely large
pages.  It might even make four-megabyte arm26 systems usable.
2001-10-07 12:44:06 +00:00
chs a76b67cf09 jump through hoops to avoid calling uvm_km_free_poolpage() while holding
spinlocks, since that function can sleep.  (note that there's still one
instance remaining to be fixed.)  use TAILQ_FOREACH where appropriate.
2001-09-26 07:14:56 +00:00
thorpej 7f109318f9 Protect the `pool cache group' pool with splvm(), so that pool caches
can be used by code that runs in interrupt context.
2001-07-01 06:12:20 +00:00
thorpej f1c14428bb Do the reentrancy checking if POOL_DIAGNOSTIC, not DIAGNOSTIC. Prevents
ABI change for diagnostic vs. non-diagnostic kernels.
2001-06-05 18:51:03 +00:00
thorpej 47c29f3cbe Assert that no locks are held if we're called with PR_WAITOK.
From Bill Sommerfeld.
2001-06-05 04:40:39 +00:00
sommerfeld b4c4ecb455 Make this build again ifdef DIAGNOSTIC (oops) 2001-05-13 17:17:34 +00:00
sommerfeld 5b2241ad77 Remove pool reentrancy testing overhead unless DIAGNOSTIC is defined.
Previously, we passed __FILE__ and __LINE__ on all pool_get/pool_set calls.

This change results in a measured 1.2% performance improvement in
ping-flood packets-per-second as reported by ping(8).
2001-05-13 17:06:58 +00:00
thorpej 2f58df9a8f Rearrange the code that adds pages of objects to the pool; require
that the caller allocate the pool_item_header when it allocates the
pool page, so we can avoid a locking pitfall (sleeping with a simple
lock held).

Also revive pool_prime(), as there are some letigimate uses of it,
but in doing so, eliminate some of the bogosities of the old version
(i.e. don't do an implicit "setlowat", just prime the pool, and incr
the minpages for each additional page we add, and compute the number
of pages to prime in a way that callers would expect).
2001-05-10 04:51:41 +00:00
thorpej 6ec67f871a Use POOL_NEEDS_CATCHUP() in one more place. 2001-05-10 02:19:32 +00:00
thorpej db26619a5e Encapsulate the test for a pool needing a pool_catchup() in a macro. 2001-05-10 01:37:40 +00:00
thorpej 627edfcb50 Remove pool_create() and pool_prime(). Nothing except pool_create()
used pool_prime(), and no one uses pool_create() anymore.

This makes it easier to fix a locking pitfall.
2001-05-09 23:46:02 +00:00
thorpej da1f26d65f Add pool_cache_destruct_object(), used to force destruction of
an object and release back into the pool.
2001-05-04 19:41:25 +00:00
enami 6dcc7e3de4 Don't use PR_URGENT to allocate page header. We don't want to just panic
on memory shortage.  Instead, use the same wait/nowait condition with the
item requested, and just cleanup and return failure if we can't allocate
page header while we aren't allowed to wait.
2001-01-29 02:38:02 +00:00
thorpej b5104c1ca5 Change some low-hanging splimp() calls to splvm(). 2001-01-14 02:06:21 +00:00
thorpej 105cf38061 Add some basic statistics to pool_cache. 2000-12-11 05:22:55 +00:00
thorpej ce866cd0e8 Don't hold a pool cache lock across any call to pool_get() or pool_put().
This allows us to change a try-lock into a normal lock in the reclaim
case.
2000-12-10 17:03:34 +00:00