Re: [PATCH 0/1] memory offline issues with hugepage size > memory block size

From: Gerald Schaefer
Date: Wed Sep 21 2016 - 06:30:48 EST

On Tue, 20 Sep 2016 10:37:04 -0700
Mike Kravetz <mike.kravetz@xxxxxxxxxx> wrote:

> Cc'ed Rui Teng and Dave Hansen as they were discussing the issue in
> this thread:

Ah, thanks, I didn't see that.

> Their approach (I believe) would be to fail the offline operation in
> this case. However, I could argue that failing the operation, or
> dissolving the unused huge page containing the area to be offlined is
> the right thing to do.
> I never thought too much about the VM_BUG_ON(), but you are correct in
> that it should be removed in either case.
> The other thing that needs to be changed is the locking in
> dissolve_free_huge_page(). I believe the lock only needs to be held if
> we are removing the huge page from the pool. It is not a correctness
> but performance issue.

Yes, that looks odd, that's why in my patch I moved the PageHuge() check
out from dissolve_free_huge_page(), up into the loop in
dissolve_free_huge_pages(). This way dissolve_free_huge_page() with its
locking should only be called once per memory block, in the case where
this memory block is part of a gigantic hugepage.