linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH 4/8] mm: Add __dump_folio()
Date: Wed, 28 Feb 2024 21:05:58 -0800	[thread overview]
Message-ID: <20240229050558.73208-1-sj@kernel.org> (raw)
In-Reply-To: <ZeAKCyTn_xS3O9cE@casper.infradead.org>

On Thu, 29 Feb 2024 04:37:31 +0000 Matthew Wilcox <willy@infradead.org> wrote:

> On Wed, Feb 28, 2024 at 01:34:58PM -0800, SeongJae Park wrote:
> >     ...linux/mm/debug.c: In function '__dump_page':
> >     ...linux/include/asm-generic/pgtable-nop4d.h:11:33: error: 'PGDIR_SHIFT' undeclared (first use in this function); did you mean 'PUD_SHIFT'?
> >        11 | #define P4D_SHIFT               PGDIR_SHIFT
> >           |                                 ^~~~~~~~~~~
> >     ...linux/include/asm-generic/pgtable-nopud.h:18:25: note: in expansion of macro 'P4D_SHIFT'
> >        18 | #define PUD_SHIFT       P4D_SHIFT
> >           |                         ^~~~~~~~~
> >     ...linux/include/linux/pgtable.h:9:26: note: in expansion of macro 'PUD_SHIFT'
> >         9 | #define PUD_ORDER       (PUD_SHIFT - PAGE_SHIFT)
> >           |                          ^~~~~~~~~
> >     ...linux/mm/debug.c:128:35: note: in expansion of macro 'PUD_ORDER'
> >       128 |                 if (idx < (1UL << PUD_ORDER)) {
> 
> Thanks.  Can you try this?
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 49d87a4d29b9..e25e86b755be 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2078,6 +2078,13 @@ static inline long folio_nr_pages(struct folio *folio)
>  #endif
>  }
>  
> +/* Only hugetlbfs can allocate folios larger than MAX_ORDER */
> +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
> +#define MAX_FOLIO_NR_PAGES	(1UL << PUD_ORDER)
> +#else
> +#define MAX_FOLIO_NR_PAGES	MAX_ORDER_NR_PAGES
> +#endif
> +
>  /*
>   * compound_nr() returns the number of pages in this potentially compound
>   * page.  compound_nr() can be called on a tail page, and is defined to
> diff --git a/mm/debug.c b/mm/debug.c
> index 6149944016a7..32ac7d79fd04 100644
> --- a/mm/debug.c
> +++ b/mm/debug.c
> @@ -125,7 +125,7 @@ static void __dump_page(const struct page *page)
>  	foliop = page_folio(&precise);
>  	idx = folio_page_idx(foliop, page);
>  	if (idx != 0) {
> -		if (idx < (1UL << PUD_ORDER)) {
> +		if (idx < MAX_FOLIO_NR_PAGES) {
>  			memcpy(&folio, foliop, 2 * sizeof(struct page));
>  			nr_pages = folio_nr_pages(&folio);
>  		}

Thank you for this fast and kind reply.  I confirmed this fixes my issue :)

Tested-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ


  reply	other threads:[~2024-02-29  5:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 19:23 [PATCH 0/8] PageFlags cleanups Matthew Wilcox (Oracle)
2024-02-27 19:23 ` [PATCH 1/8] mm: Separate out FOLIO_FLAGS from PAGEFLAGS Matthew Wilcox (Oracle)
2024-03-01 11:23   ` David Hildenbrand
2024-02-27 19:23 ` [PATCH 2/8] mm: Remove PageWaiters, PageSetWaiters and PageClearWaiters Matthew Wilcox (Oracle)
2024-03-01 11:24   ` David Hildenbrand
2024-02-27 19:23 ` [PATCH 3/8] mm: Remove PageYoung and PageIdle definitions Matthew Wilcox (Oracle)
2024-03-01 11:25   ` David Hildenbrand
2024-02-27 19:23 ` [PATCH 4/8] mm: Add __dump_folio() Matthew Wilcox (Oracle)
2024-02-28 21:34   ` SeongJae Park
2024-02-29  4:37     ` Matthew Wilcox
2024-02-29  5:05       ` SeongJae Park [this message]
2024-03-01 10:21   ` Ryan Roberts
2024-03-01 21:32     ` Matthew Wilcox
2024-03-04 19:02       ` Matthew Wilcox
2024-05-14  4:33   ` Kees Cook
2024-05-14  4:53     ` Matthew Wilcox
2024-05-14 14:25     ` Matthew Wilcox
2024-02-27 19:23 ` [PATCH 5/8] mm: Make dump_page() take a const argument Matthew Wilcox (Oracle)
2024-03-01 11:26   ` David Hildenbrand
2024-02-27 19:23 ` [PATCH 6/8] mm: Constify testing page/folio flags Matthew Wilcox (Oracle)
2024-03-01 11:28   ` David Hildenbrand
2024-02-27 19:23 ` [PATCH 7/8] mm: Constify more page/folio tests Matthew Wilcox (Oracle)
2024-03-01 11:28   ` David Hildenbrand
2024-02-27 19:23 ` [PATCH 8/8] mm: Remove cast from page_to_nid() Matthew Wilcox (Oracle)
2024-03-01 11:27   ` David Hildenbrand

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=20240229050558.73208-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).