diff options
-rw-r--r-- | recipes-kernel/linux/files/0001-Revert-writeback-Fix-sync-livelock-due-to-b_dirty_ti.patch | 194 | ||||
-rw-r--r-- | recipes-kernel/linux/linux-raspberrypi_5.4.bb | 1 |
2 files changed, 0 insertions, 195 deletions
diff --git a/recipes-kernel/linux/files/0001-Revert-writeback-Fix-sync-livelock-due-to-b_dirty_ti.patch b/recipes-kernel/linux/files/0001-Revert-writeback-Fix-sync-livelock-due-to-b_dirty_ti.patch deleted file mode 100644 index 70c14ab..0000000 --- a/recipes-kernel/linux/files/0001-Revert-writeback-Fix-sync-livelock-due-to-b_dirty_ti.patch +++ /dev/null | |||
@@ -1,194 +0,0 @@ | |||
1 | From a9d72cb8d30eb0ab0175e9b055f0a1a19a8142b0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Mon, 14 Sep 2020 16:24:07 +0200 | ||
4 | Subject: [PATCH] Revert "writeback: Fix sync livelock due to b_dirty_time | ||
5 | processing" | ||
6 | |||
7 | This reverts commit 6623c19042b63018230e9468ac16cd1be01abaa3. | ||
8 | |||
9 | * fixes: | ||
10 | lttng-modules/2.12.2-r0/lttng-modules-2.12.2/probes/../probes/lttng-tracepoint-event-impl.h:131:6: error: conflicting types for 'trace_writeback_queue_io' | ||
11 | |||
12 | * The issue is that writeback_queue_io was updated in lttng-modules in: | ||
13 | https://github.com/lttng/lttng-modules/commit/817e02f9e256b8f2cbb9e3125eb061757b83bd4a | ||
14 | which isn't included in 2.12.2 version currently in oe-core and even if it is, then it | ||
15 | checks for kernel version 5.9 and won't work with this commit backported from 5.9 to rpi-5.4.y. | ||
16 | at least until this lttng-modules commit which improves the LINUX_VERSION_CODE check to | ||
17 | include LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) | ||
18 | https://github.com/lttng/lttng-modules/commit/b6af46d166c48c9e59600a60b5a2a7ead10f179a | ||
19 | |||
20 | Upstream-Status: Pending | ||
21 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
22 | |||
23 | --- | ||
24 | fs/fs-writeback.c | 44 ++++++++++++++++++++------------ | ||
25 | include/trace/events/writeback.h | 13 +++++----- | ||
26 | 2 files changed, 34 insertions(+), 23 deletions(-) | ||
27 | |||
28 | diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c | ||
29 | index 5f6400ba82c0..51f87b673084 100644 | ||
30 | --- a/fs/fs-writeback.c | ||
31 | +++ b/fs/fs-writeback.c | ||
32 | @@ -42,6 +42,7 @@ | ||
33 | struct wb_writeback_work { | ||
34 | long nr_pages; | ||
35 | struct super_block *sb; | ||
36 | + unsigned long *older_than_this; | ||
37 | enum writeback_sync_modes sync_mode; | ||
38 | unsigned int tagged_writepages:1; | ||
39 | unsigned int for_kupdate:1; | ||
40 | @@ -1233,13 +1234,16 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t) | ||
41 | #define EXPIRE_DIRTY_ATIME 0x0001 | ||
42 | |||
43 | /* | ||
44 | - * Move expired (dirtied before dirtied_before) dirty inodes from | ||
45 | + * Move expired (dirtied before work->older_than_this) dirty inodes from | ||
46 | * @delaying_queue to @dispatch_queue. | ||
47 | */ | ||
48 | static int move_expired_inodes(struct list_head *delaying_queue, | ||
49 | struct list_head *dispatch_queue, | ||
50 | - int flags, unsigned long dirtied_before) | ||
51 | + int flags, | ||
52 | + struct wb_writeback_work *work) | ||
53 | { | ||
54 | + unsigned long *older_than_this = NULL; | ||
55 | + unsigned long expire_time; | ||
56 | LIST_HEAD(tmp); | ||
57 | struct list_head *pos, *node; | ||
58 | struct super_block *sb = NULL; | ||
59 | @@ -1247,9 +1251,16 @@ static int move_expired_inodes(struct list_head *delaying_queue, | ||
60 | int do_sb_sort = 0; | ||
61 | int moved = 0; | ||
62 | |||
63 | + if ((flags & EXPIRE_DIRTY_ATIME) == 0) | ||
64 | + older_than_this = work->older_than_this; | ||
65 | + else if (!work->for_sync) { | ||
66 | + expire_time = jiffies - (dirtytime_expire_interval * HZ); | ||
67 | + older_than_this = &expire_time; | ||
68 | + } | ||
69 | while (!list_empty(delaying_queue)) { | ||
70 | inode = wb_inode(delaying_queue->prev); | ||
71 | - if (inode_dirtied_after(inode, dirtied_before)) | ||
72 | + if (older_than_this && | ||
73 | + inode_dirtied_after(inode, *older_than_this)) | ||
74 | break; | ||
75 | list_move(&inode->i_io_list, &tmp); | ||
76 | moved++; | ||
77 | @@ -1295,22 +1306,18 @@ static int move_expired_inodes(struct list_head *delaying_queue, | ||
78 | * | | ||
79 | * +--> dequeue for IO | ||
80 | */ | ||
81 | -static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work, | ||
82 | - unsigned long dirtied_before) | ||
83 | +static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work) | ||
84 | { | ||
85 | int moved; | ||
86 | - unsigned long time_expire_jif = dirtied_before; | ||
87 | |||
88 | assert_spin_locked(&wb->list_lock); | ||
89 | list_splice_init(&wb->b_more_io, &wb->b_io); | ||
90 | - moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, dirtied_before); | ||
91 | - if (!work->for_sync) | ||
92 | - time_expire_jif = jiffies - dirtytime_expire_interval * HZ; | ||
93 | + moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, work); | ||
94 | moved += move_expired_inodes(&wb->b_dirty_time, &wb->b_io, | ||
95 | - EXPIRE_DIRTY_ATIME, time_expire_jif); | ||
96 | + EXPIRE_DIRTY_ATIME, work); | ||
97 | if (moved) | ||
98 | wb_io_lists_populated(wb); | ||
99 | - trace_writeback_queue_io(wb, work, dirtied_before, moved); | ||
100 | + trace_writeback_queue_io(wb, work, moved); | ||
101 | } | ||
102 | |||
103 | static int write_inode(struct inode *inode, struct writeback_control *wbc) | ||
104 | @@ -1822,7 +1829,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, | ||
105 | blk_start_plug(&plug); | ||
106 | spin_lock(&wb->list_lock); | ||
107 | if (list_empty(&wb->b_io)) | ||
108 | - queue_io(wb, &work, jiffies); | ||
109 | + queue_io(wb, &work); | ||
110 | __writeback_inodes_wb(wb, &work); | ||
111 | spin_unlock(&wb->list_lock); | ||
112 | blk_finish_plug(&plug); | ||
113 | @@ -1842,7 +1849,7 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, | ||
114 | * takes longer than a dirty_writeback_interval interval, then leave a | ||
115 | * one-second gap. | ||
116 | * | ||
117 | - * dirtied_before takes precedence over nr_to_write. So we'll only write back | ||
118 | + * older_than_this takes precedence over nr_to_write. So we'll only write back | ||
119 | * all dirty pages if they are all attached to "old" mappings. | ||
120 | */ | ||
121 | static long wb_writeback(struct bdi_writeback *wb, | ||
122 | @@ -1850,11 +1857,14 @@ static long wb_writeback(struct bdi_writeback *wb, | ||
123 | { | ||
124 | unsigned long wb_start = jiffies; | ||
125 | long nr_pages = work->nr_pages; | ||
126 | - unsigned long dirtied_before = jiffies; | ||
127 | + unsigned long oldest_jif; | ||
128 | struct inode *inode; | ||
129 | long progress; | ||
130 | struct blk_plug plug; | ||
131 | |||
132 | + oldest_jif = jiffies; | ||
133 | + work->older_than_this = &oldest_jif; | ||
134 | + | ||
135 | blk_start_plug(&plug); | ||
136 | spin_lock(&wb->list_lock); | ||
137 | for (;;) { | ||
138 | @@ -1888,14 +1898,14 @@ static long wb_writeback(struct bdi_writeback *wb, | ||
139 | * safe. | ||
140 | */ | ||
141 | if (work->for_kupdate) { | ||
142 | - dirtied_before = jiffies - | ||
143 | + oldest_jif = jiffies - | ||
144 | msecs_to_jiffies(dirty_expire_interval * 10); | ||
145 | } else if (work->for_background) | ||
146 | - dirtied_before = jiffies; | ||
147 | + oldest_jif = jiffies; | ||
148 | |||
149 | trace_writeback_start(wb, work); | ||
150 | if (list_empty(&wb->b_io)) | ||
151 | - queue_io(wb, work, dirtied_before); | ||
152 | + queue_io(wb, work); | ||
153 | if (work->sb) | ||
154 | progress = writeback_sb_inodes(work->sb, wb, work); | ||
155 | else | ||
156 | diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h | ||
157 | index 67434278b81d..66282552db20 100644 | ||
158 | --- a/include/trace/events/writeback.h | ||
159 | +++ b/include/trace/events/writeback.h | ||
160 | @@ -499,9 +499,8 @@ DEFINE_WBC_EVENT(wbc_writepage); | ||
161 | TRACE_EVENT(writeback_queue_io, | ||
162 | TP_PROTO(struct bdi_writeback *wb, | ||
163 | struct wb_writeback_work *work, | ||
164 | - unsigned long dirtied_before, | ||
165 | int moved), | ||
166 | - TP_ARGS(wb, work, dirtied_before, moved), | ||
167 | + TP_ARGS(wb, work, moved), | ||
168 | TP_STRUCT__entry( | ||
169 | __array(char, name, 32) | ||
170 | __field(unsigned long, older) | ||
171 | @@ -511,17 +510,19 @@ TRACE_EVENT(writeback_queue_io, | ||
172 | __field(unsigned int, cgroup_ino) | ||
173 | ), | ||
174 | TP_fast_assign( | ||
175 | + unsigned long *older_than_this = work->older_than_this; | ||
176 | strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); | ||
177 | - __entry->older = dirtied_before; | ||
178 | - __entry->age = (jiffies - dirtied_before) * 1000 / HZ; | ||
179 | + __entry->older = older_than_this ? *older_than_this : 0; | ||
180 | + __entry->age = older_than_this ? | ||
181 | + (jiffies - *older_than_this) * 1000 / HZ : -1; | ||
182 | __entry->moved = moved; | ||
183 | __entry->reason = work->reason; | ||
184 | __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); | ||
185 | ), | ||
186 | TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%u", | ||
187 | __entry->name, | ||
188 | - __entry->older, /* dirtied_before in jiffies */ | ||
189 | - __entry->age, /* dirtied_before in relative milliseconds */ | ||
190 | + __entry->older, /* older_than_this in jiffies */ | ||
191 | + __entry->age, /* older_than_this in relative milliseconds */ | ||
192 | __entry->moved, | ||
193 | __print_symbolic(__entry->reason, WB_WORK_REASON), | ||
194 | __entry->cgroup_ino | ||
diff --git a/recipes-kernel/linux/linux-raspberrypi_5.4.bb b/recipes-kernel/linux/linux-raspberrypi_5.4.bb index 48e198f..571b144 100644 --- a/recipes-kernel/linux/linux-raspberrypi_5.4.bb +++ b/recipes-kernel/linux/linux-raspberrypi_5.4.bb | |||
@@ -9,7 +9,6 @@ require linux-raspberrypi_5.4.inc | |||
9 | SRC_URI += "file://0001-Revert-selftests-bpf-Skip-perf-hw-events-test-if-the.patch \ | 9 | SRC_URI += "file://0001-Revert-selftests-bpf-Skip-perf-hw-events-test-if-the.patch \ |
10 | file://0002-Revert-selftests-bpf-Fix-perf_buffer-test-on-systems.patch \ | 10 | file://0002-Revert-selftests-bpf-Fix-perf_buffer-test-on-systems.patch \ |
11 | file://0001-perf-cs-etm-Move-definition-of-traceid_list-global-v.patch \ | 11 | file://0001-perf-cs-etm-Move-definition-of-traceid_list-global-v.patch \ |
12 | file://0001-Revert-writeback-Fix-sync-livelock-due-to-b_dirty_ti.patch \ | ||
13 | file://powersave.cfg \ | 12 | file://powersave.cfg \ |
14 | file://android-drivers.cfg \ | 13 | file://android-drivers.cfg \ |
15 | " | 14 | " |