From: Muchun Song <muchun.song@linux.dev>
To: Kaitao Cheng <kaitao.cheng@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Kaitao Cheng <chengkaitao@kylinos.cn>
Subject: Re: [PATCH] mm/sparse: simplify the vmemmap alignment check
Date: Wed, 28 Oct 2026 21:05:40 +0800 [thread overview]
Message-ID: <66E340E5-B2D2-4DB9-AE01-4F98C3182B06@linux.dev> (raw)
In-Reply-To: <20261028121129.39916-1-kaitao.cheng@linux.dev>
> On Oct 28, 2026, at 20:11, Kaitao Cheng <kaitao.cheng@linux.dev> wrote:
>
> From: Kaitao Cheng <chengkaitao@kylinos.cn>
>
> sparse_init() is called only once during boot, and the vmemmap alignment
> check is outside any loop, so VM_WARN_ON_ONCE() provides no benefit over
> VM_WARN_ON() here.
Yes.
>
> Use VM_WARN_ON() and fold compound_info_has_mask() into its condition,
> preserving short-circuit evaluation.
>
> Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
> ---
> mm/sparse.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 6acb628c8a73..248bee2d39b9 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -277,10 +277,8 @@ static void __init sparse_metadata_init(void)
> */
> void __init sparse_init(void)
> {
> - if (compound_info_has_mask()) {
> - VM_WARN_ON_ONCE(!IS_ALIGNED((unsigned long) pfn_to_page(0),
> - MAX_FOLIO_VMEMMAP_ALIGN));
> - }
> + VM_WARN_ON(compound_info_has_mask() && !IS_ALIGNED(
We usually don't end with "(“. At least I rarely see that in the existing code.
We can break the line after &&.
Thanks,
Muchun
> + (unsigned long)pfn_to_page(0), MAX_FOLIO_VMEMMAP_ALIGN));
>
> sparse_metadata_init();
> sparse_init_subsection_map();
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-10-28 13:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 12:11 [PATCH] mm/sparse: simplify the vmemmap alignment check Kaitao Cheng
2026-10-28 13:05 ` Muchun Song [this message]
2026-10-28 16:08 ` Mike Rapoport
2026-10-29 4:25 ` Kaitao Cheng
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=66E340E5-B2D2-4DB9-AE01-4F98C3182B06@linux.dev \
--to=muchun.song@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=chengkaitao@kylinos.cn \
--cc=david@kernel.org \
--cc=kaitao.cheng@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@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 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.