]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/task.c
xnu-344.26.tar.gz
[apple/xnu.git] / osfmk / kern / task.c
index ea12d7b399f46b1fdf2cc2f115ff49f9ee2dcbb3..2621419f9c68c5237811e3931474105f3c984d39 100644 (file)
@@ -510,6 +510,10 @@ task_deallocate(
        assert((task->swap_state & TASK_SW_ELIGIBLE) == 0);
 #endif /* TASK_SWAPPER */
 
+       if(task->dynamic_working_set)
+               tws_hash_destroy((tws_hash_t)task->dynamic_working_set);
+
+
        eml_task_deallocate(task);
 
        ipc_task_terminate(task);
@@ -708,8 +712,12 @@ task_terminate_internal(
 
        shared_region_mapping_dealloc(task->system_shared_region);
 
+       /*
+        * Flush working set here to avoid I/O in reaper thread
+        */
        if(task->dynamic_working_set)
-               tws_hash_destroy((tws_hash_t)task->dynamic_working_set);
+               tws_hash_ws_flush((tws_hash_t)
+                               task->dynamic_working_set);
 
        /*
         * We no longer need to guard against being aborted, so restore