]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/mach_debug/zone_info.h
xnu-4570.51.1.tar.gz
[apple/xnu.git] / osfmk / mach_debug / zone_info.h
index c54a4c5b3809f6e0e4a6fcd5b6aefcc8f7cdf062..81bd7badf6f0ba8f1e22be9e738c56563b9bcc52 100644 (file)
@@ -113,11 +113,24 @@ typedef struct mach_zone_info_data {
        uint64_t        mzi_alloc_size; /* size used for more memory */
        uint64_t        mzi_sum_size;   /* sum of all allocs (life of zone) */
        uint64_t        mzi_exhaustible;        /* merely return if empty? */
-       uint64_t        mzi_collectable;        /* garbage collect elements? */
+       uint64_t        mzi_collectable;        /* garbage collect elements? and how much? */
 } mach_zone_info_t;
 
 typedef mach_zone_info_t *mach_zone_info_array_t;
 
+/*
+ * The lowest bit of mzi_collectable indicates whether or not the zone
+ * is collectable by zone_gc(). The higher bits contain the size in bytes
+ * that can be collected.
+ */
+#define GET_MZI_COLLECTABLE_BYTES(val) ((val) >> 1)
+#define GET_MZI_COLLECTABLE_FLAG(val)  ((val) & 1)
+
+#define SET_MZI_COLLECTABLE_BYTES(val, size)   \
+       (val) = ((val) & 1) | ((size) << 1)
+#define SET_MZI_COLLECTABLE_FLAG(val, flag)            \
+       (val) = (flag) ? ((val) | 1) : (val)
+
 typedef struct task_zone_info_data {
        uint64_t        tzi_count;      /* count of elements in use */
        uint64_t        tzi_cur_size;   /* current memory utilization */