cgroup: make TRACE_CGROUP_PATH irq-safe

To use the TRACE_CGROUP_PATH() macro with css_set_lock
locked, let's make the macro irq-safe.
It's necessary in order to trace cgroup freezer state
transitions (frozen/not frozen), which are happening
with css_set_lock locked.

Signed-off-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
Roman Gushchin 2019-04-19 10:03:07 -07:00 committed by Tejun Heo
parent 5313bfe425
commit 712e351787

View File

@ -28,12 +28,15 @@ extern void __init enable_debug_cgroup(void);
#define TRACE_CGROUP_PATH(type, cgrp, ...) \ #define TRACE_CGROUP_PATH(type, cgrp, ...) \
do { \ do { \
if (trace_cgroup_##type##_enabled()) { \ if (trace_cgroup_##type##_enabled()) { \
spin_lock(&trace_cgroup_path_lock); \ unsigned long flags; \
spin_lock_irqsave(&trace_cgroup_path_lock, \
flags); \
cgroup_path(cgrp, trace_cgroup_path, \ cgroup_path(cgrp, trace_cgroup_path, \
TRACE_CGROUP_PATH_LEN); \ TRACE_CGROUP_PATH_LEN); \
trace_cgroup_##type(cgrp, trace_cgroup_path, \ trace_cgroup_##type(cgrp, trace_cgroup_path, \
##__VA_ARGS__); \ ##__VA_ARGS__); \
spin_unlock(&trace_cgroup_path_lock); \ spin_unlock_irqrestore(&trace_cgroup_path_lock, \
flags); \
} \ } \
} while (0) } while (0)