@@ -44,12 +44,10 @@ static int sched_itmt_update_handler(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(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
@@ -98,18 +94,14 @@ static struct ctl_table_header *itmt_sysctl_header;
98
94
*/
99
95
int sched_set_itmt_support (void )
100
96
{
101
- mutex_lock (& itmt_update_mutex );
97
+ guard ( mutex ) (& itmt_update_mutex );
102
98
103
- if (sched_itmt_capable ) {
104
- mutex_unlock (& itmt_update_mutex );
99
+ if (sched_itmt_capable )
105
100
return 0 ;
106
- }
107
101
108
102
itmt_sysctl_header = register_sysctl ("kernel" , itmt_kern_table );
109
- if (!itmt_sysctl_header ) {
110
- mutex_unlock (& itmt_update_mutex );
103
+ if (!itmt_sysctl_header )
111
104
return - ENOMEM ;
112
- }
113
105
114
106
sched_itmt_capable = true;
115
107
@@ -118,8 +110,6 @@ int sched_set_itmt_support(void)
118
110
x86_topology_update = true;
119
111
rebuild_sched_domains ();
120
112
121
- mutex_unlock (& itmt_update_mutex );
122
-
123
113
return 0 ;
124
114
}
125
115
@@ -135,12 +125,11 @@ int sched_set_itmt_support(void)
135
125
*/
136
126
void sched_clear_itmt_support (void )
137
127
{
138
- mutex_lock (& itmt_update_mutex );
128
+ guard ( mutex ) (& itmt_update_mutex );
139
129
140
- if (!sched_itmt_capable ) {
141
- mutex_unlock (& itmt_update_mutex );
130
+ if (!sched_itmt_capable )
142
131
return ;
143
- }
132
+
144
133
sched_itmt_capable = false;
145
134
146
135
if (itmt_sysctl_header ) {
@@ -154,8 +143,6 @@ void sched_clear_itmt_support(void)
154
143
x86_topology_update = true;
155
144
rebuild_sched_domains ();
156
145
}
157
-
158
- mutex_unlock (& itmt_update_mutex );
159
146
}
160
147
161
148
int arch_asym_cpu_priority (int cpu )
0 commit comments