On Thu, Sep 07, 2017 at 05:17:41AM +0000, Anton Blanchard wrote:
But all of memory on PowerNV should be able to be hot unplugged, so
there are two options as I see it - either increase the memory block
size, or map everything with 2MB pages.

I may be misunderstanding this, but what if we did something like x86 does? When trying to unplug a region smaller than the mapping, they fill that part of the pagetable with 0xFD instead of freeing the whole thing. Once the whole thing is 0xFD, free it.

See arch/x86/mm/init_64.c:remove_{pte,pmd,pud}_table()

---%<---
        memset((void *)addr, PAGE_INUSE, next - addr);

        page_addr = page_address(pte_page(*pte));
        if (!memchr_inv(page_addr, PAGE_INUSE, PAGE_SIZE)) {
                ...
                pte_clear(&init_mm, addr, pte);
                ...
        }
---%<---

--
Reza Arbab

Reply via email to