Re: [PATCH v5 11/36] mm/compaction: disallow compaction on private nodes

[email protected] Tue, 21 Jul 2026 18:22:49 +0000
Newsgroups dev.linux.lists.nvdimm,dev.linux.lists.damon,org.kernel.vger.kvm,org.kernel.vger.linux-cxl
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The kcompactd background compaction daemon is not prevented from compacting private nodes.
--

--- Patch [11]: [PATCH v5 11/36] mm/compaction: disallow compaction on private nodes ---
commit 8f0db5de5c5b2025b3451b6bb90c3cd06411f91d
Author: Gregory Price <[email protected]>

mm/compaction: disallow compaction on private nodes
    
This commit skips compaction on private nodes because they do not yet support
page migration. It adds checks to direct compaction and sysfs paths to abort
compaction early for private nodes.

> diff --git a/mm/compaction.c b/mm/compaction.c
> index 9f81055a358ed..8c1351cce7bcc 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c

[ ... ]

> @@ -3017,6 +3026,9 @@ static ssize_t compact_store(struct device *dev,
>  {
>  	int nid = dev->id;
>  
> +	if (node_is_private(nid))
> +		return -EINVAL;
> +
>  	if (nid >= 0 && nid < nr_node_ids && node_online(nid)) {
>  		/* Flush pending updates to the LRU lists */
>  		lru_add_drain_all();

[Severity: High]
The commit message states we should disallow compaction on private nodes
because migration is not yet supported. Does this patch miss the background
compaction daemon paths?

Under memory pressure, kswapd calls wakeup_kcompactd(), which currently
bypasses private node checks:

mm/compaction.c:wakeup_kcompactd() {
    ...
    if (!kcompactd_node_suitable(pgdat))
        return;

    wake_up_interruptible(&pgdat->kcompactd_wait);
}

This wakes up the daemon which will then unconditionally execute
compact_zone() for the node without verifying if the node is private:

mm/compaction.c:kcompactd_do_work() {
    ...
    for (zoneid = 0; zoneid <= cc.highest_zoneidx; zoneid++) {
        ...
        status = compact_zone(&cc, NULL);
    ...
}

Could this result in the background daemon uselessly waking up and
attempting unsupported page migration on private nodes?

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=11