--
A mail was sent to you sometime last week with the expectation of
having a return mail from you but to my surprise you never bothered to replied.
Kindly reply for further explanations.
Respectfully yours,
Barrister. Douglas Felix.
This is an alrady known issue that dm-thin volume cannot be used as
swap, otherwise a deadlock may happen when dm-thin internal memory
demond triggers swap I/O on the dm-thin volume itself.
Thanks to Mikulas Patocka for commit a666e5c05e7c ("dm: fix deadlock
when swapping to encrypted device"), this method can also be used for
dm-thin to avoid the recursive I/O when it is used as swap.
This patch just simply sets ti->limit_swap_bios by tree in pool_ctr()
and thin_ctr(), other important stuffs are already done by Patocka in
the above mentioned commit.
In my test, I create a dm-thin volume /dev/vg/swap and use it as swap
device. Then I run fio on another dm-thin volume /dev/vg/main and use
large --blocksize to trigger swap I/O onto /dev/vg/swap.
The following fio command line is used in my test,
fio --name recursive-swap-io --lockmem 1 --iodepth 128 \
--ioengine libaio --filename /dev/vg/main --rw randrw \
--blocksize 1M --numjobs 32 --time_based --runtime=12h
Without the patch, the whole system can be locked up within 15 seconds.
With this patch, there is no any deadlock or hang task observed after
2 hours fio running.
Further more, I change --blocksize from 1M to 128M, around 30 seconds
after fio running, no I/O rate displayed by fio, and the out-of-memory
killer message shows up in kernel message. After around 20 minutes all
fio processes are killed and the whole system backs to be alive.
This is exactly what is expected when recursive I/O happens on dm-thin
volume when it is used as swap.
Note: this change depends on commit a666e5c05e7c ("dm: fix deadlock when
swapping to encrypted device")
Signed-off-by: Coly Li <colyli(a)suse.de>
Cc: Mikulas Patocka <mpatocka(a)redhat.com>
Cc: Mike Snitzer <snitzer(a)kernel.org>
Cc: stable(a)vger.kernel.org
---
Changelog,
v2: fix typo in commit log.
v1: initial version.
drivers/md/dm-thin.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -3355,6 +3355,7 @@ static int pool_ctr(struct dm_target *ti
pt->low_water_blocks = low_water_blocks;
pt->adjusted_pf = pt->requested_pf = pf;
ti->num_flush_bios = 1;
+ ti->limit_swap_bios = true;
/*
* Only need to enable discards if the pool should pass
@@ -4233,6 +4234,7 @@ static int thin_ctr(struct dm_target *ti
goto bad;
ti->num_flush_bios = 1;
+ ti->limit_swap_bios = true;
ti->flush_supported = true;
ti->accounts_remapped_io = true;
ti->per_io_data_size = sizeof(struct dm_thin_endio_hook);
Dear Linux folks,
It’d be great if you could apply the commit below [1], present in Linux
since 6.2-rc1, to at least the Linux 6.1 LTS series.
commit a449dfbfc0894676ad0aa1873383265047529e3a
Author: Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
Date: Thu Dec 1 19:33:09 2022 +0100
PM: sleep: Avoid using pr_cont() in the tasks freezing code
Using pr_cont() in the tasks freezing code related to system-wide
suspend and hibernation is problematic, because the continuation
messages printed there are susceptible to interspersing with other
unrelated messages which results in output that is hard to
understand.
Address this issue by modifying try_to_freeze_tasks() to print
messages that don't require continuations and adjusting its
callers accordingly.
Reported-by: Thomas Weißschuh <linux(a)weissschuh.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
Reviewed-by: Petr Mladek <pmladek(a)suse.com>
On a Dell Precision 3540, Linux 6.1.12 from Debian sid/unstable logs the
stray warning below:
$ sudo dmesg --level=warn | grep elapsed
[ 3063.289579] (elapsed 0.047 seconds) done.
It’s due to `pr_cont` usage, and the another (DRM) log message adds the
unexpected newline character, splitting the message:
[ 0.000000] Linux version 6.1.0-5-amd64
(debian-kernel(a)lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU
ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian
6.1.12-1 (2023-02-15)
[…]
[ 0.000000] DMI: Dell Inc. Precision 3540/0M14W7, BIOS 1.23.0
12/19/2022
[…]
[ 3063.241846] Freezing user space processes ...
[ 3063.281999] [drm] VCE initialized successfully.
[ 3063.289579] (elapsed 0.047 seconds) done.
Backporting the patch would change the log messages a little though. No
idea, if that is acceptable for commit for stable series.
Kind regards,
Paul
[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…