summaryrefslogtreecommitdiff
path: root/lib/libmemstat/memstat.h
Commit message (Collapse)AuthorAgeFilesLines
* malloc: export kernel zones instead of relying on them being power-of-2Mateusz Guzik2020-11-021-0/+7
| | | | | | | | Reviewed by: markj (previous version) Differential Revision: https://reviews.freebsd.org/D27026 Notes: svn path=/head/; revision=367274
* Add two new kernel options to control memory locality on NUMA hardware.Jeff Roberson2019-08-061-0/+1
| | | | | | | | | | | | | | | | - UMA_XDOMAIN enables an additional per-cpu bucket for freed memory that was freed on a different domain from where it was allocated. This is only used for UMA_ZONE_NUMA (first-touch) zones. - UMA_FIRSTTOUCH sets the default UMA policy to be first-touch for all zones. This tries to maintain locality for kernel memory. Reviewed by: gallatin, alc, kib Tested by: pho, gallatin Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20929 Notes: svn path=/head/; revision=350659
* lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-261-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified 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. Notes: svn path=/head/; revision=326219
* Expose real size of UMA allocations via libmemstat(3).Gleb Smirnoff2014-02-101-0/+1
| | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=261726
* Get rid of MAXCPU knowledge used for internal needs only. Switch toSergey Kandaurov2011-08-011-7/+0
| | | | | | | | | | | | | | dynamic memory allocation to hold per-CPU memory types data (sized to mp_maxid for UMA, and to mp_maxcpus for malloc to match the kernel). That fixes libmemstat with arbitrary large MAXCPU values and therefore eliminates MEMSTAT_ERROR_TOOMANYCPUS error type. Reviewed by: jhb Approved by: re (kib) Notes: svn path=/head/; revision=224569
* Add a new column to the output of vmstat -z to indicate the numberSean Bruno2010-06-151-0/+1
| | | | | | | | | | | | | | | | of times the system was forced to sleep when requesting a new allocation. Expand the debugger hook, db_show_uma, to display these results as well. This has proven to be very useful in out of memory situations when it is not known why systems have become sluggish or fail in odd ways. Reviewed by: rwatson alc Approved by: scottl (mentor) peter Obtained from: Yahoo Inc. Notes: svn path=/head/; revision=209215
* Fix a comment in memstat.h: errors are associated with memory type lists,Robert Watson2007-03-151-1/+1
| | | | | | | | | | not individual types. Submitted by: Bryan Venteicher <bryanv at daemoninthecloset dot org> MFC after: 3 days Notes: svn path=/head/; revision=167597
* Increase the number of CPUs to 32 to suit sun4v.John Birrell2006-07-261-1/+1
| | | | | | | Reviewed by: rwatson@ Notes: svn path=/head/; revision=160695
* Teach libmemstat(3) how to extract malloc(9) statistics using kvm(3),Robert Watson2005-08-061-0/+1
| | | | | | | | | | | | so that libmemstat can be used to view full memory statistics from kernel core dumps and /dev/mem. This is provided via a new query function, memstat_kvm_malloc(), which is also automatically invoked by memstat_kvm_all(). A kvm handle must be passed in. This will allow malloc(9)-specific code to be removed from vmstat(8). Notes: svn path=/head/; revision=148789
* Add memstat_kvm_uma(), an implementation of a libmemstat(3) query routineRobert Watson2005-08-011-0/+9
| | | | | | | | | | | | | | | that knows how to extract UMA(9) allocator statistics from a core dump or live memory image using kvm(3). The caller is expected to provide the necessary kvm_t handle, which is then used by libmemstat(3). With these changes, it is trivially straight forward to re-introduce vmstat -z support on core dumps, which was lost when UMA was introduced. In the short term, this requires including vm/ include files that are not intended for extra-kernel use, requiring in turn some ugliness. Notes: svn path=/head/; revision=148627
* Having decided not to provide a libmemstat(3) error number to textRobert Watson2005-07-241-0/+5
| | | | | | | | | | | | | | | | conversion routine, now change my mind and add one, memstat_strerror(3), which returns a const char * pointer to a string describing the error, to be used on the results of memstat_mtl_geterror(). While here, also correct a minor typo in the HISTORY man page. Pointers on improving ease of internationalization would be appreciated. MFC after: 1 day Notes: svn path=/head/; revision=148359
* Introduce more formal error handling for libmemstat(3):Robert Watson2005-07-241-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Define a set of libmemstat(3) error constants, which are used by all libmemstat(3) methods except for memstat_mtl_alloc(), which allocates a memory type list and may return ENOMEM via errno. - Define a per-memory_type_list current error value, which is set when a call associated with a memory list fails. This requires wrapping a structure around the queue(9) list head data structure, but this change is not visible to libmemstat(3) consumers due to using access methods. - Add a new accessor method, memstat_mtl_geterror() to retrieve the error number. - Consistently set the error number in a number of failure modes where previously some combination of setting errno and printf'ing error descriptions was used. libmemstat(3) will now no longer print to stdio under any circumstances. Returns of NULL/-1 for errors remain the same. This avoids use of stdio, misuse of error numbers, and should make it easier to program a libmemstat(3) consumer able to print useful error messages. Currently, no error-to-string function is provided, as I'm unsure how to address internationalization concerns. MFC after: 1 day Notes: svn path=/head/; revision=148357
* UMA supports "secondary" zones, in which a second zone can be layeredRobert Watson2005-07-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | on top of a primary zone, sharing the same allocation "keg". When reporting statistics for zones, do not report the free items in the keg as part of the free items in the zone, or those free items will be reported more than once: for the primary zone, and then any secondary zones off the primary zone. Separately record and maintain a kegfree statistic, and export via memstat_get_kegfree(), which is available for use if needed. Since items free'd back to the keg are not fully initialized, and hence may not actually be available (since secondary zone ctor-time initialization can fail), this makes some amount of sense. This change corrects a bug made visible in the libmemstat(3) modifications to netstat: mbufs freed back to the keg from the packet zone would be counted twice, resulting in negative values being printed in the mbuf free count. Some further refinement of reporting relating to secondary zones may still be required. Reported by: ssouhlal MFC after: 3 days Notes: svn path=/head/; revision=148170
* Bump MEMSTAT_MAXCALLER to 16. memtop(8) seems to be able to happilyRobert Watson2005-07-181-1/+1
| | | | | | | | | | consume that many slots to track snapshot-to-snapshot changes and running totals. And 16 is a nice round number. MFC after: 1 week Notes: svn path=/head/; revision=148121
* Add __BEGIN_DECLS and __END_DECLS to make libmemstat(3) more C++-friendly.Robert Watson2005-07-171-0/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=148094
* Increase the number of caller memory storage slots from 2 or 4 toRobert Watson2005-07-151-0/+8
| | | | | | | | | | | | | | | MEMSTAT_MAXCALLER (8), and expose MEMSTAT_MAXCALLER via memstat.h so that applications can check their assumptions about how many slots are available. Remove 'spare' memory storage in struct malloc_type, since we now don't expose the data structure internals to applications and rely on accessor methods, this approach to ABI stability isn't required. MFC after: 7 days Notes: svn path=/head/; revision=148041
* Add libmemstat(3), a library for use by debugging and monitoringRobert Watson2005-07-141-0/+134
applications in tracking kernel memory statistics. It provides an abstracted interface to uma(9) and malloc(9) statistics, wrapped around the recently added binary stream sysctls for the allocators. Using this interface, it is easy to build monitoring tools, query specific memory types for usage information, etc. Facilities are provided for binding caller-provided data to memory types, incremental updates of memory types, and queries that span multiple allocators. Support for additional allocators is (relatively) easy to add. The API for libmemstat(3) will probably change some over time as consumers are written, and requirements evolve. It is written to avoid encoding ABIs for data structure layout into consuming applications for this reason. MFC after: 1 week Notes: svn path=/head/; revision=147997