From: Andrew Morton <akpm@linux-foundation.org>
To: Adam Harshbarger <handyhandyman.adam@gmail.com>
Cc: I Hsin Cheng <richard120310@gmail.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
stable@vger.kernel.org
Subject: Re: [PATCH] lib/plist: fix plist_requeue() corrupting order in the last bucket
Date: Thu, 3 Sep 2026 16:53:28 -0700 [thread overview]
Message-ID: <20260903165328.2e781581d28ce1f4dbbc0da7@linux-foundation.org> (raw)
In-Reply-To: <20260903222456.1881786-1-handyhandyman.adam@gmail.com>
On Thu, 3 Sep 2026 17:24:56 -0500 Adam Harshbarger <handyhandyman.adam@gmail.com> wrote:
> plist_requeue() is meant to move a node to the end of its own priority
> run. When the node heads the *last* priority bucket it is instead placed
> at the head of the whole list, leaving the plist unsorted:
>
> ...
>
> Reachable from mm/swapfile.c, which rotates swap_avail_heads[] with
> plist_requeue(). It takes three or more swap devices: at least two
> distinct priorities, so that a later bucket exists for the ring to wrap
> round from, and two or more devices sharing the lowest priority, so that
> plist_requeue() does not return early. One device per priority returns
> early at the node->prio != iter->prio test. A single priority is also
> safe, but for a different reason worth stating: with one bucket no node
> is ever linked onto prio_list at all -- plist_add() skips it for the
> first node and for every node whose predecessor shares its priority --
> so list_empty(&iter->prio_list) holds and the shortcut is never entered.
>
> ...
>
Thanks.
> Fixes: 95d4b3450ebe ("lib/plist.c: add shortcut for plist_requeue()")
> Cc: stable@vger.kernel.org # v6.15+
Why the cc:stable? A description of the userspace impact would help
people understand the need for backporting. Please always include
such a description when fixing things.
prev parent reply other threads:[~2026-09-03 23:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 22:24 [PATCH] lib/plist: fix plist_requeue() corrupting order in the last bucket Adam Harshbarger
2026-09-03 23:53 ` Andrew Morton [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=20260903165328.2e781581d28ce1f4dbbc0da7@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=handyhandyman.adam@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=richard120310@gmail.com \
--cc=stable@vger.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.