summaryrefslogtreecommitdiff
path: root/sys/kern/kern_malloc.c
Commit message (Collapse)AuthorAgeFilesLines
* Reviewed by: dyson@freebsd.org (john Dyson), dg@root.com (david greenman)Julian Elischer1998-03-081-3/+3
| | | | | | | | Submitted by: Kirk McKusick (mcKusick@mckusick.com) Obtained from: WHistle development tree Notes: svn path=/head/; revision=34266
* Try to dynamically size the VM_KMEM_SIZE (but is still able to be overriddenJohn Dyson1998-02-231-10/+39
| | | | | | | | | | | in a way identically as before.) I had problems with the system properly handling the number of vnodes when there is alot of system memory, and the default VM_KMEM_SIZE. Two new options "VM_KMEM_SIZE_SCALE" and "VM_KMEM_SIZE_MAX" have been added to support better auto-sizing for systems with greater than 128MB. Notes: svn path=/head/; revision=33756
* Staticize.Eivind Eklund1998-02-091-2/+2
| | | | Notes: svn path=/head/; revision=33181
* Back out DIAGNOSTIC changes.Eivind Eklund1998-02-061-3/+1
| | | | Notes: svn path=/head/; revision=33134
* 1) Start using a cleaner and more consistant page allocator insteadJohn Dyson1998-02-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | of the various ad-hoc schemes. 2) When bringing in UPAGES, the pmap code needs to do another vm_page_lookup. 3) When appropriate, set the PG_A or PG_M bits a-priori to both avoid some processor errata, and to minimize redundant processor updating of page tables. 4) Modify pmap_protect so that it can only remove permissions (as it originally supported.) The additional capability is not needed. 5) Streamline read-only to read-write page mappings. 6) For pmap_copy_page, don't enable write mapping for source page. 7) Correct and clean-up pmap_incore. 8) Cluster initial kern_exec pagin. 9) Removal of some minor lint from kern_malloc. 10) Correct some ioopt code. 11) Remove some dead code from the MI swapout routine. 12) Correct vm_object_deallocate (to remove backing_object ref.) 13) Fix dead object handling, that had problems under heavy memory load. 14) Add minor vm_page_lookup improvements. 15) Some pages are not in objects, and make sure that the vm_page.c can properly support such pages. 16) Add some more page deficit handling. 17) Some minor code readability improvements. Notes: svn path=/head/; revision=33109
* Turn DIAGNOSTIC into a new-style option.Eivind Eklund1998-02-041-1/+3
| | | | Notes: svn path=/head/; revision=33108
* VM level code cleanups.John Dyson1998-01-221-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Start using TSM. Struct procs continue to point to upages structure, after being freed. Struct vmspace continues to point to pte object and kva space for kstack. u_map is now superfluous. 2) vm_map's don't need to be reference counted. They always exist either in the kernel or in a vmspace. The vmspaces are managed by reference counts. 3) Remove the "wired" vm_map nonsense. 4) No need to keep a cache of kernel stack kva's. 5) Get rid of strange looking ++var, and change to var++. 6) Change more data structures to use our "zone" allocator. Added struct proc, struct vmspace and struct vnode. This saves a significant amount of kva space and physical memory. Additionally, this enables TSM for the zone managed memory. 7) Keep ioopt disabled for now. 8) Remove the now bogus "single use" map concept. 9) Use generation counts or id's for data structures residing in TSM, where it allows us to avoid unneeded restart overhead during traversals, where blocking might occur. 10) Account better for memory deficits, so the pageout daemon will be able to make enough memory available (experimental.) 11) Fix some vnode locking problems. (From Tor, I think.) 12) Add a check in ufs_lookup, to avoid lots of unneeded calls to bcmp. (experimental.) 13) Significantly shrink, cleanup, and make slightly faster the vm_fault.c code. Use generation counts, get rid of unneded collpase operations, and clean up the cluster code. 14) Make vm_zone more suitable for TSM. This commit is partially as a result of discussions and contributions from other people, including DG, Tor Egge, PHK, and probably others that I have forgotten to attribute (so let me know, if I forgot.) This is not the infamous, final cleanup of the vnode stuff, but a necessary step. Vnode mgmt should be correct, but things might still change, and there is still some missing stuff (like ioopt, and physical backing of non-merged cache files, debugging of layering concepts.) Notes: svn path=/head/; revision=32702
* Some fixes from John Hood:John Dyson1997-12-051-1/+4
| | | | | | | | | | | 1) Fix the initialization of malloc structure that changed due to perf opt. 2) Remove unneeded include. 3) An initialization assert added to malloc. Submitted by: John Hood <cgull@smoke.marlboro.vt.us> Notes: svn path=/head/; revision=31549
* Remove the long description from the in-kernel datastructure.Poul-Henning Kamp1997-10-281-1/+4
| | | | | | | | Put a magic field in there instead, to help catch uninitialized malloc types. Notes: svn path=/head/; revision=30817
* Last major round (Unless Bruce thinks of somthing :-) of malloc changes.Poul-Henning Kamp1997-10-121-1/+3
| | | | | | | | | | | Distribute all but the most fundamental malloc types. This time I also remembered the trick to making things static: Put "static" in front of them. A couple of finer points by: bde Notes: svn path=/head/; revision=30354
* Freeing with unknown type is a panic kind of thing.Poul-Henning Kamp1997-10-111-2/+2
| | | | Notes: svn path=/head/; revision=30306
* Remove a debug printf entirely.Poul-Henning Kamp1997-10-111-4/+1
| | | | Notes: svn path=/head/; revision=30299
* Disable an extremely annoying printf.Peter Wemm1997-10-111-1/+3
| | | | Notes: svn path=/head/; revision=30298
* Rename "struct kmemstats" to "struct malloc_type" it makes more sense now.Poul-Henning Kamp1997-10-101-11/+11
| | | | | | | Fix type argument to hashinit() and phashinit() Notes: svn path=/head/; revision=30281
* Make malloc more extensible. The malloc type is now a pointer toPoul-Henning Kamp1997-10-101-59/+41
| | | | | | | | | | | | | | | | | the struct kmemstats that describes the type. This allows subsystems to declare their malloc types locally and <sys/malloc.h> doesn't need tweaked everytime somebody gets an idea. You can even have a type local to a lkm... I don't know if we really need the longdesc, comments welcome. TODO: There is a single nit in ext2fs, that will be fixed later, and I intend to remove all unused malloc types and distribute the rest closer to their use. Notes: svn path=/head/; revision=30278
* Fixed staticization. buckets[] was staticized but was still declaredBruce Evans1997-09-161-6/+17
| | | | | | | | | | | | | | extern in <sys/malloc.h> and it should not have been staticized for the !(KMEMSTATS || DIAGNOSTIC) case. Fixed the !(KMEMSTATS || DIAGNOSTIC) case. The MALLOC() and FREE() macros are evil, but code generally doesn't allow for this and some code involving else clauses did not compile. Finished staticization. Notes: svn path=/head/; revision=29508
* Removed unused #includes.Bruce Evans1997-09-021-2/+1
| | | | Notes: svn path=/head/; revision=29041
* Get rid of the ad-hoc memory allocator for vm_map_entries, in lieu ofJohn Dyson1997-08-051-1/+5
| | | | | | | | a simple, clean zone type allocator. This new allocator will also be used for machine dependent pmap PV entries. Notes: svn path=/head/; revision=27899
* Killed bogus kernacc() call in malloc() DIAGNOSTIC code. kernacc() byDavid Greenman1997-06-241-8/+1
| | | | | | | | it's nature, locks the kernal_map, and this is deadly if kernal_map had been locked previous to a (net) interrupt. Notes: svn path=/head/; revision=26887
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* The check for multiple freed items were bogus. fixed.Poul-Henning Kamp1996-08-041-7/+12
| | | | Notes: svn path=/head/; revision=17428
* Minor performance improvement to kern_malloc.c that increases theJohn Dyson1996-05-181-1/+17
| | | | | | | | probability of reuse of recently freed memory. This improves cache hit stats on cached memory, and improves at least fork speed consistancy. Notes: svn path=/head/; revision=15817
* Allocate mbufs from a separate submap so that NMBCLUSTERS works asGarrett Wollman1996-05-101-6/+8
| | | | | | | expected. Notes: svn path=/head/; revision=15722
* removed:Poul-Henning Kamp1996-05-021-4/+4
| | | | | | | | | | | | CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei() ptei() kvtopte() ptetov() ispt() ptetoav() &c &c new: NPDEPG Major macro cleanup. Notes: svn path=/head/; revision=15543
* First pass at cleaning up macros relating to pages, clusters and all that.Poul-Henning Kamp1996-05-021-7/+7
| | | | Notes: svn path=/head/; revision=15538
* Implement what I mentioned in rev 1.18: limit per-bucket allocations toDavid Greenman1996-01-291-3/+7
| | | | | | | 60% of physical memory or 60% of malloc area size, whichever is smaller. Notes: svn path=/head/; revision=13703
* Fixed two bugs in the calculation of the malloc area (kmem_map) size:David Greenman1996-01-291-7/+9
| | | | | | | | | | | | | | 1) The calculation didn't account for NMBCLUSTERS, so if a large number of clusters was specified, it would leave little or no space for kernel malloc. 2) It was bogusly restricted to v_page_count. This doesn't take into account the sparseness of the malloc area and would have caused problems on machines with small amounts of memory. It should probably instead be changed to set the malloc limit to be constrained by the amount of memory, but I didn't do this. Notes: svn path=/head/; revision=13702
* A Major staticize sweep. Generates a couple of warnings that I'll dealPoul-Henning Kamp1995-12-141-3/+3
| | | | | | | | | with later. A number of unused vars removed. A number of unused procs removed or #ifdefed. Notes: svn path=/head/; revision=12819
* Untangled the vm.h include file spaghetti.David Greenman1995-12-071-1/+4
| | | | Notes: svn path=/head/; revision=12662
* Finished (?) cleaning up sysinit stuff.Bruce Evans1995-12-021-8/+3
| | | | Notes: svn path=/head/; revision=12569
* Fixed init functions argument type - caddr_t -> void *. Fixed a couple ofDavid Greenman1995-09-091-4/+4
| | | | | | | compiler warnings. Notes: svn path=/head/; revision=10653
* Reviewed by: julian with quick glances by bruce and othersJulian Elischer1995-08-281-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Submitted by: terry (terry lambert) This is a composite of 3 patch sets submitted by terry. they are: New low-level init code that supports loadbal modules better some cleanups in the namei code to help terry in 16-bit character support some changes to the mount-root code to make it a little more modular.. NOTE: mounting root off cdrom or NFS MIGHT be broken as I haven't been able to test those cases.. certainly mounting root of disk still works just fine.. mfs should work but is untested. (tomorrows task) The low level init stuff includes a total rewrite of init_main.c to make it possible for new modules to have an init phase by simply adding an entry to a TEXT_SET (or is it DATA_SET) list. thus a new module can be added to the kernel without editing any other files other than the 'files' file. Notes: svn path=/head/; revision=10358
* Remove trailing whitespace.Rodney W. Grimes1995-05-301-2/+2
| | | | Notes: svn path=/head/; revision=8876
* Make vegetarian and animal rights people happy and use 0xdeadc0de insteadDavid Greenman1995-04-161-3/+3
| | | | | | | | of 0xdeadbeef as the fill pattern. Decreased MAX_COPY to 64 (256 was a bit overzealous in most cases). Notes: svn path=/head/; revision=7875
* Removed redundant newlines that were in some panic strings.David Greenman1995-03-191-6/+4
| | | | Notes: svn path=/head/; revision=7170
* Added some additional DIAGNOSTIC code that makes sure that freedDavid Greenman1995-03-111-2/+12
| | | | | | | | memory addresses and types are with the valid range. Increased MAX_COPY to 256 (used to verify no freed memory use with DIAGNOSTIC). Notes: svn path=/head/; revision=7009
* Calling semantics for kmem_malloc() have been changed...and the thirdDavid Greenman1995-02-021-3/+2
| | | | | | | | | | | | argument is now more than just a single flag. (kern_malloc.c) Used new M_KERNEL value for socket allocations that previous were "M_NOWAIT". Note that this will change when we clean up the M_ namespace mess. Submitted by: John Dyson Notes: svn path=/head/; revision=6127
* These changes embody the support of the fully coherent merged VM buffer cache,David Greenman1995-01-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | much higher filesystem I/O performance, and much better paging performance. It represents the culmination of over 6 months of R&D. The majority of the merged VM/cache work is by John Dyson. The following highlights the most significant changes. Additionally, there are (mostly minor) changes to the various filesystem modules (nfs, msdosfs, etc) to support the new VM/buffer scheme. vfs_bio.c: Significant rewrite of most of vfs_bio to support the merged VM buffer cache scheme. The scheme is almost fully compatible with the old filesystem interface. Significant improvement in the number of opportunities for write clustering. vfs_cluster.c, vfs_subr.c Upgrade and performance enhancements in vfs layer code to support merged VM/buffer cache. Fixup of vfs_cluster to eliminate the bogus pagemove stuff. vm_object.c: Yet more improvements in the collapse code. Elimination of some windows that can cause list corruption. vm_pageout.c: Fixed it, it really works better now. Somehow in 2.0, some "enhancements" broke the code. This code has been reworked from the ground-up. vm_fault.c, vm_page.c, pmap.c, vm_object.c Support for small-block filesystems with merged VM/buffer cache scheme. pmap.c vm_map.c Dynamic kernel VM size, now we dont have to pre-allocate excessive numbers of kernel PTs. vm_glue.c Much simpler and more effective swapping code. No more gratuitous swapping. proc.h Fixed the problem that the p_lock flag was not being cleared on a fork. swap_pager.c, vnode_pager.c Removal of old vfs_bio cruft to support the past pseudo-coherency. Now the code doesn't need it anymore. machdep.c Changes to better support the parameter values for the merged VM/buffer cache scheme. machdep.c, kern_exec.c, vm_glue.c Implemented a seperate submap for temporary exec string space and another one to contain process upages. This eliminates all map fragmentation problems that previously existed. ffs_inode.c, ufs_inode.c, ufs_readwrite.c Changes for merged VM/buffer cache. Add "bypass" support for sneaking in on busy buffers. Submitted by: John Dyson and David Greenman Notes: svn path=/head/; revision=5455
* Changed splimp to splhigh to close a potential hole that could leadDavid Greenman1994-12-171-3/+3
| | | | | | | | to corrupted malloc data structures caused by frees occurring at other than splimp. Notes: svn path=/head/; revision=5131
* Got rid of map.h. It's a leftover from the rmap code, and we use rlists.David Greenman1994-10-091-2/+1
| | | | | | | Changed swapmap into swaplist. Notes: svn path=/head/; revision=3451
* All of this is cosmetic. prototypes, #includes, printfs and so on. MakesPoul-Henning Kamp1994-10-021-4/+4
| | | | | | | GCC a lot more silent. Notes: svn path=/head/; revision=3308
* Added $Id$David Greenman1994-08-021-0/+1
| | | | Notes: svn path=/head/; revision=1817
* The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.Rodney W. Grimes1994-05-251-0/+2
| | | | | | | | Reviewed by: Rodney W. Grimes Submitted by: John Dyson and David Greenman Notes: svn path=/head/; revision=1549
* BSD 4.4 Lite Kernel SourcesRodney W. Grimes1994-05-241-0/+381
Notes: svn path=/head/; revision=1541