@@ -66,8 +66,8 @@ torture_param(long, loops, 10000, "Number of loops per experiment.");
66
66
torture_param (int , nreaders , -1 , "Number of readers, -1 for 75% of CPUs." );
67
67
// Number of runs.
68
68
torture_param (int , nruns , 30 , "Number of experiments to run." );
69
- // Reader delay in microseconds , 0 for no delay.
70
- torture_param (int , readdelay , 0 , "Read-side delay in microseconds ." );
69
+ // Reader delay in nanoseconds , 0 for no delay.
70
+ torture_param (int , readdelay , 0 , "Read-side delay in nanoseconds ." );
71
71
72
72
#ifdef MODULE
73
73
# define REFPERF_SHUTDOWN 0
@@ -111,12 +111,20 @@ struct ref_perf_ops {
111
111
void (* init )(void );
112
112
void (* cleanup )(void );
113
113
void (* readsection )(const int nloops );
114
- void (* delaysection )(const int nloops , const int ndelay );
114
+ void (* delaysection )(const int nloops , const int udl , const int ndl );
115
115
const char * name ;
116
116
};
117
117
118
118
static struct ref_perf_ops * cur_ops ;
119
119
120
+ static void un_delay (const int udl , const int ndl )
121
+ {
122
+ if (udl )
123
+ udelay (udl );
124
+ if (ndl )
125
+ ndelay (ndl );
126
+ }
127
+
120
128
static void ref_rcu_read_section (const int nloops )
121
129
{
122
130
int i ;
@@ -127,13 +135,13 @@ static void ref_rcu_read_section(const int nloops)
127
135
}
128
136
}
129
137
130
- static void ref_rcu_delay_section (const int nloops , const int ndelay )
138
+ static void ref_rcu_delay_section (const int nloops , const int udl , const int ndl )
131
139
{
132
140
int i ;
133
141
134
142
for (i = nloops ; i >= 0 ; i -- ) {
135
143
rcu_read_lock ();
136
- udelay ( ndelay );
144
+ un_delay ( udl , ndl );
137
145
rcu_read_unlock ();
138
146
}
139
147
}
@@ -165,14 +173,14 @@ static void srcu_ref_perf_read_section(const int nloops)
165
173
}
166
174
}
167
175
168
- static void srcu_ref_perf_delay_section (const int nloops , const int ndelay )
176
+ static void srcu_ref_perf_delay_section (const int nloops , const int udl , const int ndl )
169
177
{
170
178
int i ;
171
179
int idx ;
172
180
173
181
for (i = nloops ; i >= 0 ; i -- ) {
174
182
idx = srcu_read_lock (srcu_ctlp );
175
- udelay ( ndelay );
183
+ un_delay ( udl , ndl );
176
184
srcu_read_unlock (srcu_ctlp , idx );
177
185
}
178
186
}
@@ -197,13 +205,13 @@ static void ref_refcnt_section(const int nloops)
197
205
}
198
206
}
199
207
200
- static void ref_refcnt_delay_section (const int nloops , const int ndelay )
208
+ static void ref_refcnt_delay_section (const int nloops , const int udl , const int ndl )
201
209
{
202
210
int i ;
203
211
204
212
for (i = nloops ; i >= 0 ; i -- ) {
205
213
atomic_inc (& refcnt );
206
- udelay ( ndelay );
214
+ un_delay ( udl , ndl );
207
215
atomic_dec (& refcnt );
208
216
}
209
217
}
@@ -233,13 +241,13 @@ static void ref_rwlock_section(const int nloops)
233
241
}
234
242
}
235
243
236
- static void ref_rwlock_delay_section (const int nloops , const int ndelay )
244
+ static void ref_rwlock_delay_section (const int nloops , const int udl , const int ndl )
237
245
{
238
246
int i ;
239
247
240
248
for (i = nloops ; i >= 0 ; i -- ) {
241
249
read_lock (& test_rwlock );
242
- udelay ( ndelay );
250
+ un_delay ( udl , ndl );
243
251
read_unlock (& test_rwlock );
244
252
}
245
253
}
@@ -269,13 +277,13 @@ static void ref_rwsem_section(const int nloops)
269
277
}
270
278
}
271
279
272
- static void ref_rwsem_delay_section (const int nloops , const int ndelay )
280
+ static void ref_rwsem_delay_section (const int nloops , const int udl , const int ndl )
273
281
{
274
282
int i ;
275
283
276
284
for (i = nloops ; i >= 0 ; i -- ) {
277
285
down_read (& test_rwsem );
278
- udelay ( ndelay );
286
+ un_delay ( udl , ndl );
279
287
up_read (& test_rwsem );
280
288
}
281
289
}
@@ -292,7 +300,7 @@ static void rcu_perf_one_reader(void)
292
300
if (readdelay <= 0 )
293
301
cur_ops -> readsection (loops );
294
302
else
295
- cur_ops -> delaysection (loops , readdelay );
303
+ cur_ops -> delaysection (loops , readdelay / 1000 , readdelay % 1000 );
296
304
}
297
305
298
306
// Reader kthread. Repeatedly does empty RCU read-side
0 commit comments