diff options
author | bmilekic <bmilekic@FreeBSD.org> | 2001-06-22 06:35:32 +0000 |
---|---|---|
committer | bmilekic <bmilekic@FreeBSD.org> | 2001-06-22 06:35:32 +0000 |
commit | 5d710b296b16892625e76899c986dd7697754050 (patch) | |
tree | d56e06b359d94f82a565ce2544371429eb0c93ae /sys/vm/vm_kern.c | |
parent | 44d1723f45fa955b68fb90fc3e7604ceeea6f0d3 (diff) | |
download | FreeBSD-src-5d710b296b16892625e76899c986dd7697754050.zip FreeBSD-src-5d710b296b16892625e76899c986dd7697754050.tar.gz |
Introduce numerous SMP friendly changes to the mbuf allocator. Namely,
introduce a modified allocation mechanism for mbufs and mbuf clusters; one
which can scale under SMP and which offers the possibility of resource
reclamation to be implemented in the future. Notable advantages:
o Reduce contention for SMP by offering per-CPU pools and locks.
o Better use of data cache due to per-CPU pools.
o Much less code cache pollution due to excessively large allocation macros.
o Framework for `grouping' objects from same page together so as to be able
to possibly free wired-down pages back to the system if they are no longer
needed by the network stacks.
Additional things changed with this addition:
- Moved some mbuf specific declarations and initializations from
sys/conf/param.c into mbuf-specific code where they belong.
- m_getclr() has been renamed to m_get_clrd() because the old name is really
confusing. m_getclr() HAS been preserved though and is defined to the new
name. No tree sweep has been done "to change the interface," as the old
name will continue to be supported and is not depracated. The change was
merely done because m_getclr() sounds too much like "m_get a cluster."
- TEMPORARILY disabled mbtypes statistics displaying in netstat(1) and
systat(1) (see TODO below).
- Fixed systat(1) to display number of "free mbufs" based on new per-CPU
stat structures.
- Fixed netstat(1) to display new per-CPU stats based on sysctl-exported
per-CPU stat structures. All infos are fetched via sysctl.
TODO (in order of priority):
- Re-enable mbtypes statistics in both netstat(1) and systat(1) after
introducing an SMP friendly way to collect the mbtypes stats under the
already introduced per-CPU locks (i.e. hopefully don't use atomic() - it
seems too costly for a mere stat update, especially when other locks are
already present).
- Optionally have systat(1) display not only "total free mbufs" but also
"total free mbufs per CPU pool."
- Fix minor length-fetching issues in netstat(1) related to recently
re-enabled option to read mbuf stats from a core file.
- Move reference counters at least for mbuf clusters into an unused portion
of the cluster itself, to save space and need to allocate a counter.
- Look into introducing resource freeing possibly from a kproc.
Reviewed by (in parts): jlemon, jake, silby, terry
Tested by: jlemon (Intel & Alpha), mjacob (Intel & Alpha)
Preliminary performance measurements: jlemon (and me, obviously)
URL: http://people.freebsd.org/~bmilekic/mb_alloc/
Diffstat (limited to 'sys/vm/vm_kern.c')
-rw-r--r-- | sys/vm/vm_kern.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 08ee486..38f969e 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -89,8 +89,6 @@ vm_map_t kmem_map=0; vm_map_t exec_map=0; vm_map_t clean_map=0; vm_map_t buffer_map=0; -vm_map_t mb_map=0; -int mb_map_full=0; /* * kmem_alloc_pageable: @@ -331,6 +329,9 @@ kmem_suballoc(parent, min, max, size) * * NOTE: This routine is not supposed to block if M_NOWAIT is set, but * I have not verified that it actually does not block. + * + * `map' is ONLY allowed to be kmem_map or one of the mbuf submaps to + * which we never free. */ vm_offset_t kmem_malloc(map, size, flags) @@ -344,9 +345,6 @@ kmem_malloc(map, size, flags) vm_page_t m; int hadvmlock; - if (map != kmem_map && map != mb_map) - panic("kmem_malloc: map != {kmem,mb}_map"); - hadvmlock = mtx_owned(&vm_mtx); if (!hadvmlock) mtx_lock(&vm_mtx); @@ -362,9 +360,9 @@ kmem_malloc(map, size, flags) vm_map_lock(map); if (vm_map_findspace(map, vm_map_min(map), size, &addr)) { vm_map_unlock(map); - if (map == mb_map) { - mb_map_full = TRUE; - printf("Out of mbuf clusters - adjust NMBCLUSTERS or increase maxusers!\n"); + if (map != kmem_map) { + printf("Out of mbuf address space!\n"); + printf("Consider increasing NMBCLUSTERS\n"); goto bad; } if ((flags & M_NOWAIT) == 0) |