From: Baoquan He <bhe@redhat.com>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, chrisl@kernel.org, kasong@tencent.com,
baohua@kernel.org, nphamcs@gmail.com, shikemeng@huaweicloud.com,
Baoquan He <bhe@redhat.com>
Subject: [PATCH 1/3] mm/swapfile.c: remove __has_usable_swap()
Date: Wed, 1 Oct 2025 12:34:34 +0800 [thread overview]
Message-ID: <20251001043436.41338-2-bhe@redhat.com> (raw)
In-Reply-To: <20251001043436.41338-1-bhe@redhat.com>
Global total_swap_pages can indicate if usable swap deivice is present,
use it instead of __has_usable_swap().
Signed-off-by: Baoquan He <bhe@redhat.com>
---
mm/swapfile.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 2bd8bd76ea28..5d71c748a2fe 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3836,11 +3836,6 @@ static void free_swap_count_continuations(struct swap_info_struct *si)
}
#if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP)
-static bool __has_usable_swap(void)
-{
- return !plist_head_empty(&swap_active_head);
-}
-
void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp)
{
struct swap_info_struct *si, *next;
@@ -3848,7 +3843,7 @@ void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp)
if (!(gfp & __GFP_IO))
return;
- if (!__has_usable_swap())
+ if (!total_swap_pages)
return;
if (!blk_cgroup_congested())
--
2.41.0
next prev parent reply other threads:[~2025-10-01 4:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 4:34 [PATCH 0/3] mm/swap: remove plist swap_active_head Baoquan He
2025-10-01 4:34 ` Baoquan He [this message]
2025-10-01 4:34 ` [PATCH 2/3] mm/swapfile.c: use swap_info[] to find the swap device Baoquan He
2025-10-02 15:59 ` Chris Li
2025-10-03 2:38 ` Baoquan He
2025-10-03 4:50 ` Chris Li
2025-10-03 5:29 ` Baoquan He
2025-10-01 4:34 ` [PATCH 3/3] mm/swap: remove unneeded swap_active_head Baoquan He
2025-10-02 8:33 ` Chris Li
2025-10-02 13:42 ` Baoquan He
2025-10-09 3:26 ` Andrew Morton
2025-10-09 7:47 ` Baoquan He
2025-10-09 17:09 ` Chris Li
2025-10-10 2:56 ` YoungJun Park
2025-10-10 1:28 ` Andrew Morton
2025-10-10 2:14 ` Baoquan He
2025-10-10 2:34 ` Chris Li
2025-10-10 2:33 ` Chris Li
2025-10-10 2:52 ` Chris Li
2025-10-02 6:04 ` [PATCH 0/3] mm/swap: remove plist swap_active_head Chris Li
2025-10-02 13:09 ` Baoquan He
2025-10-02 16:23 ` Chris Li
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=20251001043436.41338-2-bhe@redhat.com \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=chrisl@kernel.org \
--cc=kasong@tencent.com \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=shikemeng@huaweicloud.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