48 #include <sys/proc.h>
49 #include <sys/cmn_err.h>
50 #include <sys/debug.h>
51
52 #include <vm/hat.h>
53 #include <vm/as.h>
54 #include <vm/seg_vn.h>
55 #include <vm/rm.h>
56 #include <vm/seg.h>
57 #include <vm/page.h>
58
59 /*
60 * Yield the memory claim requirement for an address space.
61 *
62 * This is currently implemented as the number of active hardware
63 * translations that have page structures. Therefore, it can
64 * underestimate the traditional resident set size, eg, if the
65 * physical page is present and the hardware translation is missing;
66 * and it can overestimate the rss, eg, if there are active
67 * translations to a frame buffer with page structs.
68 * Also, it does not take sharing and XHATs into account.
69 */
70 size_t
71 rm_asrss(as)
72 register struct as *as;
73 {
74 if (as != (struct as *)NULL && as != &kas)
75 return ((size_t)btop(hat_get_mapped_size(as->a_hat)));
76 else
77 return (0);
78 }
79
80 /*
81 * Return a 16-bit binary fraction representing the percent of total memory
82 * used by this address space. Binary point is to right of high-order bit.
83 * Defined as the ratio of a_rss for the process to total physical memory.
84 * This assumes 2s-complement arithmetic and that shorts and longs are
85 * 16 bits and 32 bits, respectively.
86 */
87 ushort_t
88 rm_pctmemory(struct as *as)
|
48 #include <sys/proc.h>
49 #include <sys/cmn_err.h>
50 #include <sys/debug.h>
51
52 #include <vm/hat.h>
53 #include <vm/as.h>
54 #include <vm/seg_vn.h>
55 #include <vm/rm.h>
56 #include <vm/seg.h>
57 #include <vm/page.h>
58
59 /*
60 * Yield the memory claim requirement for an address space.
61 *
62 * This is currently implemented as the number of active hardware
63 * translations that have page structures. Therefore, it can
64 * underestimate the traditional resident set size, eg, if the
65 * physical page is present and the hardware translation is missing;
66 * and it can overestimate the rss, eg, if there are active
67 * translations to a frame buffer with page structs.
68 * Also, it does not take sharing into account.
69 */
70 size_t
71 rm_asrss(as)
72 register struct as *as;
73 {
74 if (as != (struct as *)NULL && as != &kas)
75 return ((size_t)btop(hat_get_mapped_size(as->a_hat)));
76 else
77 return (0);
78 }
79
80 /*
81 * Return a 16-bit binary fraction representing the percent of total memory
82 * used by this address space. Binary point is to right of high-order bit.
83 * Defined as the ratio of a_rss for the process to total physical memory.
84 * This assumes 2s-complement arithmetic and that shorts and longs are
85 * 16 bits and 32 bits, respectively.
86 */
87 ushort_t
88 rm_pctmemory(struct as *as)
|