Commit Graph

131 Commits

Author SHA1 Message Date
christos
242fd69b63 give the name of the dup initialization. 2010-05-05 02:20:42 +00:00
he
d399695a05 Follow christos' suggestions, and make ks_active a u_short, and
also only use 16 u_shorts instead of 32 ints.  Also add panic()
calls for under- and overflow of the ks_active members under
DIAGNOSTIC.  The MAXBUCKET constant ended up in sys/mallocvar.h
and not sys/param.h, as the latter caused build problems.

Ride the kernel revision bump of my previous change.
2010-04-05 08:03:41 +00:00
he
bb89b7208d Extend struct malloc_type to count the number of active allocations
per size, and make vmstat report this information under the "Memory
statistics by type" display, which is only printed when the kernel
has been compiled with KMEMSTATS defined, like this:

Memory statistics by type                                Type  Kern
           Type InUse  MemUse HighUse   Limit   Requests Limit Limit Size(s)
          wapbl    15   4192K   4192K  78644K     376426     0     0 32:0,256:3,512:6,131072:1,262144:2,524288:3

Since struct malloc_type is user-visible and is changed, bump kernel
revision to 5.99.26.

While it is true that malloc(9) is in general on the path of slowly
being replaced by kmem(9) (kmem_alloc/kmem_free), there remains a
lot of points of usage of malloc/free, and this could aid in finding
any leaks.  (It helped finding the leak fixed in PR#42661.)

This was discussed with and somewhat hestitantly OKed by rmind@
2010-04-05 07:16:12 +00:00
hubertf
739e259054 Let kernel build when MALLOCLOG is defined but DIAGNOSTIC is not.
Else, hitmlog() is defined but not used, which triggers a warning.
2010-01-22 08:32:05 +00:00
pooka
fbd53556dc Wipe out the last vestiges of POOL_INIT with one swift stroke. In
most cases, use a proper constructor.  For proplib, give a local
equivalent of POOL_INIT for the kernel object implementation.  This
way the code structure can be preserved, and a local link set is
not hazardous anyway (unless proplib is split to several modules,
but that'll be the day).

tested by booting a kernel in qemu and compile-testing i386/ALL
2009-09-13 18:45:10 +00:00
pooka
150e5cca0b Missed realloc in previous. Ride 5.99.6 bump. 2009-01-07 21:06:31 +00:00
pooka
80508c50c5 Rename malloc() to kern_malloc() to avoid name conflict with libc.
Now it is possible to use the kernel linker with rump.
2009-01-05 21:42:37 +00:00
cegger
beb4d1e5cc undo turn malloc flags to enums.
Requested by christos.

Keep malloc flag defines in kernel section.
2008-12-21 17:49:55 +00:00
cegger
378da548fc Turn malloc flags into an enum.
While here, move the flags definition into _KERNEL section.
2008-12-19 21:22:01 +00:00
cegger
f001f650d6 make this compile with MALLOC_DEBUG but w/o DEBUG 2008-12-07 14:24:28 +00:00
blymn
811c38a41c Extend the information that MALLOCLOG outputs to include the preceding
buffer.  This can be helpful in the case where a buffer overrun in the
preceding region stomps on the following regions data.
2008-10-26 12:23:28 +00:00
pooka
dd1721fa8d Move global malloc types from kern_malloc into a separate module. 2008-09-25 16:23:45 +00:00
ad
ad4f28d1e9 Make them compile again. 2008-03-17 17:05:54 +00:00
yamt
a67bae0b7b - simplify ASSERT_SLEEPABLE.
- move it from proc.h to systm.h.
- add some more checks.
- make it a little more lkm friendly.
2008-03-17 08:27:50 +00:00
yamt
2129f3c054 malloc: fix freelist corruption. 2008-01-03 01:21:08 +00:00
ad
598ab03ad0 Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
2007-12-05 07:06:50 +00:00
yamt
e43896bb4f free: fix size passed to LOCKDEBUG_MEM_CHECK. 2007-11-26 11:48:55 +00:00
matt
11910619f7 Change some initialization of static queues to compile time.
(xxx_INIT to xxx_HEAD_INITIALIZER).  Drop code which inits
non-auto (global or static) variables to 0 since that's
already implied by being non-auto.  Init some static/global
cpu_simple_locks at compile time.
2007-11-11 23:22:23 +00:00
ad
57b6b02535 Merge from vmlocking. 2007-11-06 19:13:49 +00:00
ad
11dc639958 Merge from vmlocking:
- G/C spinlockmgr() and simple_lock debugging.
- Always include the kernel_lock functions, for LKMs.
- Slightly improved subr_lockdebug code.
- Keep sizeof(struct lock) the same if LOCKDEBUG.
2007-10-11 19:45:24 +00:00
yamt
3829d825af malloc: fix a deadlock. 2007-04-19 11:03:44 +00:00
ad
59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
ad
3fcdeca2cc Use mutexes. 2007-03-12 16:42:14 +00:00
christos
53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
thorpej
4f3d5a9cc0 TRUE -> true, FALSE -> false 2007-02-22 06:34:42 +00:00
ad
b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
yamt
1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
chs
164df76537 remove details of the kernel malloc() implementation from header files:
- change MALLOC() and FREE() to just call their function equivalents.
 - remove references to other malloc()-related constants.
2006-10-02 02:59:38 +00:00
yamt
696edc2b76 use ASSERT_SLEEPABLE where appropriate. 2006-07-21 10:08:41 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
jmmv
060dc147c7 Fix wording in a comment. 2005-08-05 13:18:32 +00:00
chs
3f15e64c3c rename "kbucket" to "kmembuckets", for greater clarity.
don't forget to update vmstat this time.
2005-05-30 23:04:53 +00:00
christos
f63d439f2a finish bucket -> kbucket change 2005-05-30 04:15:17 +00:00
yamt
6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
perry
da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
christos
201de1bdd0 Cast nkmempages to vsize_t before shifting to avoid overflow. Requested
by soda.
XXX: should be pulled up to 2.0.
2005-01-14 17:03:58 +00:00
yamt
48355cdf13 kmeminit_nkmempages: don't limit the size of kmem_map to physmem/4
because, while there's little benefit to do so, it easily causes
"out of space in kmem_map" panic on machines with small memory.
2005-01-13 11:49:09 +00:00
yamt
a880e5e2b5 in the case of !PMAP_MAP_POOLPAGE, gather pool backend allocations to
large chunks for kernel_map and kmem_map to ease kva fragmentation.
2005-01-01 21:08:02 +00:00
yamt
95c82bfee4 introduce vm_map_kernel, a subclass of vm_map, and
move some kernel-only members of vm_map to it.
2005-01-01 21:02:12 +00:00
simonb
60e6b50deb Spell "available" correctly. 2005-01-01 03:24:43 +00:00
manu
6e3c639957 IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
2004-09-04 23:29:44 +00:00
simonb
b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
mycroft
ad3b20a692 A nit I ran into while copying this code for something else... 2003-09-27 23:10:47 +00:00
thorpej
f0d728e698 Avoid a type punning warning in the MALLOC_DEBUG case. 2003-09-23 16:36:59 +00:00
ragge
76d3da2d68 Do correct pointer casts. 2003-09-03 11:13:14 +00:00
fvdl
6c4d7c0fee Fix error in previous commit: the first vaddr_t argument to uvm_km_suballoc
is in/out, so it must be zeroed out before passing it, otherwise the
uvm_km_suballoc call would get stack garbage, and fail randomly.
2003-08-31 12:59:05 +00:00
ragge
b20fe4bd92 Do not cast a pointer to a pointer with different basic type when given
as function argument. It makes assumptions about pointer internals
that do not necessarily have to be true.
2003-08-30 07:54:32 +00:00
enami
2340975258 Use vm_map_{min,max}() rather than accessing struct vm_map.header.{start,end}
directly.
2003-08-28 14:54:32 +00:00
manu
e3ce76f536 Added a malloc freelist sanity check function, for debugging purposes 2003-08-26 21:48:53 +00:00