Commit 779b995
mm: zswap: move allocations during CPU init outside the lock
In zswap_cpu_comp_prepare(), allocations are made and assigned to various
members of acomp_ctx under acomp_ctx->mutex. However, allocations may
recurse into zswap through reclaim, trying to acquire the same mutex and
deadlocking.
Move the allocations before the mutex critical section. Only the
initialization of acomp_ctx needs to be done with the mutex held.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 12dcb0e ("mm: zswap: properly synchronize freeing resources during CPU hotunplug")
Signed-off-by: Yosry Ahmed <[email protected]>
Reviewed-by: Chengming Zhou <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Nhat Pham <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent f1897f2 commit 779b995
1 file changed
+24
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
820 | 820 | | |
821 | 821 | | |
822 | 822 | | |
823 | | - | |
824 | | - | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
825 | 826 | | |
826 | 827 | | |
827 | | - | |
828 | | - | |
829 | | - | |
| 828 | + | |
| 829 | + | |
830 | 830 | | |
831 | | - | |
| 831 | + | |
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
839 | | - | |
| 839 | + | |
840 | 840 | | |
841 | | - | |
842 | | - | |
843 | 841 | | |
844 | | - | |
| 842 | + | |
845 | 843 | | |
846 | 844 | | |
847 | 845 | | |
848 | 846 | | |
849 | | - | |
| 847 | + | |
850 | 848 | | |
851 | | - | |
852 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
853 | 856 | | |
| 857 | + | |
854 | 858 | | |
855 | 859 | | |
856 | 860 | | |
| |||
859 | 863 | | |
860 | 864 | | |
861 | 865 | | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
862 | 870 | | |
863 | 871 | | |
864 | 872 | | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
871 | 877 | | |
872 | 878 | | |
873 | 879 | | |
| |||
0 commit comments