linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Wei Yang <richard.weiyang@gmail.com>,
	rppt@kernel.org, akpm@linux-foundation.org
Cc: linux-mm@kvack.org
Subject: Re: [PATCH v2] mm: increase totalram_pages on freeing to buddy system
Date: Fri, 26 Jul 2024 14:06:30 +0200	[thread overview]
Message-ID: <d1d00b04-c1c4-49b6-ba34-9bcbaeeddd19@redhat.com> (raw)
In-Reply-To: <20240726003612.5578-1-richard.weiyang@gmail.com>

On 26.07.24 02:36, Wei Yang wrote:
> Total memory represents pages managed by buddy system. After the
> introduction of DEFERRED_STRUCT_PAGE_INIT, it may count the pages before
> being managed.
> 
> free_low_memory_core_early() returns number of pages for all free pages,
> even at this moment only early initialized pages are freed to buddy
> system. This means the total memory at this moment is not correct.
> 
> Let's increase it when pages are freed to buddy system.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> CC: David Hildenbrand <david@redhat.com>

[...]

> index 71d2716a554f..4701bc442df6 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1248,16 +1248,14 @@ void __meminit __free_pages_core(struct page *page, unsigned int order,
>   		 * map it first.
>   		 */
>   		debug_pagealloc_map_pages(page, nr_pages);
> -		adjust_managed_page_count(page, nr_pages);
>   	} else {
>   		for (loop = 0; loop < nr_pages; loop++, p++) {
>   			__ClearPageReserved(p);
>   			set_page_count(p, 0);
>   		}
>   
> -		/* memblock adjusts totalram_pages() manually. */
> -		atomic_long_add(nr_pages, &page_zone(page)->managed_pages);
>   	}
> +	adjust_managed_page_count(page, nr_pages);
>   
>   	if (page_contains_unaccepted(page, order)) {
>   		if (order == MAX_PAGE_ORDER && __free_unaccepted(page))

Nice!

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

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-07-26 12:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26  0:36 Wei Yang
2024-07-26 12:06 ` David Hildenbrand [this message]
2024-07-28  6:01 ` Mike Rapoport
2024-07-29  4:43 ` Oscar Salvador
2024-08-03  0:07 ` Nathan Chancellor
2024-08-05 15:47   ` Wei Yang

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=d1d00b04-c1c4-49b6-ba34-9bcbaeeddd19@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=richard.weiyang@gmail.com \
    --cc=rppt@kernel.org \
    /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