Commit fcc0669
memcg: skip cgroup_file_notify if spinning is not allowed
Generally memcg charging is allowed from all the contexts including NMI
where even spinning on spinlock can cause locking issues. However one
call chain was missed during the addition of memcg charging from any
context support. That is try_charge_memcg() -> memcg_memory_event() ->
cgroup_file_notify().
The possible function call tree under cgroup_file_notify() can acquire
many different spin locks in spinning mode. Some of them are
cgroup_file_kn_lock, kernfs_notify_lock, pool_workqeue's lock. So, let's
just skip cgroup_file_notify() from memcg charging if the context does not
allow spinning.
Alternative approach was also explored where instead of skipping
cgroup_file_notify(), we defer the memcg event processing to irq_work [1].
However it adds complexity and it was decided to keep things simple until
we need more memcg events with !allow_spinning requirement.
Link: https://lore.kernel.org/all/5qi2llyzf7gklncflo6gxoozljbm4h3tpnuv4u4ej4ztysvi6f@x44v7nz2wdzd/ [1]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 3ac4638 ("memcg: make memcg_rstat_updated nmi safe")
Signed-off-by: Shakeel Butt <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Cc: Alexei Starovoitov <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Kumar Kartikeya Dwivedi <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Peilin Ye <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent 7a405db commit fcc0669
2 files changed
+23
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1001 | 1001 | | |
1002 | 1002 | | |
1003 | 1003 | | |
1004 | | - | |
1005 | | - | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
1006 | 1007 | | |
1007 | 1008 | | |
1008 | 1009 | | |
1009 | 1010 | | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
1010 | 1014 | | |
1011 | | - | |
| 1015 | + | |
1012 | 1016 | | |
1013 | 1017 | | |
1014 | 1018 | | |
1015 | 1019 | | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
1020 | 1026 | | |
1021 | 1027 | | |
1022 | 1028 | | |
| |||
1026 | 1032 | | |
1027 | 1033 | | |
1028 | 1034 | | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1029 | 1041 | | |
1030 | 1042 | | |
1031 | 1043 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2307 | 2307 | | |
2308 | 2308 | | |
2309 | 2309 | | |
| 2310 | + | |
2310 | 2311 | | |
2311 | 2312 | | |
2312 | 2313 | | |
2313 | 2314 | | |
2314 | 2315 | | |
2315 | | - | |
| 2316 | + | |
2316 | 2317 | | |
2317 | 2318 | | |
2318 | 2319 | | |
| |||
2348 | 2349 | | |
2349 | 2350 | | |
2350 | 2351 | | |
2351 | | - | |
| 2352 | + | |
2352 | 2353 | | |
2353 | 2354 | | |
2354 | 2355 | | |
| |||
2415 | 2416 | | |
2416 | 2417 | | |
2417 | 2418 | | |
2418 | | - | |
| 2419 | + | |
2419 | 2420 | | |
2420 | 2421 | | |
2421 | 2422 | | |
| |||
0 commit comments