linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Vernon Yang <vernon2gm@gmail.com>
Cc: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com,
	ziy@nvidia.com, dev.jain@arm.com, baohua@kernel.org,
	lance.yang@linux.dev, richard.weiyang@gmail.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Vernon Yang <yanglincheng@kylinos.cn>
Subject: Re: [PATCH] mm: khugepaged: simplify scanning progress in pmd
Date: Thu, 26 Feb 2026 11:01:04 +0100	[thread overview]
Message-ID: <811c5456-44c9-4b90-bace-caba6cb6f972@kernel.org> (raw)
In-Reply-To: <zdvzmoop5xswqcyiwmvvrdfianm4ccs3gryfecwbm4bhuh7ebo@7an4huwgbuwo>

>>
>>  static int khugepaged_has_work(void)
>> @@ -2545,13 +2555,14 @@ static int khugepaged_wait_event(void)
>>
>>  static void khugepaged_do_scan(struct collapse_control *cc)
>>  {
>> -	unsigned int progress = 0, pass_through_head = 0;
>> -	unsigned int pages = READ_ONCE(khugepaged_pages_to_scan);
>> +	const unsigned int progress_max = READ_ONCE(khugepaged_pages_to_scan);
>> +	unsigned int pass_through_head = 0;
>>  	bool wait = true;
>>  	enum scan_result result = SCAN_SUCCEED;
>>
>>  	lru_add_drain_all();
>>
>> +	cc->progress = 0;
> 
> madvise(MADV_COLLAPSE) is missing the initialization of "cc->progress"
> because "cc = kmalloc_obj(*cc)". We need to manually initialize it in
> madvise_collapse().

Right, although it wouldn't matter right now, because nobody would be
reading the value.

It's really weird that cc is not simply completely zeroed out in
madvise_collapse().

-- 
Cheers,

David


      reply	other threads:[~2026-02-26 10:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26  8:13 Vernon Yang
2026-02-26  8:42 ` David Hildenbrand (Arm)
2026-02-26  9:57   ` Vernon Yang
2026-02-26 10:01     ` David Hildenbrand (Arm) [this message]

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=811c5456-44c9-4b90-bace-caba6cb6f972@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=lance.yang@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=richard.weiyang@gmail.com \
    --cc=vernon2gm@gmail.com \
    --cc=yanglincheng@kylinos.cn \
    --cc=ziy@nvidia.com \
    /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