Skip to content

Commit 83f3655

Browse files
vnagarnaikrostedt
authored andcommitted
ring-buffer: Allow for rescheduling when removing pages
When reducing ring buffer size, pages are removed by scheduling a work item on each CPU for the corresponding CPU ring buffer. After the pages are removed from ring buffer linked list, the pages are free()d in a tight loop. The loop does not give up CPU until all pages are removed. In a worst case behavior, when lot of pages are to be freed, it can cause system stall. After the pages are removed from the list, the free() can happen while the work is rescheduled. Call cond_resched() in the loop to prevent the system hangup. Link: http://lkml.kernel.org/r/[email protected] Cc: [email protected] Fixes: 83f4031 ("ring-buffer: Make removal of ring buffer pages atomic") Reported-by: Jason Behmer <[email protected]> Signed-off-by: Vaibhav Nagarnaik <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 7876320 commit 83f3655

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/trace/ring_buffer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,8 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages)
15461546
tmp_iter_page = first_page;
15471547

15481548
do {
1549+
cond_resched();
1550+
15491551
to_remove_page = tmp_iter_page;
15501552
rb_inc_page(cpu_buffer, &tmp_iter_page);
15511553

0 commit comments

Comments
 (0)