mirror of
https://github.com/0xAX/linux-insides.git
synced 2024-12-30 10:28:12 +00:00
Fix typo in linux-sync-5
This commit is contained in:
parent
dd515d0b96
commit
eb70541d39
@ -358,7 +358,7 @@ static inline void __down_read(struct rw_semaphore *sem)
|
||||
|
||||
which increments value of the given `rw_semaphore->count` and calls the `call_rwsem_down_read_failed` if this value is negative. In other way we jump at the label `1:` and exit. After this `read` lock will be successfully acquired. Notice that we check a sign of the `count` value as it may be negative, because as you may remember most significant [word](https://en.wikipedia.org/wiki/Word_%28computer_architecture%29) of the `rw_semaphore->count` contains negated number of active writers.
|
||||
|
||||
Let's consider case when a process wants to acquire a lock for `read` operation, but it is already locked. In this case the `call_rwsem_down_read_failed` function from the [arch/x86/lib/rwsem.S](https://github.com/torvalds/linux/blob/16f73eb02d7e1765ccab3d2018e0bd98eb93d973/arch/x86/lib/rwsem.S) assembly file will be called. If you will look at the implementation of this function, you will notice that it does the same that `call_rwsem_down_read_failed` function does. Except it calls the `rwsem_down_read_failed` function instead of `rwsem_dow_write_failed`. Now let's consider implementation of the `rwsem_down_read_failed` function. It starts from the adding a process to the `wait queue` and updating of value of the `rw_semaphore->counter`:
|
||||
Let's consider case when a process wants to acquire a lock for `read` operation, but it is already locked. In this case the `call_rwsem_down_read_failed` function from the [arch/x86/lib/rwsem.S](https://github.com/torvalds/linux/blob/16f73eb02d7e1765ccab3d2018e0bd98eb93d973/arch/x86/lib/rwsem.S) assembly file will be called. If you will look at the implementation of this function, you will notice that it does the same that `call_rwsem_down_write_failed` function does. Except it calls the `rwsem_down_read_failed` function instead of `rwsem_down_write_failed`. Now let's consider implementation of the `rwsem_down_read_failed` function. It starts from the adding a process to the `wait queue` and updating of value of the `rw_semaphore->counter`:
|
||||
|
||||
```C
|
||||
long adjustment = -RWSEM_ACTIVE_READ_BIAS;
|
||||
|
@ -137,3 +137,4 @@ Thank you to all contributors:
|
||||
* [Junbo Jiang](https://github.com/junbo42)
|
||||
* [Dexter Plameras](https://github.com/dexterp)
|
||||
* [Jun Duan](https://github.com/waltforme)
|
||||
* [Guochao Xie](https://github.com/XieGuochao)
|
||||
|
Loading…
Reference in New Issue
Block a user