linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Brendan Jackman <jackmanb@google.com>
Cc: David Hildenbrand <david@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: Add lockdep assertion for pageblock type change
Date: Thu, 27 Feb 2025 14:33:02 -0800	[thread overview]
Message-ID: <20250227143302.2338b1cf15919c64a6c1eb27@linux-foundation.org> (raw)
In-Reply-To: <20250227-pageblock-lockdep-v1-1-3701efb331bb@google.com>

On Thu, 27 Feb 2025 16:15:47 +0000 Brendan Jackman <jackmanb@google.com> wrote:

> Since the migratetype hygiene patches [0], the locking here is
> a bit more formalised, so write it down with an assert.
> 
> ...
>
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -417,6 +417,10 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
>  
>  void set_pageblock_migratetype(struct page *page, int migratetype)
>  {
> +	lockdep_assert_once(system_state == SYSTEM_BOOTING ||
> +		in_mem_hotplug() ||
> +		lockdep_is_held(&page_zone(page)->lock));
> +
>  	if (unlikely(page_group_by_mobility_disabled &&
>  		     migratetype < MIGRATE_PCPTYPES))
>  		migratetype = MIGRATE_UNMOVABLE;
> 

We could add such assertions all over the place.  Why this place in
particular?


  reply	other threads:[~2025-02-27 22:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 16:15 Brendan Jackman
2025-02-27 22:33 ` Andrew Morton [this message]
2025-02-28  9:20   ` Brendan Jackman
2025-02-28 10:12     ` Vlastimil Babka
2025-02-28 17:31 ` kernel test robot
2025-02-28 18:28   ` Johannes Weiner
2025-03-03 11:18     ` Andy Shevchenko
2025-03-03 23:13       ` Stephen Rothwell
2025-03-04 10:18         ` Brendan Jackman
2025-03-04 10:31           ` David Hildenbrand
2025-02-28 23:42 ` kernel test robot

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=20250227143302.2338b1cf15919c64a6c1eb27@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=vbabka@suse.cz \
    /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