summarylogtreecommitdiffstats
path: root/disable_writeback_workaround.patch
blob: 57e51da914d4a507140387e6bc66b3fb36fe1937 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff -rupN WoeUSB-3.3.0/src/woeusb WoeUSB-3.3.0-fix/src/woeusb
--- WoeUSB-3.3.0/src/woeusb	2019-03-26 03:34:51.000000000 +0100
+++ WoeUSB-3.3.0-fix/src/woeusb	2019-08-03 09:10:10.553378730 +0200
@@ -308,9 +308,6 @@ init(){
 
 	current_state=copying-filesystem
 
-	workaround_linux_make_writeback_buffering_not_suck \
-		apply
-
 	copy_filesystem_files \
 		"${source_fs_mountpoint}" \
 		"${target_fs_mountpoint}" \
@@ -1650,41 +1647,6 @@ workaround_support_windows_7_uefi_boot()
 		> "${efi_boot_directory}/bootx64.efi"
 }; declare -fr workaround_support_windows_7_uefi_boot
 
-## Currently WoeUSB indirectly causes severely unresponsive system on 64-bit architecture with large primary memory during file copy process due to a flaw of the writeback buffer size handling in Linux kernel, workaround it before it is fixed
-## Refer: 
-## - System lagging while copying data · Issue #113 · slacka/WoeUSB <https://github.com/slacka/WoeUSB/issues/113>
-## - The pernicious USB-stick stall problem [LWN.net] <https://lwn.net/Articles/572911/>
-workaround_linux_make_writeback_buffering_not_suck(){
-	util_check_function_parameters_quantity 1 "${#}"
-	local -r mode="${1}"
-
-	local -ir VM_DIRTY_BACKGROUND_BYTES=$((16*1024*1024)) # 16MiB
-	local -ir VM_DIRTY_BYTES=$((48*1024*1024)) # 48MiB
-
-	case "${mode}" in
-		apply)
-			echo_with_color \
-				yellow \
-				'Applying workaround to prevent 64-bit systems with big primary memory from being unresponsive during copying files.'
-			echo "${VM_DIRTY_BACKGROUND_BYTES}" > /proc/sys/vm/dirty_background_bytes
-			echo "${VM_DIRTY_BYTES}" > /proc/sys/vm/dirty_bytes
-		;;
-		reset)
-			echo_with_color \
-				yellow \
-				'Resetting workaround to prevent 64-bit systems with big primary memory from being unresponsive during copying files.'
-			echo 0 > /proc/sys/vm/dirty_background_bytes
-			echo 0 > /proc/sys/vm/dirty_bytes
-		;;
-		*)
-			printf_with_color \
-				red \
-				'Fatal: %s: Unexpected *mode* encountered, please report bug.\n' \
-				"${FUNCNAME[0]}"
-		;;
-	esac
-}; declare -fr workaround_linux_make_writeback_buffering_not_suck
-
 install_legacy_pc_bootloader_grub(){
 	util_check_function_parameters_quantity 3 "${#}"
 	local -r target_fs_mountpoint="${1}"; shift 1
@@ -1836,13 +1798,6 @@ trap_exit(){
 		off \
 		"${global_only_for_gui}"
 
-	case "${current_state}" in
-		copying-filesystem|finished)
-			workaround_linux_make_writeback_buffering_not_suck \
-				reset
-		;;
-	esac
-
 	if util_is_parameter_set_and_not_empty \
 		source_fs_mountpoint; then
 		if ! cleanup_mountpoint  \