linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Frank van der Linden <fvdl@google.com>,
	linux-mm@kvack.org, muchun.song@linux.dev,
	akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Roman Gushchin <roman.gushchin@linux.dev>
Subject: Re: [PATCH] mm/hugetlb: align cma on allocation order, not demotion order
Date: Thu, 2 May 2024 15:15:53 +0200	[thread overview]
Message-ID: <f44e3b1b-d8f7-4b5c-a66b-13ae3f3d53bd@redhat.com> (raw)
In-Reply-To: <20240430161437.2100295-1-fvdl@google.com>

On 30.04.24 18:14, Frank van der Linden wrote:
> Align the CMA area for hugetlb gigantic pages to their size, not the
> size that they can be demoted to. Otherwise there might be misaligned
> sections at the start and end of the CMA area that will never be used
> for hugetlb page allocations.
> 
> Signed-off-by: Frank van der Linden <fvdl@google.com>
> Cc: Roman Gushchin <roman.gushchin@linux.dev>
> Fixes: a01f43901cfb ("hugetlb: be sure to free demoted CMA pages to CMA")
> ---
>   mm/hugetlb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 5dc3f5ea3a2e..cfe7b025c576 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -7794,7 +7794,7 @@ void __init hugetlb_cma_reserve(int order)
>   		 * huge page demotion.
>   		 */
>   		res = cma_declare_contiguous_nid(0, size, 0,
> -					PAGE_SIZE << HUGETLB_PAGE_ORDER,
> +					PAGE_SIZE << order,
>   					HUGETLB_PAGE_ORDER, false, name,
>   					&hugetlb_cma[nid], nid);
>   		if (res) {

I was wondering how that worked when reviewing your other patch. 
Wondering why we never got a BUG report, maybe we were always lucky 
about the alignment we actually got?

We round up size to PAGE_SIZE << order, so that's the alignment we need.

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



  parent reply	other threads:[~2024-05-02 13:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 16:14 Frank van der Linden
2024-04-30 16:20 ` Frank van der Linden
2024-05-02 13:15 ` David Hildenbrand [this message]
2024-05-02 17:27   ` Frank van der Linden
2024-05-02 16:45 ` Roman Gushchin
2024-05-08 10:13 ` Oscar Salvador

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f44e3b1b-d8f7-4b5c-a66b-13ae3f3d53bd@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=fvdl@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox