exec: Advise huge pages for the TCG code gen buffer

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

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Richard Henderson 2012-11-02 09:20:46 +11:00 committed by Blue Swirl
parent 16c6c80ac3
commit 0be4835b49
1 changed files with 2 additions and 0 deletions

2
exec.c
View File

@ -607,6 +607,8 @@ static inline void code_gen_alloc(size_t tb_size)
exit(1); 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 /* 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 (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 from TB's to the prologue are going to be in range. It also means