??????д??????????÷???
????rwlock_t lock; // ????rwlock
????rwlock_init(&lock); // ?????rwlock
????// ????????
????read_lock(&lock);
????... // ??????
????read_unlock(&lock);
????// д??????
????write_lock_irqsave(&lock?? flags);
????... // ??????
????write_unlock_irqrestore(&lock?? flags);
???????????seqlock??:
?????????????д????????????????????????????д????????????????????????????????/д??д??????
????д??е?????????????£?
????//????????
????void write_seqlock(seqlock_t *s1);
????int write_tryseqlock(seqlock_t *s1);
????write_seqlock_irqsave(lock?? flags)
????write_seqlock_irq(lock)
????write_seqlock_bh(lock)
????//????????
????void write_sequnlock(seqlock_t *s1);
????write_sequnlock_irqrestore(lock?? flags)
????write_sequnlock_irq(lock)
????write_sequnlock_bh(lock)
????????е?????????????£?
????//?????
????unsinged read_seqbegin(const seqlock_t *s1);
????read_seqbegin_irqsave(lock?? flags)
????//?????????е??????????????s1?????????????????????ú????????????????????????д??????????У?????е????????????Ρ?
????int reead_seqretry(const seqlock_t *s1?? unsigned iv);
????read_seqretry_irqrestore(lock?? iv?? flags)
????RCU(Read-Copy Update ??-????-????)???????д?????????汾??????????????е????????????????????????????????е??????д??е????????????????????????RCU?????????д??????????д????????????????е?????????????????д??е?????μ????????????RCU???д??е??????????????????????????????????????????????????????????????????????????????е?????д??е????????????
???????????????
??????????????
?????????(semaphore)???????????????е?????????????????????????????????????????????????????????????????????????
???????????е??????????????????????????????linux???????????????????????“?????-?????????-?????”????????“??????????”????????????????ж???????????У?
???????????????????????????????????????????????????????
????????????????
????/????????
????struct semaphore sem;
????//??????????
????void sema_init(struct semaphore *sem?? int val)
????//???????????????
????#define init_MUTEX(sem) sema_init(sem?? 1)
????#define init_MUTEX_LOCKED(sem) sema_init(sem?? 0)
????//????????????????????????????
????DECLARE_MUTEX(name) //?????name????????1
????DECLARE_MUTEX_LOCKED(name) //???????????0
????//???ò???
????DECLARE_MUTEX(mount_sem);
????down(&mount_sem); //????????
????...
????critical section //?????
????...
????up(&mount_sem); //????????
????????????????????????????е?????????????completion????????????????????е??????е????
?????????????????????
???????? ??????????????????????????????????????л????Tsw?????????????????????????????????Tcs????Tcs???С?????????????????????????????
??????????????????????????????????????????????????????????????e????????????????????????????????????
????????????????????????????????????????????????????ж?????ж??????????????????????????????????????????????????????????????????????????down_trylock()??????У??????????????????????????