linux-stable/kernel
Zheng Yejian f1c2b40261 ring-buffer: Avoid softlockup in ring_buffer_resize()
[ Upstream commit f6bd2c9248 ]

When user resize all trace ring buffer through file 'buffer_size_kb',
then in ring_buffer_resize(), kernel allocates buffer pages for each
cpu in a loop.

If the kernel preemption model is PREEMPT_NONE and there are many cpus
and there are many buffer pages to be allocated, it may not give up cpu
for a long time and finally cause a softlockup.

To avoid it, call cond_resched() after each cpu buffer allocation.

Link: https://lore.kernel.org/linux-trace-kernel/20230906081930.3939106-1-zhengyejian1@huawei.com

Cc: <mhiramat@kernel.org>
Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-10-10 21:43:39 +02:00
..
bpf bpf: Address KCSAN report on bpf_lru_list 2023-08-11 11:33:48 +02:00
cgroup cgroup:namespace: Remove unused cgroup_namespaces_init() 2023-09-23 10:46:58 +02:00
configs
debug kdb: Make memory allocations more robust 2021-03-03 18:22:36 +01:00
events perf: Fix function pointer case 2023-08-11 11:33:54 +02:00
gcov gcov: add support for checksum field 2023-01-18 09:26:35 +01:00
irq irqdomain: Drop bogus fwspec-mapping error handling 2023-03-11 16:26:47 +01:00
livepatch livepatch: fix race between fork and KLP transition 2022-10-26 13:16:57 +02:00
locking treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
power PM: hibernate: Fix mistake in kerneldoc comment 2023-01-18 09:26:09 +01:00
printk printk: fix return value of printk.devkmsg __setup handler 2022-04-20 09:08:15 +02:00
rcu rcu: Suppress smp_processor_id() complaint in synchronize_rcu_expedited_wait() 2023-03-11 16:26:41 +01:00
sched sched/fair: Don't balance task to its current running CPU 2023-08-11 11:33:48 +02:00
time posix-timers: Ensure timer ID search-loop limit is valid 2023-08-11 11:33:48 +02:00
trace ring-buffer: Avoid softlockup in ring_buffer_resize() 2023-10-10 21:43:39 +02:00
.gitignore
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
Makefile elfcore: fix building with clang 2021-02-10 09:12:08 +01:00
acct.c acct: fix potential integer overflow in encode_comp_t() 2023-01-18 09:26:30 +01:00
async.c treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
audit.c treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
audit.h audit: fix a net reference leak in audit_list_rules_send() 2020-06-20 10:25:10 +02:00
audit_fsnotify.c audit: fix potential double free on error path from fsnotify_add_inode_mark 2022-09-05 10:25:02 +02:00
audit_tree.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
audit_watch.c audit: CONFIG_CHANGE don't log internal bookkeeping as an event 2020-10-01 13:12:33 +02:00
auditfilter.c audit: fix a net reference leak in audit_list_rules_send() 2020-06-20 10:25:10 +02:00
auditsc.c audit: fix possible soft lockup in __audit_inode_child() 2023-09-23 10:46:56 +02:00
backtracetest.c
bounds.c kbuild: fix kernel/bounds.c 'W=1' warning 2018-11-13 11:15:08 -08:00
capability.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
compat.c sched_getaffinity: don't assume 'cpumask_size()' is fully initialized 2023-04-05 11:14:19 +02:00
configs.c
context_tracking.c
cpu.c random: clear fast pool, crng, and batches in cpuhp bring up 2022-06-25 11:46:35 +02:00
cpu_pm.c kernel/cpu_pm: Fix uninitted local in cpu_pm 2020-06-20 10:25:19 +02:00
crash_core.c kdump: write correct address of mem_section into vmcoreinfo 2018-01-17 09:45:27 +01:00
crash_dump.c
cred.c memcg: account security cred as well to kmemcg 2020-01-09 10:17:54 +01:00
delayacct.c delayacct: Use raw_spinlocks 2018-08-03 07:50:38 +02:00
dma.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
exec_domain.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
exit.c treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
extable.c kernel/extable.c: use address-of operator on section symbols 2023-06-09 10:22:53 +02:00
fork.c mm/hugetlb: initialize hugetlb_usage in mm_init 2021-09-22 11:45:32 +02:00
freezer.c
futex.c treewide: Remove uninitialized_var() usage 2023-08-11 11:33:32 +02:00
groups.c kernel: make groups_sort calling a responsibility group_info allocators 2017-12-20 10:10:18 +01:00
hung_task.c kernel: hung_task.c: disable on suspend 2019-04-20 09:15:05 +02:00
irq_work.c
jump_label.c sched/core: Fix cpu.max vs. cpuhotplug deadlock 2018-12-05 19:41:17 +01:00
kallsyms.c kallsyms: Don't let kallsyms_lookup_size_offset() fail on retrieving the first symbol 2019-09-21 07:15:38 +02:00
kcmp.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kcov.c kcov: ensure irq code sees a valid area 2018-08-03 07:50:22 +02:00
kexec.c
kexec_core.c kexec: fix a memory leak in crash_shrink_memory() 2023-08-11 11:33:34 +02:00
kexec_file.c kexec_file: drop weak attribute from arch_kexec_apply_relocations[_add] 2022-07-02 16:18:11 +02:00
kexec_internal.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kmod.c kmod: make request_module() return an error when autoloading is disabled 2020-04-24 08:00:44 +02:00
kprobes.c x86/kprobes: Fix arch_check_optimized_kprobe check within optimized_kprobe range 2023-03-11 16:26:46 +01:00
ksysfs.c
kthread.c kthread: prevent deadlock when kthread_mod_delayed_work() races with kthread_cancel_delayed_work_sync() 2021-07-11 12:48:13 +02:00
latencytop.c
memremap.c mm, devm_memremap_pages: kill mapping "System RAM" support 2019-01-13 10:01:02 +01:00
module-internal.h
module.c modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules 2023-09-23 10:46:52 +02:00
module_signing.c
notifier.c x86/mm: split vmalloc_sync_all() 2020-04-02 16:34:20 +02:00
nsproxy.c
padata.c padata: purge get_cpu and reorder_via_wq from padata_do_serial 2020-05-27 16:43:05 +02:00
panic.c exit: Use READ_ONCE() for all oops/warn limit reads 2023-02-06 07:46:35 +01:00
params.c kernel/params.c: improve STANDARD_PARAM_DEF readability 2017-10-03 17:54:26 -07:00
pid.c
pid_namespace.c memcg: enable accounting for pids in nested pid namespaces 2021-09-22 11:45:32 +02:00
profile.c profiling: fix shift too large makes kernel panic 2022-08-25 11:11:24 +02:00
ptrace.c ptrace: Reimplement PTRACE_KILL by always sending SIGKILL 2022-06-14 16:53:43 +02:00
range.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
reboot.c reboot: fix overflow parsing reboot cpu number 2020-11-18 18:28:02 +01:00
relay.c kernel/relay.c: fix memleak on destroy relay channel 2020-08-26 10:29:54 +02:00
resource.c resource: fix integer overflow at reallocation 2018-04-24 09:36:22 +02:00
seccomp.c seccomp: Invalidate seccomp mode to catch death failures 2022-02-16 12:44:52 +01:00
signal.c signal handling: don't use BUG_ON() for debugging 2022-07-21 20:42:47 +02:00
smp.c smp: Fix offline cpu check in flush_smp_call_function_queue() 2022-04-20 09:08:33 +02:00
smpboot.c kthread: Extract KTHREAD_IS_PER_CPU 2021-02-07 14:47:41 +01:00
smpboot.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
softirq.c Mark HI and TASKLET softirq synchronous 2018-08-15 18:12:47 +02:00
stacktrace.c
stop_machine.c stop_machine: Atomically queue and wake stopper threads 2018-09-05 09:26:36 +02:00
sys.c prlimit: do_prlimit needs to have a speculation check 2023-01-24 07:05:18 +01:00
sys_ni.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sysctl.c proc: proc_skip_spaces() shouldn't think it is working on C strings 2022-12-08 11:16:33 +01:00
sysctl_binary.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
task_work.c locking/barriers: Convert users of lockless_dereference() to READ_ONCE() 2017-12-25 14:26:21 +01:00
taskstats.c taskstats: fix data-race 2020-01-09 10:17:53 +01:00
test_kprobes.c
torture.c
tracepoint.c tracepoint: Do not fail unregistering a probe due to memory failure 2021-03-03 18:22:47 +01:00
tsacct.c taskstats: Cleanup the use of task->exit_code 2022-02-23 11:57:34 +01:00
ucount.c
uid16.c kernel: make groups_sort calling a responsibility group_info allocators 2017-12-20 10:10:18 +01:00
umh.c usermodehelper: reset umask to default before executing user process 2020-10-14 09:51:10 +02:00
up.c smp: Fix smp_call_function_single_async prototype 2021-05-22 10:57:35 +02:00
user-return-notifier.c
user.c
user_namespace.c userns: move user access out of the mutex 2018-09-09 19:56:00 +02:00
utsname.c
utsname_sysctl.c sys: don't hold uts_sem while accessing userspace memory 2018-09-09 19:56:00 +02:00
watchdog.c watchdog/softlockup: Enforce that timestamp is valid on boot 2020-02-28 16:36:05 +01:00
watchdog_hld.c watchdog/perf: more properly prevent false positives with turbo modes 2023-08-11 11:33:34 +02:00
workqueue.c workqueue: clean up WORK_* constant types, clarify masking 2023-08-11 11:33:43 +02:00
workqueue_internal.h Merge branch 'for-4.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2017-11-06 12:26:49 -08:00