All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Matthew Wilcox <willy@infradead.org>,
	linux-mm@kvack.org, David Hildenbrand <david@redhat.com>,
	Kent Overstreet <kent.overstreet@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [RFC] pgflags_t
Date: Thu, 7 Oct 2021 16:37:08 +0200	[thread overview]
Message-ID: <a8cdcb3c-26e5-33b5-44f9-459df8a40dbb@suse.cz> (raw)
In-Reply-To: <YV25hsgfJ2qAYiRJ@casper.infradead.org>

On 10/6/21 16:58, Matthew Wilcox wrote:
> David expressed some unease about the lack of typesafety in patches
> 1 & 2 of the page->slab conversion [1], and I'll admit to not being
> particularly a fan of passing around an unsigned long.  That crystallised
> in a discussion with Kent [2] about how to lock a page when you don't know
> its type (solution: every memory descriptor type starts with a
> pgflags_t)
> 
> So this patch is a step towards typesafety for pgflags_lock() by
> changing the type of page->flags from a bare unsigned long to a
> struct encapsulating an unsigned long.  A few users can already benefit
> from passing around a pgflags_t, but most just append '.f' to get at
> the unsigned long.  Also, most of them only do it for logging/tracing.
> 
> [1] https://lore.kernel.org/linux-mm/02a055cd-19d6-6e1d-59bb-e9e5f9f1da5b@redhat.com/
> [2] https://lore.kernel.org/linux-mm/YVyQpPuwIGFSSEQ8@casper.infradead.org/
> 
...
> diff --git a/mm/debug.c b/mm/debug.c
> index fae0f81ad831..48af9829aee9 100644
> --- a/mm/debug.c
> +++ b/mm/debug.c
> @@ -162,7 +162,7 @@ static void __dump_page(struct page *page)
>  out_mapping:
>  	BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
>  
> -	pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags, &head->flags,
> +	pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags.f, &head->flags.f,

The %pGp case (here and elsewhere) could perhaps take the new type, no?
Would need to change format_page_flags() and flags_string() in lib/vsprintf.c

  parent reply	other threads:[~2021-10-07 14:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 14:58 [RFC] pgflags_t Matthew Wilcox
2021-10-06 15:16 ` David Hildenbrand
2021-10-06 15:29   ` Matthew Wilcox
2021-10-06 15:22 ` Al Viro
2021-10-06 15:23   ` David Hildenbrand
2021-10-06 15:28     ` Al Viro
2021-10-06 15:32       ` David Hildenbrand
2021-10-06 15:46         ` Al Viro
2021-10-06 15:47           ` David Hildenbrand
2021-10-06 15:38   ` Matthew Wilcox
2021-10-06 15:48     ` Al Viro
2021-10-07 14:37 ` Vlastimil Babka [this message]
2021-10-07 14:48   ` Matthew Wilcox

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=a8cdcb3c-26e5-33b5-44f9-459df8a40dbb@suse.cz \
    --to=vbabka@suse.cz \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-fsdevel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.