File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -121,9 +121,15 @@ static inline void percpu_up_read(struct percpu_rw_semaphore *sem)
121
121
preempt_enable ();
122
122
}
123
123
124
+ extern bool percpu_is_read_locked (struct percpu_rw_semaphore * );
124
125
extern void percpu_down_write (struct percpu_rw_semaphore * );
125
126
extern void percpu_up_write (struct percpu_rw_semaphore * );
126
127
128
+ static inline bool percpu_is_write_locked (struct percpu_rw_semaphore * sem )
129
+ {
130
+ return atomic_read (& sem -> block );
131
+ }
132
+
127
133
extern int __percpu_init_rwsem (struct percpu_rw_semaphore * ,
128
134
const char * , struct lock_class_key * );
129
135
Original file line number Diff line number Diff line change @@ -192,6 +192,12 @@ EXPORT_SYMBOL_GPL(__percpu_down_read);
192
192
__sum; \
193
193
})
194
194
195
+ bool percpu_is_read_locked (struct percpu_rw_semaphore * sem )
196
+ {
197
+ return per_cpu_sum (* sem -> read_count ) != 0 && !atomic_read (& sem -> block );
198
+ }
199
+ EXPORT_SYMBOL_GPL (percpu_is_read_locked );
200
+
195
201
/*
196
202
* Return true if the modular sum of the sem->read_count per-CPU variable is
197
203
* zero. If this sum is zero, then it is stable due to the fact that if any
You can’t perform that action at this time.
0 commit comments