memstat_malloc:1.6 from HEAD to RELENG_6:
Teach libmemstat(3) how to extract malloc(9) statistics using kvm(3),
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).
memstat_uma.c:1.10 from HEAD to RELENG_6:
Add memstat_kvm_uma(), an implementation of a libmemstat(3) query routine
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.
Merge memstat_uma.c:1.11 from HEAD to RELENG_6:
Define LIBMEMSTAT so that vm_page.h won't perform a nested include of
opt_vmpage.h.
Remove definition of _KERNEL, it is no longer required in order to
include uma_int.h, as the sensitive parts of uma_int.h (a number of
inlines depending on kernel-only constants) are now protected by
_KERNEL.
The use of LIBMEMSTAT here will be cleaned up in the future.
| Add a cancellation point for usleep().
|
| While here, fix sleep() so that it is also a cancellation point (a
| missing weak reference prevented that).
|
| Revision Changes Path
| 1.10 +19 -0 src/lib/libthr/thread/thr_syscalls.c
Approved by: re (kensmith)
Ok'ed by: deischen, davidxu
| Make syslog() use the internal (non-cancellation point) _usleep().
| Prior to this it was calling the cancellable usleep() while holding
| a lock.
|
| Revision Changes Path
| 1.36 +1 -1 src/lib/libc/gen/syslog.c
Approved by: re (kensmith)
Ok'ed by: deischen, davidxu
| Make usleep() overridable by the thread libraries so they can provide
| cancellation points.
|
| Noticed by: phk
|
| Revision Changes Path
| 1.29 +4 -1 src/lib/libc/gen/usleep.c
Approved by: re (kensmith)
Ok'ed by: deischen, davidxu
When (re)allocating space for an array of pointers to char, use
sizeof(*list), not sizeof(**list). (i.e., sizeof(pointer) rather than
sizeof(char)).
Approved by: re (scottl)
Add __BEGIN_DECLS/__END_DECLS so that this header can be included in C++
programs. Also, add include guards.
PR: bin/44277
Submitted by: Alex Zepeda <freebsd at blarf dot homeip dot net>
Approved by: re (scottl)
- Document the fact that the real length of listen queue is 1.5 more
than the value of backlog argument.
- Document the fact that a subsequent listen(2) calls on the listening
socket change the backlog argument.
- Note that current listen queue lengths can be queried using netstat(1).
Submitted by: Igor Sysoev <is rambler-co.ru>
Wording by: gnn
Approved by: re (kensmith)
The "Mbuf" zone was renamed "mbuf" to improve consistency, but the code
example in libmemstat.3 was not updated to take this rename into account.
Update the example.
PR: 84946
Submitted by: Wojciech A. Koszek <dunstan at freebsd dot czest dot pl>
Approved by: re (scottl)
memstat_uma.c:1.9 from HEAD to RELENG_6:
Correct two libmemstat(3) bugs:
- Move memory_type_list flushing logic from memstat_mtl_free() to
_memstat_mtl_empty(), a libmemstat-internal function that can
be called from other parts of the library. Invoke
_memstat_mtl_empty() from memstat_mtl_free(), which also frees
the containing list structure.
Invoke _memstat_mtl_empty() instead of memstat_mtl_free() in
various error cases in memstat_malloc.c and memstat_uma.c, which
previously resulted in the list being freed prematurely.
- Reverse the order of updating the mt_kegfree and mt_free fields
of the memory_type in memstat_uma.c, otherwise keg free items
won't be counted properly for non-secondary zones.
Merged to RELENG_6 earlier than the proposed MFC after date so that it
can make BETA2.
Approved by: re (kensmith)
If a retrieved UMA zone is a secondary zone, don't report keg free
items, as they actually belong to the primary zone, and maye otherwise
be reported more than once.
Approved by: re (kensmith)