Skip to contentSkip to conversation

exec: Advise huge pages for the TCG code gen buffer

PATCH Applied Richard Henderson 2 participants 2 messages Nov 1, 2012 – Dec 8, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exec: Advise huge pages for the TCG code gen buffer

After allocating 32MB or more contiguous memory, huge pages would seem to be ideal.

---
 exec.c | 2 ++
 1 file changed, 2 insertions(+)
exec.c +2 -0
index df67938..ab07f68 100644
@@ -602,6 +602,8 @@ static inline void code_gen_alloc(size_t tb_size)
         exit(1);
     }
 
+    qemu_madvise(code_gen_buffer, code_gen_buffer_size, QEMU_MADV_HUGEPAGE);
+
     /* Steal room for the prologue at the end of the buffer.  This ensures
        (via the MAX_CODE_GEN_BUFFER_SIZE limits above) that direct branches
        from TB's to the prologue are going to be in range.  It also means
Signature · 1 line
1.7.11.7
Applied
#1 lore raw

Thanks, applied.

Quoted 24 lines · Richard Henderson

After allocating 32MB or more contiguous memory, huge pages would seem to be ideal.

---
 exec.c | 2 ++
 1 file changed, 2 insertions(+)
exec.c +2 -1
index df67938..ab07f68 100644
@@ -602,6 +602,8 @@ static inline void code_gen_alloc(size_t tb_size)
         exit(1);
     }
 
+    qemu_madvise(code_gen_buffer, code_gen_buffer_size, QEMU_MADV_HUGEPAGE);
+
     /* Steal room for the prologue at the end of the buffer.  This ensures
        (via the MAX_CODE_GEN_BUFFER_SIZE limits above) that direct branches
        from TB's to the prologue are going to be in range.  It also means
--

1.7.11.7