linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: David Hildenbrand <david@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, Oscar Salvador <osalvador@suse.de>,
	Miaohe Lin <linmiaohe@huawei.com>
Subject: Re: [PATCH 1/2] mm: Turn folio_test_hugetlb into a PageType
Date: Thu, 14 Mar 2024 14:33:10 +0000	[thread overview]
Message-ID: <ZfMKpiXi_sXAspgr@casper.infradead.org> (raw)
In-Reply-To: <b414424c-52fd-439e-ab5b-96d43199516b@redhat.com>

On Thu, Mar 14, 2024 at 11:26:17AM +0100, David Hildenbrand wrote:
> Should we include this hunk:
> 
> diff --git a/mm/debug.c b/mm/debug.c
> index c1c1a6a484e4c..f521e17150a10 100644
> --- a/mm/debug.c
> +++ b/mm/debug.c
> @@ -63,7 +63,8 @@ static void __dump_folio(struct folio *folio, struct page *page,
>          * encode own info, and we must avoid calling page_folio() again.
>          */
>         if (!folio_test_slab(folio)) {
> -               mapcount = atomic_read(&page->_mapcount) + 1;
> +               if (!folio_test_hugetlb(folio))
> +                       mapcount = atomic_read(&page->_mapcount) + 1;
>                 if (folio_test_large(folio))
>                         mapcount += folio_entire_mapcount(folio);
>         }
> 
> Apart from that, LGTM

I actually want to do a bit more here ...

+++ b/mm/debug.c
@@ -58,15 +58,10 @@ static void __dump_folio(struct folio *folio, struct page *page,
        int mapcount = 0;
        char *type = "";

-       /*
-        * page->_mapcount space in struct page is used by slab pages to
-        * encode own info, and we must avoid calling page_folio() again.
-        */
-       if (!folio_test_slab(folio)) {
+       if (!page_has_type(page)) {
                mapcount = atomic_read(&page->_mapcount) + 1;
-               if (folio_test_large(folio))
-                       mapcount += folio_entire_mapcount(folio);
-       }
+       if (folio_test_large(folio))
+               mapcount += folio_entire_mapcount(folio);

        pr_warn("page: refcount:%d mapcount:%d mapping:%p index:%#lx pfn:%#lx\n",
                        folio_ref_count(folio), mapcount, mapping,
@@ -99,7 +94,8 @@ static void __dump_folio(struct folio *folio, struct page *page,
         */
        pr_warn("%sflags: %pGp%s\n", type, &folio->flags,
                is_migrate_cma_folio(folio, pfn) ? " CMA" : "");
-       pr_warn("page_type: %pGt\n", &folio->page.page_type);
+       if (page_has_type(page))
+               pr_warn("type: %pGt\n", &folio->page.page_type);

        print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
                        sizeof(unsigned long), page,


and I think that deserves its own patch.

Also, I need to do:

+++ b/include/trace/events/mmflags.h
@@ -135,6 +135,7 @@ IF_HAVE_PG_ARCH_X(arch_3)
 #define DEF_PAGETYPE_NAME(_name) { PG_##_name, __stringify(_name) }

 #define __def_pagetype_names                                           \
+       DEF_PAGETYPE_NAME(hugetlb)                                      \
        DEF_PAGETYPE_NAME(offline),                                     \
        DEF_PAGETYPE_NAME(guard),                                       \
        DEF_PAGETYPE_NAME(table),                                       \

(and I think having this in the include/trace directory is a mistake;
putting it in page-flags.h will lead to it not being forgotten)


  reply	other threads:[~2024-03-14 14:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  1:25 [PATCH 0/2] Reliable testing for hugetlb Matthew Wilcox (Oracle)
2024-03-14  1:25 ` [PATCH 1/2] mm: Turn folio_test_hugetlb into a PageType Matthew Wilcox (Oracle)
2024-03-14 10:26   ` David Hildenbrand
2024-03-14 14:33     ` Matthew Wilcox [this message]
2024-03-15  6:19       ` Miaohe Lin
2024-03-15 12:32         ` Matthew Wilcox
2024-03-18  1:45           ` Miaohe Lin
2024-03-14  1:25 ` [PATCH 2/2] mm: Remove a call to compound_head() from is_page_hwpoison() Matthew Wilcox (Oracle)
2024-03-14 10:26   ` David Hildenbrand
2024-03-15  6:38   ` Miaohe Lin

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=ZfMKpiXi_sXAspgr@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    /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).