From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,tj@kernel.org,wangkefeng.wang@huawei.com,akpm@linux-foundation.org
Subject: [merged mm-stable] mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch removed from -mm tree
Date: Sun, 05 May 2024 17:57:52 -0700 [thread overview]
Message-ID: <20240506005752.BC9ADC113CC@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm: swapfile: check usable swap device in __folio_throttle_swaprate()
has been removed from the -mm tree. Its filename was
mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: mm: swapfile: check usable swap device in __folio_throttle_swaprate()
Date: Thu, 18 Apr 2024 21:56:44 +0800
Skip blk_cgroup_congested() if there is no usable swap device since no
swapin/out will occur, Thereby avoid taking swap_lock. The difference
is shown below from perf date of CoW pagefault,
perf report -g -i perf.data.swapon | egrep "blk_cgroup_congested|__folio_throttle_swaprate"
1.01% 0.16% page_fault2_pro [kernel.kallsyms] [k] __folio_throttle_swaprate
0.83% 0.80% page_fault2_pro [kernel.kallsyms] [k] blk_cgroup_congested
perf report -g -i perf.data.swapoff | egrep "blk_cgroup_congested|__folio_throttle_swaprate"
0.15% 0.15% page_fault2_pro [kernel.kallsyms] [k] __folio_throttle_swaprate
Link: https://lkml.kernel.org/r/20240418135644.2736748-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/swapfile.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/mm/swapfile.c~mm-swapfile-check-usable-swap-device-in-__folio_throttle_swaprate
+++ a/mm/swapfile.c
@@ -2444,13 +2444,17 @@ static void reinsert_swap_info(struct sw
spin_unlock(&swap_lock);
}
+static bool __has_usable_swap(void)
+{
+ return !plist_head_empty(&swap_active_head);
+}
+
bool has_usable_swap(void)
{
- bool ret = true;
+ bool ret;
spin_lock(&swap_lock);
- if (plist_head_empty(&swap_active_head))
- ret = false;
+ ret = __has_usable_swap();
spin_unlock(&swap_lock);
return ret;
}
@@ -3710,6 +3714,9 @@ void __folio_throttle_swaprate(struct fo
if (!(gfp & __GFP_IO))
return;
+ if (!__has_usable_swap())
+ return;
+
if (!blk_cgroup_congested())
return;
_
Patches currently in -mm which might be from wangkefeng.wang@huawei.com are
reply other threads:[~2024-05-06 0:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240506005752.BC9ADC113CC@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=mm-commits@vger.kernel.org \
--cc=tj@kernel.org \
--cc=wangkefeng.wang@huawei.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).