I recently tried using mach_override.c on Lion 64-bit and the performance was a lot slower than in previous OS versions on 32-bit. Based on some performance measurements I determine that the performance problem was due to a large number of calls to vm_allocate in the following snippet of code from allocateBrandIsland. In previous versions vm_allocate was only called once, but on Lion 64-bit is was called around 64K times.
I recently tried using mach_override.c on Lion 64-bit and the performance was a lot slower than in previous OS versions on 32-bit. Based on some performance measurements I determine that the performance problem was due to a large number of calls to vm_allocate in the following snippet of code from allocateBrandIsland. In previous versions vm_allocate was only called once, but on Lion 64-bit is was called around 64K times.
if defined(x86_64)
else
endif
Not sure what the idea solution would be, however, I made two changes that greatly improved performance for me:
The changes where the following where COVERITY macro enables the change:
--- 1.15/build/capture/mach-override.c 2012-01-28 12:54:07 -08:00 +++ 1.16/build/capture/mach-override.c 2012-01-28 13:50:08 -08:00 @@ -361,6 +361,11 @@ mach_override_ptr(
***/
+#if COVERITY +static vm_address_t lastFunctionAddr = 0; +static vm_address_t cacheAddrFirst = 0; +#endif + mach_error_t allocateBranchIsland( BranchIsland **island, @@ -389,7 +394,26 @@ allocateBranchIsland( vm_address_t last = 0xfffe0000;
endif
+#if COVERITY
@@ -400,15 +424,30 @@ allocateBranchIsland( allocated = 1; else if( err == KERN_NO_SPACE ) {
if defined(x86_64)
+#if COVERITY
else
endif
+
+#if COVERITY