[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 1/3] linux-user: provide fallback pgd_find_hole for bare c
From: |
Richard Henderson |
Subject: |
Re: [PATCH v1 1/3] linux-user: provide fallback pgd_find_hole for bare chroots |
Date: |
Mon, 1 Jun 2020 17:37:44 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
On 5/27/20 3:05 AM, Alex Bennée wrote:
> +static uintptr_t pgd_find_hole_fallback(uintptr_t guest_size, uintptr_t brk,
> long align)
> +{
> + uintptr_t base;
> +
> + /* Start at the bottom and work our way up */
> + base = mmap_min_addr;
> +
> + while (true) {
> + uintptr_t align_start, end;
> + align_start = ROUND_UP(base, align);
> + end = align_start + guest_size;
> +
> + /* if brk is anywhere in the range give ourselves some room to grow.
> */
> + if (align_start <= brk && brk < end) {
> + base += 16 * MiB;
You should skip the entire brk region with base = brk + 16 * MiB.
> + base += qemu_host_page_size;
If align < qemu_host_page_size, then we'll try the same page multiple times.
Better as base = align_start + qemu_host_page_size.
Or even base = ROUND_UP(base, align) right at the beginning.
r~
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH v1 1/3] linux-user: provide fallback pgd_find_hole for bare chroots,
Richard Henderson <=