From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Lance Yang <lance.yang@linux.dev>,
Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Zi Yan <ziy@nvidia.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Nico Pache <npache@redhat.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Barry Song <baohua@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2] mm: khugepaged: make scan loops suspend aware
Date: Mon, 16 Feb 2026 10:24:49 +0100 [thread overview]
Message-ID: <5dc7d3a2-a358-481d-9352-d8356d3343c2@kernel.org> (raw)
In-Reply-To: <56345542-544a-48e4-b127-49a850deee9b@linux.dev>
On 2/14/26 07:35, Lance Yang wrote:
>
>
> On 2026/2/12 17:10, David Hildenbrand (Arm) wrote:
>> On 2/12/26 10:05, Sergey Senozhatsky wrote:
>>> [..]
>>>
>>> Interesting, so 1dfb059b9438633 and 878aee7d6b5504e fixed real
>>> problems "khugepaged can sometimes cause suspend to fail", but
>>> I don't see what exactly b39ca208403c8f2 fixed. Sounds more
>>> like an "optimization"?
>>
>> Yes, a cleanup. I wonder if it caused harm.
>>
>>>
>>>
>>> I only have bug reports at hands, I don't have a repro. Can the fact
>>> that swap reads require S/W decompression (zram) add enough latency?
>>
>> I guess so. 20 seconds is still a lot.
>>
>>>
>>>
>>> Let me check.
>>>
>>> cat /sys/kernel/mm/transparent_hugepage/khugepaged/pages_to_scan
>>> 4096
>>>
>>> Hmm, doesn't sound too high. Let me look more.
>>
>> Yeah, that's not a lot of pages to scan. It's the default (8 *
>> HPAGE_PMD_NR)
>
> Right. 4096 pages is not much to scan :)
>
> This patch lets khugepaged be frozen between VMAs.
>
> But if khugepaged is already collapsing when freeze starts, there
> are two places without freeze checks that could take a bit long:
>
> - __collapse_huge_page_swapin() loops 512 pages, calls do_swap_page()
> for each swap entry.
>
> - collapse_file() loops 512 pages, calls shmem_get_folio(). If pages
> are swapped out, shmem_swapin_folio() is called.
>
> Each swap-in can block for I/O. With multiple pages swapped out, the
> cumulative time adds up.
But 20 seconds to swap in 4096 pages (16 MiB)?
Okay, on arm64 with 64k it would be a lot more (8 * 512 MiB == 4 GiB).
With With 16k we're at 8 * 32MiB = 256 MiB.
>
> Maybe we also need check points inside these loops to bail out early?
I'd only do that if we have evidence that it's actually helpful.
@Sergey, with which base page size are you running (4k vs. 16k vs 64k)?
I assume your report is on aarch64, correct?
--
Cheers,
David
next prev parent reply other threads:[~2026-02-16 9:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 3:15 Sergey Senozhatsky
2026-02-11 6:15 ` Nico Pache
2026-02-12 1:51 ` Sergey Senozhatsky
2026-02-11 9:50 ` David Hildenbrand (Arm)
2026-02-12 1:50 ` Sergey Senozhatsky
2026-02-12 8:30 ` David Hildenbrand (Arm)
2026-02-12 8:42 ` Sergey Senozhatsky
2026-02-12 6:32 ` Sergey Senozhatsky
2026-02-12 8:44 ` David Hildenbrand (Arm)
2026-02-12 9:05 ` Sergey Senozhatsky
2026-02-12 9:10 ` David Hildenbrand (Arm)
2026-02-12 9:24 ` Sergey Senozhatsky
2026-02-14 6:35 ` Lance Yang
2026-02-16 9:24 ` David Hildenbrand (Arm) [this message]
2026-02-16 9:50 ` Sergey Senozhatsky
2026-02-16 10:05 ` Sergey Senozhatsky
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=5dc7d3a2-a358-481d-9352-d8356d3343c2@kernel.org \
--to=david@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--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=npache@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=senozhatsky@chromium.org \
--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