diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-11-14 16:00:51 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2012-12-20 23:08:47 +0100 |
commit | abb26d63e7e4492d306c13b7e0e799d4c11a067c (patch) | |
tree | 4c84f372228f2cd71ce4aafe5eb87d36a2e408db /arch_init.c | |
parent | a3161038a1fd17a638a0c606f71e1f799f65f41b (diff) |
exec: sort the memory from biggest to smallest
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r-- | arch_init.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/arch_init.c b/arch_init.c index 67b14d24c1..5c8df3af41 100644 --- a/arch_init.c +++ b/arch_init.c @@ -505,35 +505,6 @@ uint64_t ram_bytes_total(void) return total; } -static int block_compar(const void *a, const void *b) -{ - RAMBlock * const *ablock = a; - RAMBlock * const *bblock = b; - - return strcmp((*ablock)->idstr, (*bblock)->idstr); -} - -static void sort_ram_list(void) -{ - RAMBlock *block, *nblock, **blocks; - int n; - n = 0; - QTAILQ_FOREACH(block, &ram_list.blocks, next) { - ++n; - } - blocks = g_malloc(n * sizeof *blocks); - n = 0; - QTAILQ_FOREACH_SAFE(block, &ram_list.blocks, next, nblock) { - blocks[n++] = block; - QTAILQ_REMOVE(&ram_list.blocks, block, next); - } - qsort(blocks, n, sizeof *blocks, block_compar); - while (--n >= 0) { - QTAILQ_INSERT_HEAD(&ram_list.blocks, blocks[n], next); - } - g_free(blocks); -} - static void migration_end(void) { if (migration_bitmap) { @@ -562,7 +533,6 @@ static void reset_ram_globals(void) { last_block = NULL; last_offset = 0; - sort_ram_list(); } #define MAX_WAIT 50 /* ms, half buffered_file limit */ |