OpenBSD CVS

CVS log for src/sys/kern/Attic/kern_malloc_debug.c


[BACK] Up to [local] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.36, Tue Nov 14 06:46:43 2017 UTC (6 years, 6 months ago) by dlg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.35: +1 -1 lines
FILE REMOVED

remove MALLOC_DEBUG

the code has rotted, and obviously hasnt been used for ages. it is
also hard to make mpsafe. if we need something like this again it
would be better to do it from scratch.

ok tedu@ visa@

Revision 1.35 / (download) - annotate - [select for diffs], Mon Jul 10 23:49:10 2017 UTC (6 years, 11 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.34: +45 -28 lines
Diff to previous 1.34 (colored)

make malloc(9) mpsafe by using a mutex instead of splvm.

this is almost a straightforward change of spl ops with mutex ops,
except the accounting has been shuffled around. memory is counted
as used before an attempt to allocate it from uvm is made to prevent
overcommitting memory. this is modelled on how pools limit allocations.

the uvm bits have been eyeballed by kettenis@ who says they should be safe.
visa@ found some nits which have been fixed.

tested by chris@ and amit kulkarni
ok kettenis@ visa@ mpi@

Revision 1.34 / (download) - annotate - [select for diffs], Sun Nov 16 12:31:00 2014 UTC (9 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.33: +3 -3 lines
Diff to previous 1.33 (colored)

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis

Revision 1.33 / (download) - annotate - [select for diffs], Fri Mar 28 17:57:11 2014 UTC (10 years, 2 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

Reduce uvm include madness.  Use <uvm/uvm_extern.h> instead of
<uvm/uvm.h> if possible and remove double inclusions.

ok beck@, mlarkin@, deraadt@

Revision 1.32 / (download) - annotate - [select for diffs], Thu Aug 8 23:25:06 2013 UTC (10 years, 10 months ago) by syl
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

Uncomment kprintf format attributes for sys/kern

tested on vax (gcc3) ok miod@

Revision 1.31 / (download) - annotate - [select for diffs], Tue Jun 25 19:45:15 2013 UTC (10 years, 11 months ago) by syl
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.30: +3 -2 lines
Diff to previous 1.30 (colored)

allow kernel to compile with MALLOC_DEBUG.

ok miod@

Revision 1.30 / (download) - annotate - [select for diffs], Sun Feb 17 17:39:29 2013 UTC (11 years, 3 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

Comment out recently added __attribute__((__format__(__kprintf__))) annotations
in MI code; gcc 2.95 does not accept such annotation for function pointer
declarations, only function prototypes.
To be uncommented once gcc 2.95 bites the dust.

Revision 1.29 / (download) - annotate - [select for diffs], Sat Feb 9 20:56:35 2013 UTC (11 years, 4 months ago) by miod
Branch: MAIN
Changes since 1.28: +3 -2 lines
Diff to previous 1.28 (colored)

Add explicit __attribute__ ((__format__(__kprintf__)))) to the functions and
function pointer arguments which are {used as,} wrappers around the kernel
printf function.
No functional change.

Revision 1.28 / (download) - annotate - [select for diffs], Thu Jul 28 14:07:01 2011 UTC (12 years, 10 months ago) by mcbride
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

Kill integer from pointer warning when compiling with MALLOC_DEBUG.
ok kettenis

Revision 1.27 / (download) - annotate - [select for diffs], Fri Apr 24 08:13:24 2009 UTC (15 years, 1 month ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.26: +7 -6 lines
Diff to previous 1.26 (colored)

Change format strings to allow 64 bit addresses to display properly,
and add a missing argument to one of the printf calls.
ok art@

Revision 1.26 / (download) - annotate - [select for diffs], Fri Apr 13 18:57:49 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

While splitting flags and pqflags might have been a good idea in theory
to separate locking, on most modern machines this is not enough
since operations on short types touch other short types that share the
same word in memory.

Merge pg_flags and pqflags again and now use atomic operations to change
the flags. Also bump wire_count to an int and pg_version might go
int as well, just for alignment.

tested by many, many. ok miod@

Revision 1.25 / (download) - annotate - [select for diffs], Wed Apr 11 12:10:42 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
Changes since 1.24: +3 -5 lines
Diff to previous 1.24 (colored)

Instead of managing pages for intrsafe maps in special objects (aka.
kmem_object) just so that we can remove them, just use pmap_extract
to get the pages to free and simplify a lot of code to not deal with
the list of intrsafe maps, intrsafe objects, etc.

miod@ ok

Revision 1.24 / (download) - annotate - [select for diffs], Wed Apr 4 17:44:45 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

Mechanically rename the "flags" and "version" fields in struct vm_page
to "pg_flags" and "pg_version", so that they are a bit easier to work with.
Whoever uses generic names like this for a popular struct obviously doesn't
read much code.

Most architectures compile and there are no functionality changes.

deraadt@ ok ("if something fails to compile, we fix that by hand")

Revision 1.23 / (download) - annotate - [select for diffs], Sun Jun 20 01:04:28 2004 UTC (19 years, 11 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.22: +21 -3 lines
Diff to previous 1.22 (colored)

Fix inversed logic in handling the "nowait/waitok" flags. Bugs in two places
in malloc_debug.

Also, add an assert-like function to sprinkle in code you're debugging at the
moment. Those asserts are _not_ supposed to be ever comitted, just use them
while debugging.

beck@ ok

Revision 1.5.6.7 / (download) - annotate - [select for diffs], Sat Jun 7 11:03:40 2003 UTC (21 years ago) by ho
Branch: SMP
Changes since 1.5.6.6: +2 -5 lines
Diff to previous 1.5.6.6 (colored) to branchpoint 1.5 (colored) next main 1.6 (colored)

Sync SMP branch to -current

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jun 3 01:27:31 2003 UTC (21 years ago) by art
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A, OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.21: +2 -5 lines
Diff to previous 1.21 (colored)

license cleaning.

Revision 1.15.2.4 / (download) - annotate - [select for diffs], Mon May 19 22:31:09 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.15.2.3: +10 -4 lines
Diff to previous 1.15.2.3 (colored) to branchpoint 1.15 (colored) next main 1.16 (colored)

sync

Revision 1.5.6.6 / (download) - annotate - [select for diffs], Fri Mar 28 00:41:26 2003 UTC (21 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.5.6.5: +12 -4 lines
Diff to previous 1.5.6.5 (colored) to branchpoint 1.5 (colored)

Sync the SMP branch with 3.3

Revision 1.21 / (download) - annotate - [select for diffs], Fri Dec 20 06:00:53 2002 UTC (21 years, 5 months ago) by art
Branch: MAIN
CVS Tags: UBC_SYNC_A, OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.20: +5 -4 lines
Diff to previous 1.20 (colored)

Add a special malloc type M_DEBUG.
If the kernel is compiled with MALLOC_DEBUG, M_DEBUG will force the allocation
to be done through malloc_debug.

Revision 1.20 / (download) - annotate - [select for diffs], Thu Dec 5 22:32:04 2002 UTC (21 years, 6 months ago) by art
Branch: MAIN
Changes since 1.19: +3 -3 lines
Diff to previous 1.19 (colored)

Hmm.. I don't think we want the default to be to debug every allocation.

Revision 1.19 / (download) - annotate - [select for diffs], Thu Dec 5 22:16:13 2002 UTC (21 years, 6 months ago) by art
Branch: MAIN
Changes since 1.18: +9 -4 lines
Diff to previous 1.18 (colored)

Do not use debug_malloc if it hasn't been initialized.
This can happen when debug_malloc_init calls pool_init which calls
malloc (because the kernel is built with POOL_DIAGNOSTIC) which in turn
calls debug_malloc and debug_malloc just happens to trigger on all memory
allocations.

This allows us to run a kernel debugging _all_ allocations.

Revision 1.15.2.3 / (download) - annotate - [select for diffs], Tue Oct 29 00:36:44 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.15.2.2: +4 -2 lines
Diff to previous 1.15.2.2 (colored) to branchpoint 1.15 (colored)

sync to -current

Revision 1.18 / (download) - annotate - [select for diffs], Mon Jul 1 23:04:09 2002 UTC (21 years, 11 months ago) by art
Branch: MAIN
CVS Tags: UBC_SYNC_B, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

Don't abuse VM_PROT_ALL. Use VM_PROT_READ|VM_PROT_WRITE here.
We'll never want to exec code in malloc mappings.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jun 11 04:34:30 2002 UTC (22 years ago) by art
Branch: MAIN
Changes since 1.16: +3 -1 lines
Diff to previous 1.16 (colored)

splassert where needed

Revision 1.5.6.5 / (download) - annotate - [select for diffs], Wed Mar 6 02:13:23 2002 UTC (22 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.5.6.4: +3 -1 lines
Diff to previous 1.5.6.4 (colored) to branchpoint 1.5 (colored)

Merge in trunk

Revision 1.15.2.2 / (download) - annotate - [select for diffs], Sat Feb 2 03:28:25 2002 UTC (22 years, 4 months ago) by art
Branch: UBC
Changes since 1.15.2.1: +3 -5 lines
Diff to previous 1.15.2.1 (colored) to branchpoint 1.15 (colored)

Merge in UBC performance changes from NetBSD.
Fix a bunch of merge errors from yesterday.

Revision 1.15.2.1 / (download) - annotate - [select for diffs], Thu Jan 31 22:55:40 2002 UTC (22 years, 4 months ago) by niklas
Branch: UBC
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Merge in -current, builds on i386, otherwise untested

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jan 23 00:39:47 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Pool deals fairly well with physical memory shortage, but it doesn't deal
well (not at all) with shortages of the vm_map where the pages are mapped
(usually kmem_map).

Try to deal with it:
 - group all information the backend allocator for a pool in a separate
   struct. The pool will only have a pointer to that struct.
 - change the pool_init API to reflect that.
 - link all pools allocating from the same allocator on a linked list.
 - Since an allocator is responsible to wait for physical memory it will
   only fail (waitok) when it runs out of its backing vm_map, carefully
   drain pools using the same allocator so that va space is freed.
   (see comments in code for caveats and details).
 - change pool_reclaim to return if it actually succeeded to free some
   memory, use that information to make draining easier and more efficient.
 - get rid of PR_URGENT, noone uses it.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Dec 8 02:24:07 2001 UTC (22 years, 6 months ago) by art
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.14: +3 -1 lines
Diff to previous 1.14 (colored)

Sprinkle pmap_update calls where relevant and some other
misc pmap usage fixes.

Revision 1.5.6.4 / (download) - annotate - [select for diffs], Tue Nov 13 23:04:23 2001 UTC (22 years, 7 months ago) by niklas
Branch: SMP
Changes since 1.5.6.3: +1 -2 lines
Diff to previous 1.5.6.3 (colored) to branchpoint 1.5 (colored)

merge in -current

Revision 1.14 / (download) - annotate - [select for diffs], Tue Nov 6 19:53:20 2001 UTC (22 years, 7 months ago) by miod
Branch: MAIN
Changes since 1.13: +1 -2 lines
Diff to previous 1.13 (colored)

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)

Revision 1.5.6.3 / (download) - annotate - [select for diffs], Wed Oct 31 03:26:29 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.5.6.2: +96 -116 lines
Diff to previous 1.5.6.2 (colored) to branchpoint 1.5 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.13 / (download) - annotate - [select for diffs], Wed Sep 19 20:50:58 2001 UTC (22 years, 8 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.12: +1 -2 lines
Diff to previous 1.12 (colored)

merge vm/vm_kern.h into uvm/uvm_extern.h; art@ ok

Revision 1.12 / (download) - annotate - [select for diffs], Thu Aug 30 12:42:41 2001 UTC (22 years, 9 months ago) by mpech
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

typo in the comment.

Revision 1.11 / (download) - annotate - [select for diffs], Fri Aug 17 23:39:59 2001 UTC (22 years, 9 months ago) by art
Branch: MAIN
Changes since 1.10: +89 -109 lines
Diff to previous 1.10 (colored)

When this code was imported to NetBSD by Jason Thorpe he did a bunch of
useful changes (and a lot of cleanup). Bring in them.

Revision 1.10 / (download) - annotate - [select for diffs], Thu Jul 26 13:33:52 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.9: +10 -3 lines
Diff to previous 1.9 (colored)

Be more careful with ranges.
From Heikki Korpela <heko@iki.fi>

Revision 1.9 / (download) - annotate - [select for diffs], Wed Jul 18 13:50:40 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

Typo.
Noted by: Heikki Korpela <heko@iki.fi>

Revision 1.8 / (download) - annotate - [select for diffs], Wed Jul 18 10:47:05 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.7: +1 -10 lines
Diff to previous 1.7 (colored)

Get rid of the PMAP_NEW option by making it mandatory for all archs.
The archs that didn't have a proper PMAP_NEW now have a dummy implementation
with wrappers around the old functions.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jul 17 15:49:22 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.6: +4 -1 lines
Diff to previous 1.6 (colored)

Since normal malloc reports "data modified on free list" with
the size we are trying to allocate and not the size of the bucket
and malloc_debug is not capable of debugging a prticular bucket, only
a size, add a possibility to specify a size range.

Revision 1.5.6.2 / (download) - annotate - [select for diffs], Wed Jul 4 10:48:22 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.5.6.1: +1 -5 lines
Diff to previous 1.5.6.1 (colored) to branchpoint 1.5 (colored)

Merge in -current from two days ago in the SMP branch.
As usual with merges, they do not indicate progress, so do not hold
your breath for working SMP, and do not mail me and ask about the
state of it.  It has not changed.  There is work ongoing, but very, very
slowly.  The commit is done in parts as to not lock up the tree in too
big chunks at a time.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jun 27 04:49:43 2001 UTC (22 years, 11 months ago) by art
Branch: MAIN
Changes since 1.5: +1 -5 lines
Diff to previous 1.5 (colored)

remove old vm

Revision 1.5.6.1 / (download) - annotate - [select for diffs], Mon May 14 22:32:41 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.5: +1 -1 lines
Diff to previous 1.5 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.5 / (download) - annotate - [select for diffs], Wed Jun 7 11:21:40 2000 UTC (24 years ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8
Branch point for: SMP
Changes since 1.4: +32 -6 lines
Diff to previous 1.4 (colored)

Allow passing an address to 'show malloc' and print out some information about
that address.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jun 7 09:38:46 2000 UTC (24 years ago) by art
Branch: MAIN
Changes since 1.3: +18 -10 lines
Diff to previous 1.3 (colored)

Change debug_malloc_print so that it can be called from ddb.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jun 7 08:29:34 2000 UTC (24 years ago) by art
Branch: MAIN
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored)

Default type and size to -1.

Revision 1.2 / (download) - annotate - [select for diffs], Tue Jun 6 20:24:51 2000 UTC (24 years ago) by art
Branch: MAIN
Changes since 1.1: +5 -1 lines
Diff to previous 1.1 (colored)

This code will not work without UVM.
Add an #error instead of breaking while compiling.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Jun 6 20:18:20 2000 UTC (24 years ago) by art
Branch: MAIN

malloc debugging code. Enabled by option MALLOC_DEBUG.
Make sure you read the docs (malloc(9)) before use.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.