Deleted Added
full compact
25c25
< .\" $FreeBSD: head/share/man/man9/memguard.9 162404 2006-09-18 15:24:20Z ru $
---
> .\" $FreeBSD: head/share/man/man9/memguard.9 211194 2010-08-11 22:10:37Z mdf $
27c27
< .Dd January 31, 2006
---
> .Dd August 2, 2010
44c44
< can only take over
---
> can take over
49c49,55
< for a particular malloc type.
---
> for a single malloc type.
> .Nm
> can also guard all allocations larger than
> .Dv PAGE_SIZE ,
> and can guard a random fraction of all allocations.
> There is also a knob to prevent allocations smaller than a specified
> size from being guarded, to limit memory waste.
53,54c59
< for memory type compiled into the kernel, one has to add the
< following line to the
---
> for a memory type, either add an entry to
60,69c65
< Where
< .Ar memory_type
< is a short description of memory type to monitor.
< The short description of memory type is the second argument to
< .Xr MALLOC_DEFINE 9 ,
< so one has to find it in the kernel source.
< .Pp
< To use
< .Nm
< for memory type defined in a kernel module, one has to set
---
> Or set the
72c68
< variable before loading the module:
---
> variable at run-time:
76a73,96
> Where
> .Ar memory_type
> is a short description of the memory type to monitor.
> Only allocations from that
> .Ar memory_type
> made after
> .Va vm.memguard.desc
> is set will potentially be guarded.
> If
> .Va vm.memguard.desc
> is modified at run-time then only allocations of the new
> .Ar memory_type
> will potentially be guarded once the
> .Xr sysctl 8
> is set.
> Existing guarded allocations will still be properly released by
> .Xr free 9 .
> .Pp
> The short description of a
> .Xr malloc 9
> type is the second argument to
> .Xr MALLOC_DEFINE 9 ,
> so one has to find it in the kernel source.
> .Pp
79,91c99,144
< boot-time tunable is used to scale how much of
< .Va kmem_map
< one wants to allocate for
< .Nm .
< The default is 10, so
< .Va kmem_size Ns /10
< bytes will be used.
< The
< .Va kmem_size
< value can be obtained via the
< .Va vm.kmem_size
< .Xr sysctl 8
< variable.
---
> boot-time tunable is used to scale how much of the system's physical
> memory
> .Nm
> is allowed to consume.
> The default is 10, so up to
> .Va cnt.v_page_count Ns /10
> pages can be used.
> .Nm
> will reserve
> .Va vm_kmem_max
> /
> .Va vm.memguard.divisor
> bytes of virtual address space, limited by twice the physical memory
> size.
> The physical limit is reported as
> .Va vm.memguard.phys_limit
> and the virtual space reserved for
> .Nm
> is reported as
> .Va vm.memguard.mapsize .
> .Pp
> .Nm
> will not do page promotions for any allocation smaller than
> .Va vm.memguard.minsize
> bytes.
> The default is 0, meaning all allocations can potentially be guarded.
> .Nm
> can guard sufficiently large allocations randomly, with average
> frequency of every one in 100000 /
> .Va vm.memguard.frequency
> allocations.
> The default is 0, meaning no allocations are randomly guarded.
> .Pp
> .Nm
> can optionally add unmapped guard pages around each allocation to
> detect overflow and underflow, if
> .Va vm.memguard.options
> has the 1 bit set.
> This option is enabled by default.
> .Nm
> will optionally guard all allocations of
> .Dv PAGE_SIZE
> or larger if
> .Va vm.memguard.options
> has the 2 bit set.
> This option is off by default.
105c158
< was written by
---
> was originally written by
107c160
< This manual page was written by
---
> This manual page was originally written by
108a162,164
> Additions have been made by
> .An Matthew Fleming Aq mdf@FreeBSD.org
> to both the implementation and the documentation.