]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/vm/vm_purgeable_internal.h
xnu-2050.7.9.tar.gz
[apple/xnu.git] / osfmk / vm / vm_purgeable_internal.h
index e225da651463a5770d8b5d3f398db77afc9f04b9..169aa660dbaaf3f890c93bec63857f9412cbce6d 100644 (file)
@@ -46,17 +46,9 @@ enum purgeable_q_type {
        PURGEABLE_Q_TYPE_MAX
 };
 
-#if (CONFIG_TOKEN_QUEUE_SMALL == 1)
-typedef uint16_t token_idx_t;
-typedef uint16_t token_cnt_t;
-#define MAX_VOLATILE 0x01000
-#define TOKEN_COUNT_MAX UINT16_MAX
-#else
 typedef uint32_t token_idx_t;
 typedef uint32_t token_cnt_t;
-#define MAX_VOLATILE 0x10000
 #define TOKEN_COUNT_MAX UINT32_MAX
-#endif
 
 #define NUM_VOLATILE_GROUPS 8
 struct purgeable_q {
@@ -76,6 +68,7 @@ typedef struct purgeable_q * purgeable_q_t;
 
 extern struct purgeable_q purgeable_queues[PURGEABLE_Q_TYPE_MAX];
 extern int32_t token_new_pagecount;
+#define TOKEN_NEW_PAGECOUNT_MAX INT32_MAX
 extern int available_for_purge;
 
 
@@ -84,11 +77,10 @@ extern int available_for_purge;
  * the token counters are protected by the vm_page_queue_lock, since they're
  * mostly used in that context and we don't want to do a lot of extra locking
  * the purgeable page queues are protected by a separate lock since they're
- * mostly user on a user context and we don't want any contention with the
+ * mostly used on a user context and we don't want any contention with the
  * pageout daemon.
  */
-
-decl_mutex_data(,vm_purgeable_queue_lock)
+decl_lck_mtx_data(extern,vm_purgeable_queue_lock)
 
 /* add a new token to queue. called by vm_object_purgeable_control */
 /* enter with page queue locked */
@@ -96,21 +88,25 @@ kern_return_t vm_purgeable_token_add(purgeable_q_t queue);
 
 /* enter with page queue locked */
 void vm_purgeable_token_delete_first(purgeable_q_t queue);
+void vm_purgeable_token_delete_last(purgeable_q_t queue);
 
 /*
- * decrement token counters. the function will call the object purger if a
- * token expires.
+ * decrement token counters.
+ * enter with page queue locked
  */
-/* enter with page queue locked */
-void vm_purgeable_q_advance_all(uint32_t num_pages);
+void vm_purgeable_q_advance_all(void);
+
+/* the object purger. purges the next eligible object from memory. */
+/* returns TRUE if an object was purged, otherwise FALSE. */
+boolean_t vm_purgeable_object_purge_one(void);
 
-/* the object purger. purges the specified number of objects from memory. */
-void vm_purgeable_object_purge_one(void);
+/* purge all volatile objects now */
+void vm_purgeable_object_purge_all(void);
 
 /* insert purgeable object into queue */
 void vm_purgeable_object_add(vm_object_t object, purgeable_q_t queue, int group);
 
-/* Look for page belonging to object. If found, put on inactive queue. */
+/* look for object. If found, remove from purgeable queue. */
 purgeable_q_t vm_purgeable_object_remove(vm_object_t object);
 
 #endif /* __VM_PURGEABLE_INTERNAL__ */