mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
Added patch to improve heap allocation performance.
This commit is contained in:
parent
eeb6529b09
commit
3bf7fe4763
@ -1 +1,2 @@
|
||||
Fixes: Improvement for heap allocation performance
|
||||
Disabled: true
|
||||
|
@ -0,0 +1,88 @@
|
||||
From e46de2c7f78d1b8b336868276a23f4ca1d191599 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sat, 22 Jul 2017 06:41:53 +0200
|
||||
Subject: ntdll: Add helper function to delete free blocks.
|
||||
|
||||
---
|
||||
dlls/ntdll/heap.c | 23 +++++++++++++++++------
|
||||
1 file changed, 17 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
|
||||
index f928ebff500..dc45a688925 100644
|
||||
--- a/dlls/ntdll/heap.c
|
||||
+++ b/dlls/ntdll/heap.c
|
||||
@@ -485,6 +485,17 @@ static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL la
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
+ * HEAP_DeleteFreeBlock
|
||||
+ *
|
||||
+ * Delete a free block from the free list.
|
||||
+ */
|
||||
+static inline void HEAP_DeleteFreeBlock( HEAP *heap, ARENA_FREE *pArena )
|
||||
+{
|
||||
+ list_remove( &pArena->entry );
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/***********************************************************************
|
||||
* HEAP_FindSubHeap
|
||||
* Find the sub-heap containing a given address.
|
||||
*
|
||||
@@ -592,7 +603,7 @@ static void HEAP_CreateFreeBlock( SUBHEAP *subheap, void *ptr, SIZE_T size )
|
||||
{
|
||||
/* Remove the next arena from the free list */
|
||||
ARENA_FREE *pNext = (ARENA_FREE *)((char *)ptr + size);
|
||||
- list_remove( &pNext->entry );
|
||||
+ HEAP_DeleteFreeBlock( subheap->heap, pNext );
|
||||
size += (pNext->size & ARENA_SIZE_MASK) + sizeof(*pNext);
|
||||
mark_block_free( pNext, sizeof(ARENA_FREE), flags );
|
||||
}
|
||||
@@ -647,7 +658,7 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
|
||||
pFree = *((ARENA_FREE **)pArena - 1);
|
||||
size += (pFree->size & ARENA_SIZE_MASK) + sizeof(ARENA_FREE);
|
||||
/* Remove it from the free list */
|
||||
- list_remove( &pFree->entry );
|
||||
+ HEAP_DeleteFreeBlock( heap, pFree );
|
||||
}
|
||||
else pFree = (ARENA_FREE *)pArena;
|
||||
|
||||
@@ -667,7 +678,7 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena )
|
||||
|
||||
size = 0;
|
||||
/* Remove the free block from the list */
|
||||
- list_remove( &pFree->entry );
|
||||
+ HEAP_DeleteFreeBlock( heap, pFree );
|
||||
/* Remove the subheap from the list */
|
||||
list_remove( &subheap->entry );
|
||||
/* Free the memory */
|
||||
@@ -1697,7 +1708,7 @@ PVOID WINAPI RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_T size )
|
||||
|
||||
/* Remove the arena from the free list */
|
||||
|
||||
- list_remove( &pArena->entry );
|
||||
+ HEAP_DeleteFreeBlock( heapPtr, pArena );
|
||||
|
||||
/* Build the in-use arena */
|
||||
|
||||
@@ -1854,7 +1865,7 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size
|
||||
{
|
||||
/* The next block is free and large enough */
|
||||
ARENA_FREE *pFree = (ARENA_FREE *)pNext;
|
||||
- list_remove( &pFree->entry );
|
||||
+ HEAP_DeleteFreeBlock( heapPtr, pFree );
|
||||
pArena->size += (pFree->size & ARENA_SIZE_MASK) + sizeof(*pFree);
|
||||
if (!HEAP_Commit( subheap, pArena, rounded_size )) goto oom;
|
||||
notify_realloc( pArena + 1, oldActualSize, size );
|
||||
@@ -1872,7 +1883,7 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size
|
||||
|
||||
/* Build the in-use arena */
|
||||
|
||||
- list_remove( &pNew->entry );
|
||||
+ HEAP_DeleteFreeBlock( heapPtr, pNew );
|
||||
pInUse = (ARENA_INUSE *)pNew;
|
||||
pInUse->size = (pInUse->size & ~ARENA_FLAG_FREE)
|
||||
+ sizeof(ARENA_FREE) - sizeof(ARENA_INUSE);
|
||||
--
|
||||
2.13.1
|
||||
|
File diff suppressed because it is too large
Load Diff
2
patches/ntdll-Heap_Improvements/definition
Normal file
2
patches/ntdll-Heap_Improvements/definition
Normal file
@ -0,0 +1,2 @@
|
||||
Fixes: [43224] Improvement for heap allocation performance
|
||||
Depends: ntdll-Grow_Virtual_Heap
|
@ -244,7 +244,7 @@ patch_enable_all ()
|
||||
enable_ntdll_Fix_Alignment="$1"
|
||||
enable_ntdll_Grow_Virtual_Heap="$1"
|
||||
enable_ntdll_HashLinks="$1"
|
||||
enable_ntdll_Heap_FreeLists="$1"
|
||||
enable_ntdll_Heap_Improvements="$1"
|
||||
enable_ntdll_Hide_Wine_Exports="$1"
|
||||
enable_ntdll_Interrupt_0x2e="$1"
|
||||
enable_ntdll_Junction_Points="$1"
|
||||
@ -993,8 +993,8 @@ patch_enable ()
|
||||
ntdll-HashLinks)
|
||||
enable_ntdll_HashLinks="$2"
|
||||
;;
|
||||
ntdll-Heap_FreeLists)
|
||||
enable_ntdll_Heap_FreeLists="$2"
|
||||
ntdll-Heap_Improvements)
|
||||
enable_ntdll_Heap_Improvements="$2"
|
||||
;;
|
||||
ntdll-Hide_Wine_Exports)
|
||||
enable_ntdll_Hide_Wine_Exports="$2"
|
||||
@ -2530,6 +2530,13 @@ if test "$enable_ntdll_NtQueryEaFile" -eq 1; then
|
||||
enable_kernel32_SetFileCompletionNotificationModes=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_Heap_Improvements" -eq 1; then
|
||||
if test "$enable_ntdll_Grow_Virtual_Heap" -gt 1; then
|
||||
abort "Patchset ntdll-Grow_Virtual_Heap disabled, but ntdll-Heap_Improvements depends on that."
|
||||
fi
|
||||
enable_ntdll_Grow_Virtual_Heap=1
|
||||
fi
|
||||
|
||||
if test "$enable_ntdll_HashLinks" -eq 1; then
|
||||
if test "$enable_ntdll_CLI_Images" -gt 1; then
|
||||
abort "Patchset ntdll-CLI_Images disabled, but ntdll-HashLinks depends on that."
|
||||
@ -6060,15 +6067,23 @@ if test "$enable_ntdll_HashLinks" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset ntdll-Heap_FreeLists
|
||||
# Patchset ntdll-Heap_Improvements
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * ntdll-Grow_Virtual_Heap
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#43224] Improvement for heap allocation performance
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/heap.c
|
||||
# | * configure.ac, dlls/ntdll/heap.c
|
||||
# |
|
||||
if test "$enable_ntdll_Heap_FreeLists" -eq 1; then
|
||||
patch_apply ntdll-Heap_FreeLists/0001-ntdll-Improve-heap-allocation-performance-by-using-m.patch
|
||||
if test "$enable_ntdll_Heap_Improvements" -eq 1; then
|
||||
patch_apply ntdll-Heap_Improvements/0001-ntdll-Add-helper-function-to-delete-free-blocks.patch
|
||||
patch_apply ntdll-Heap_Improvements/0002-ntdll-Improve-heap-allocation-performance.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Steaphan Greene", "ntdll: Improve heap allocation performance by using more fine-grained free lists.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Add helper function to delete free blocks.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Improve heap allocation performance.", 2 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user