aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/uma_dbg.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix compilation failures on different arches that have vm_machdep.c notGleb Smirnoff2019-01-151-1/+0
| | | | | | | | aware of counter_u64_t by including counter.h into uma_int.h. I'm not happy about this inclusion, but it fixes compilation ASAP. Notes: svn path=/head/; revision=343058
* Make uz_allocs, uz_frees and uz_fails counter(9). This removes someGleb Smirnoff2019-01-151-0/+1
| | | | | | | | | | | | atomic updates and reduces amount of data protected by zone lock. During startup point these fields to EARLY_COUNTER. After startup allocate them for all early zones. Tested by: pho Notes: svn path=/head/; revision=343051
* sys: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326272
* Fix memguard(9) in kernels with INVARIANTS enabled.Mark Johnston2016-06-011-1/+28
| | | | | | | | | | | | | | | | With r284861, UMA zones use the trash ctor and dtor by default. This is incompatible with memguard, which frees the backing page when the item is freed. Modify the UMA debug functions to be no-ops if the item was allocated from memguard. This also fixes constructors such as mb_ctor_pack(), which invokes the trash ctor in addition to performing some initialization. Reviewed by: glebius MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D6562 Notes: svn path=/head/; revision=301176
* Include sys/_task.h into uma_int.h, so that taskqueue.h isn't aGleb Smirnoff2016-02-091-1/+0
| | | | | | | | | requirement for uma_int.h. Suggested by: jhb Notes: svn path=/head/; revision=295451
* Redo r292484. Embed task(9) into zone, so that uz_maxaction is calledGleb Smirnoff2016-02-031-0/+1
| | | | | | | | | | in a context that can sleep, allowing consumers of the KPI to run their drain routines without any extra measures. Discussed with: jtl Notes: svn path=/head/; revision=295222
* Move uma_dbg_alloc() and uma_dbg_free() into uma_core.c, which allowsGleb Smirnoff2016-02-031-97/+0
| | | | | | | | to make uma_dbg.h not depend on uma_int.h, which allows to uninclude uma_int.h from the mbuf(9) allocator. Notes: svn path=/head/; revision=295221
* If INVARIANTS is specified, add ctor/dtor to junk memory if they areJohn-Mark Gurney2015-06-251-0/+5
| | | | | | | | | | unspecified... Submitted by: Suresh Gumpula at Netapp Differential Revision: https://reviews.freebsd.org/D2725 Notes: svn path=/head/; revision=284861
* - Add a per-zone lock for zones without kegs.Jeff Roberson2013-06-201-0/+4
| | | | | | | | | | | | | | | - Be more explicit about zone vs keg locking. This functionally changes almost nothing. - Add a size parameter to uma_zcache_create() so we can size the buckets. - Pass the zone to bucket_alloc() so it can modify allocation flags as appropriate. - Fix a bug in zone_alloc_bucket() where I missed an address of operator in a failure case. (Found by pho) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=252040
* - Convert the slab free item list from a linked array of indices to aJeff Roberson2013-06-131-54/+27
| | | | | | | | | | | | | | | | bitmap using sys/bitset. This is much simpler, has lower space overhead and is cheaper in most cases. - Use a second bitmap for invariants asserts and improve the quality of the asserts as well as the number of erroneous conditions that we will catch. - Drastically simplify sizing code. Special case refcnt zones since they will be going away. - Update stale comments. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=251709
* Convert UMA code to C99 uintXX_t types.Gleb Smirnoff2013-04-091-7/+7
| | | | Notes: svn path=/head/; revision=249313
* - Make the keg abstraction more complete. Permit a zone to have multipleJeff Roberson2009-01-251-8/+8
| | | | | | | | | | | | | | backend kegs so it may source compatible memory from multiple backends. This is useful for cases such as NUMA or different layouts for the same memory type. - Provide a new api for adding new backend kegs to secondary zones. - Provide a new flag for adjusting the layout of zones to stagger allocations better across cache lines. Sponsored by: Nokia Notes: svn path=/head/; revision=187681
* Improve canonicalization of copyrights. Order copyrights by order ofRobert Watson2005-07-161-4/+3
| | | | | | | | | | assertion (jeff, bmilekic, rwatson). Suggested ages ago by: bde MFC after: 1 week Notes: svn path=/head/; revision=148078
* Change the panic in trash_ctor into just a printf for now. Once the reportsMike Silbersack2005-06-261-2/+4
| | | | | | | | | | of panics in trash_ctor relating to mbufs have been examined and a fix found, this will be turned back into a panic. Approved by: re (rwatson) Notes: svn path=/head/; revision=147615
* Well, it seems that I pre-maturely removed the "All rights reserved"Bosko Milekic2005-02-161-2/+2
| | | | | | | | | | | | | | | | | statement from some files, so re-add it for the moment, until the related legalese is sorted out. This change affects: sys/kern/kern_mbuf.c sys/vm/memguard.c sys/vm/memguard.h sys/vm/uma.h sys/vm/uma_core.c sys/vm/uma_dbg.c sys/vm/uma_dbg.h sys/vm/uma_int.h Notes: svn path=/head/; revision=141991
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-071-1/+1
| | | | Notes: svn path=/head/; revision=139825
* Add my copyright and update Jeff's copyright on UMA source files,Bosko Milekic2004-12-261-2/+4
| | | | | | | | | as per his request. Discussed with: Jeffrey Roberson Notes: svn path=/head/; revision=139318
* Fix critical stability problems that can cause UMA mbuf clusterBrian Feldman2004-10-081-13/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | state management corruption, mbuf leaks, general mbuf corruption, and at least on i386 a first level splash damage radius that encompasses up to about half a megabyte of the memory after an mbuf cluster's allocation slab. In short, this has caused instability nightmares anywhere the right kind of network traffic is present. When the polymorphic refcount slabs were added to UMA, the new types were not used pervasively. In particular, the slab management structure was turned into one for refcounts, and one for non-refcounts (supposed to be mostly like the old slab management structure), but the latter was almost always used through out. In general, every access to zones with UMA_ZONE_REFCNT turned on corrupted the "next free" slab offset offset and the refcount with each other and with other allocations (on i386, 2 mbuf clusters per 4096 byte slab). Fix things so that the right type is used to access refcounted zones where it was not before. There are additional errors in gross overestimation of padding, it seems, that would cause a large kegs (nee zones) to be allocated when small ones would do. Unless I have analyzed this incorrectly, it is not directly harmful. Notes: svn path=/head/; revision=136276
* * Add a "how" argument to uma_zone constructors and initialization functionsBrian Feldman2004-08-021-18/+18
| | | | | | | | | | | | | | | | | | | | so that they know whether the allocation is supposed to be able to sleep or not. * Allow uma_zone constructors and initialation functions to return either success or error. Almost all of the ones in the tree currently return success unconditionally, but mbuf is a notable exception: the packet zone constructor wants to be able to fail if it cannot suballocate an mbuf cluster, and the mbuf allocators want to be able to fail in general in a MAC kernel if the MAC mbuf initializer fails. This fixes the panics people are seeing when they run out of memory for mbuf clusters. * Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing the default. Both bmilekic and jeff have reviewed the changes made to make failable zone allocations work. Notes: svn path=/head/; revision=132987
* Bring in mbuma to replace mballoc.Bosko Milekic2004-05-311-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mbuma is an Mbuf & Cluster allocator built on top of a number of extensions to the UMA framework, all included herein. Extensions to UMA worth noting: - Better layering between slab <-> zone caches; introduce Keg structure which splits off slab cache away from the zone structure and allows multiple zones to be stacked on top of a single Keg (single type of slab cache); perhaps we should look into defining a subset API on top of the Keg for special use by malloc(9), for example. - UMA_ZONE_REFCNT zones can now be added, and reference counters automagically allocated for them within the end of the associated slab structures. uma_find_refcnt() does a kextract to fetch the slab struct reference from the underlying page, and lookup the corresponding refcnt. mbuma things worth noting: - integrates mbuf & cluster allocations with extended UMA and provides caches for commonly-allocated items; defines several zones (two primary, one secondary) and two kegs. - change up certain code paths that always used to do: m_get() + m_clget() to instead just use m_getcl() and try to take advantage of the newly defined secondary Packet zone. - netstat(1) and systat(1) quickly hacked up to do basic stat reporting but additional stats work needs to be done once some other details within UMA have been taken care of and it becomes clearer to how stats will work within the modified framework. From the user perspective, one implication is that the NMBCLUSTERS compile-time option is no longer used. The maximum number of clusters is still capped off according to maxusers, but it can be made unlimited by setting the kern.ipc.nmbclusters boot-time tunable to zero. Work should be done to write an appropriate sysctl handler allowing dynamic tuning of kern.ipc.nmbclusters at runtime. Additional things worth noting/known issues (READ): - One report of 'ips' (ServeRAID) driver acting really slow in conjunction with mbuma. Need more data. Latest report is that ips is equally sucking with and without mbuma. - Giant leak in NFS code sometimes occurs, can't reproduce but currently analyzing; brueffer is able to reproduce but THIS IS NOT an mbuma-specific problem and currently occurs even WITHOUT mbuma. - Issues in network locking: there is at least one code path in the rip code where one or more locks are acquired and we end up in m_prepend() with M_WAITOK, which causes WITNESS to whine from within UMA. Current temporary solution: force all UMA allocations to be M_NOWAIT from within UMA for now to avoid deadlocks unless WITNESS is defined and we can determine with certainty that we're not holding any locks when we're M_WAITOK. - I've seen at least one weird socketbuffer empty-but- mbuf-still-attached panic. I don't believe this to be related to mbuma but please keep your eyes open, turn on debugging, and capture crash dumps. This change removes more code than it adds. A paper is available detailing the change and considering various performance issues, it was presented at BSDCan2004: http://www.unixdaemons.com/~bmilekic/netbuf_bmilekic.pdf Please read the paper for Future Work and implementation details, as well as credits. Testing and Debugging: rwatson, brueffer, Ketrien I. Saihr-Kesenchedra, ... Reviewed by: Lots of people (for different parts) Notes: svn path=/head/; revision=129906
* Provide a bit more help with "memory overwritten after free" style bugs.Poul-Henning Kamp2003-09-271-4/+4
| | | | Notes: svn path=/head/; revision=120526
* - Fix the silly flag situation in UMA. Remove redundant ZFLAG/ZONE flagsJeff Roberson2003-09-191-2/+2
| | | | | | | | | | | | | | by accepting the user supplied flags directly. Previously this was not done so that flags for the same field would not be defined in two different files. Add comments in each header instructing future developers on how now to shoot their feet. - Fix a test for !OFFPAGE which should have been a test for HASH. This would have caused a panic if we had ever destructed a malloc zone. This also opens up the possibility that other zones could use the vsetobj() method rather than a hash. Notes: svn path=/head/; revision=120223
* Use __FBSDID().David E. O'Brien2003-06-111-3/+2
| | | | Notes: svn path=/head/; revision=116226
* atomic_set_8 isn't MI. Instead, follow Jake's suggestions aboutMatt Jacob2002-11-111-4/+2
| | | | | | | ZONE_LOCK. Notes: svn path=/head/; revision=106773
* Use atomic_set_8 on the us_freelist maps as they are not otherwiseMatt Jacob2002-11-101-2/+2
| | | | | | | | | protected. Furthermore, in some RISC architectures with no normal byte operations, the surrounding 3 bytes are also affected by the read-modify-write that has to occur. Notes: svn path=/head/; revision=106733
* - Use my freebsd email alias in the copyright.Jeff Roberson2002-09-191-1/+1
| | | | | | | - Remove redundant instances of my email alias in the file summary. Notes: svn path=/head/; revision=103623
* - Split UMA_ZFLAG_OFFPAGE into UMA_ZFLAG_OFFPAGE and UMA_ZFLAG_HASH.Jeff Roberson2002-09-181-4/+5
| | | | | | | | | | - Remove all instances of the mallochash. - Stash the slab pointer in the vm page's object pointer when allocating from the kmem_obj. - Use the overloaded object pointer to find slabs for malloced memory. Notes: svn path=/head/; revision=103531
* Remove unnecessary includes.Jeff Roberson2002-07-051-2/+0
| | | | Notes: svn path=/head/; revision=99424
* The kernel printf does not have %iPeter Wemm2002-05-291-1/+1
| | | | Notes: svn path=/head/; revision=97453
* Hide a pointer to the malloc_type bucket at the end of the freed memory. IfJeff Roberson2002-05-021-2/+77
| | | | | | | | this memory is modified after it has been freed we can now report it's previous owner. Notes: svn path=/head/; revision=95931
* malloc/free(9) no longer require Giant. Use the malloc_mtx to protect theJeff Roberson2002-05-021-0/+2
| | | | | | | | | | mallochash. Mallochash is going to go away as soon as I introduce the kfree/kmalloc api and partially overhaul the malloc wrapper. This can't happen until all users of the malloc api that expect memory to be aligned on the size of the allocation are fixed. Notes: svn path=/head/; revision=95923
* Remove the temporary alignment check in free().Jeff Roberson2002-05-021-0/+95
| | | | | | | | | | | | | | Implement the following checks on freed memory in the bucket path: - Slab membership - Alignment - Duplicate free This previously was only done if we skipped the buckets. This code will slow down INVARIANTS a bit, but it is smp safe. The checks were moved out of the normal path and into hooks supplied in uma_dbg. Notes: svn path=/head/; revision=95899
* Add a new UMA debugging facility. This will overwrite freed memory withJeff Roberson2002-04-301-0/+112
0xdeadc0de and then check for it just before memory is handed off as part of a new request. This will catch any post free/pre alloc modification of memory, as well as introduce errors for anything that tries to dereference it as a pointer. This code takes the form of special init, fini, ctor and dtor routines that are specificly used by malloc. It is in a seperate file because additional debugging aids will want to live here as well. Notes: svn path=/head/; revision=95771