@@ -44,12 +44,10 @@ static int sched_itmt_update_handler(const struct ctl_table *table, int write,
44
44
unsigned int old_sysctl ;
45
45
int ret ;
46
46
47
- mutex_lock (& itmt_update_mutex );
47
+ guard ( mutex ) (& itmt_update_mutex );
48
48
49
- if (!sched_itmt_capable ) {
50
- mutex_unlock (& itmt_update_mutex );
49
+ if (!sched_itmt_capable )
51
50
return - EINVAL ;
52
- }
53
51
54
52
old_sysctl = sysctl_sched_itmt_enabled ;
55
53
ret = proc_dointvec_minmax (table , write , buffer , lenp , ppos );
@@ -59,8 +57,6 @@ static int sched_itmt_update_handler(const struct ctl_table *table, int write,
59
57
rebuild_sched_domains ();
60
58
}
61
59
62
- mutex_unlock (& itmt_update_mutex );
63
-
64
60
return ret ;
65
61
}
66
62
@@ -97,18 +93,14 @@ static struct ctl_table_header *itmt_sysctl_header;
97
93
*/
98
94
int sched_set_itmt_support (void )
99
95
{
100
- mutex_lock (& itmt_update_mutex );
96
+ guard ( mutex ) (& itmt_update_mutex );
101
97
102
- if (sched_itmt_capable ) {
103
- mutex_unlock (& itmt_update_mutex );
98
+ if (sched_itmt_capable )
104
99
return 0 ;
105
- }
106
100
107
101
itmt_sysctl_header = register_sysctl ("kernel" , itmt_kern_table );
108
- if (!itmt_sysctl_header ) {
109
- mutex_unlock (& itmt_update_mutex );
102
+ if (!itmt_sysctl_header )
110
103
return - ENOMEM ;
111
- }
112
104
113
105
sched_itmt_capable = true;
114
106
@@ -117,8 +109,6 @@ int sched_set_itmt_support(void)
117
109
x86_topology_update = true;
118
110
rebuild_sched_domains ();
119
111
120
- mutex_unlock (& itmt_update_mutex );
121
-
122
112
return 0 ;
123
113
}
124
114
@@ -134,12 +124,11 @@ int sched_set_itmt_support(void)
134
124
*/
135
125
void sched_clear_itmt_support (void )
136
126
{
137
- mutex_lock (& itmt_update_mutex );
127
+ guard ( mutex ) (& itmt_update_mutex );
138
128
139
- if (!sched_itmt_capable ) {
140
- mutex_unlock (& itmt_update_mutex );
129
+ if (!sched_itmt_capable )
141
130
return ;
142
- }
131
+
143
132
sched_itmt_capable = false;
144
133
145
134
if (itmt_sysctl_header ) {
@@ -153,8 +142,6 @@ void sched_clear_itmt_support(void)
153
142
x86_topology_update = true;
154
143
rebuild_sched_domains ();
155
144
}
156
-
157
- mutex_unlock (& itmt_update_mutex );
158
145
}
159
146
160
147
int arch_asym_cpu_priority (int cpu )
0 commit comments