Skip to contentSkip to conversation

docs: lockdep-design: correct the notation for writer

PATCH In review Xiongwei Song 5 participants 9 messages May 21, 2021 – May 24, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: lockdep-design: correct the notation for writer

From: Xiongwei Song <[email protected]>

The block condition matrix is using 'E' as the writer noation here, so it would be better to use 'E' as the reminder rather than 'W'.

---
 Documentation/locking/lockdep-design.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/locking/lockdep-design.rst +1 -1
index 9f3cfca..c3b923a 100644
@@ -462,7 +462,7 @@ Block condition matrix, Y means the row blocks the column, and N means otherwise
 	| R | Y | Y | N |
 	+---+---+---+---+
 
-	(W: writers, r: non-recursive readers, R: recursive readers)
+	(E: writers, r: non-recursive readers, R: recursive readers)
 
 
 acquired recursively. Unlike non-recursive read locks, recursive read locks
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Xiongwei Song

From: Xiongwei Song <[email protected]>

The block condition matrix is using 'E' as the writer noation here, so it would be better to use 'E' as the reminder rather than 'W'.

Good catch!

Quoted 1 line

Regards,
Boqun

Quoted 20 lines
---
 Documentation/locking/lockdep-design.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/locking/lockdep-design.rst +1 -1
index 9f3cfca..c3b923a 100644
@@ -462,7 +462,7 @@ Block condition matrix, Y means the row blocks the column, and N means otherwise
 	| R | Y | Y | N |
 	+---+---+---+---+
 
-	(W: writers, r: non-recursive readers, R: recursive readers)
+	(E: writers, r: non-recursive readers, R: recursive readers)
 
 
 acquired recursively. Unlike non-recursive read locks, recursive read locks
Signature · 1 line
2.7.4
#3 lore raw
In reply to Xiongwei Song
Quoted 15 lines · Xiongwei Song

From: Xiongwei Song <[email protected]>

The block condition matrix is using 'E' as the writer noation here, so it would be better to use 'E' as the reminder rather than 'W'.

---
  Documentation/locking/lockdep-design.rst | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/locking/lockdep-design.rst +0 -0
index 9f3cfca..c3b923a 100644

Documentation/locking/lockdep-design.rst Block condition matrix, Y means the row blocks the column, and N means otherwise · line 468

Quoted 8 lines
Documentation/locking/lockdep-design.rst +1 -1
@@ -462,7 +462,7 @@ Block condition matrix, Y means the row blocks the column, and N means otherwise
  	| R | Y | Y | N |
  	+---+---+---+---+
 
-	(W: writers, r: non-recursive readers, R: recursive readers)
+	(E: writers, r: non-recursive readers, R: recursive readers)
 
 
  acquired recursively. Unlike non-recursive read locks, recursive read locks

I would say it should be the other way around. Both W and E refer to the same type of lockers. W emphasizes writer aspect of it and E for exclusive. I think we should change the block condition matrix to use W instead of E.

Cheers,
Longman

#4 lore raw
Quoted 24 lines · Waiman Long
Quoted 22 lines · Xiongwei Song

From: Xiongwei Song <[email protected]>

The block condition matrix is using 'E' as the writer noation here, so it would be better to use 'E' as the reminder rather than 'W'.

---
  Documentation/locking/lockdep-design.rst | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/locking/lockdep-design.rst +1 -1
index 9f3cfca..c3b923a 100644
@@ -462,7 +462,7 @@ Block condition matrix, Y means the row blocks the column, and N means otherwise
      | R | Y | Y | N |
      +---+---+---+---+
 
-     (W: writers, r: non-recursive readers, R: recursive readers)
+     (E: writers, r: non-recursive readers, R: recursive readers)
 
 
Quoted 6 lines

Documentation/locking/lockdep-design.rst Block condition matrix, Y means the row blocks the column, and N means otherwise · line 468

Quoted 1 line
Documentation/locking/lockdep-design.rst +0 -0
  acquired recursively. Unlike non-recursive read locks, recursive read locks

I would say it should be the other way around. Both W and E refer to the same type of lockers. W emphasizes writer aspect of it and E for exclusive. I think we should change the block condition matrix to use W instead of E.

The doc uses 'E' to describe dependency egdes too. Should we change them to 'W'? Personally, both 'W' and 'E' are fine.

Thanks,
Xiongwei

Quoted 4 lines

Cheers,
Longman

#5 lore raw
Quoted 32 lines · Xiongwei Song
Quoted 24 lines · Waiman Long
Quoted 22 lines · Xiongwei Song

From: Xiongwei Song <[email protected]>

The block condition matrix is using 'E' as the writer noation here, so it would be better to use 'E' as the reminder rather than 'W'.

---
  Documentation/locking/lockdep-design.rst | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/locking/lockdep-design.rst +1 -1
index 9f3cfca..c3b923a 100644
@@ -462,7 +462,7 @@ Block condition matrix, Y means the row blocks the column, and N means otherwise
      | R | Y | Y | N |
      +---+---+---+---+
 
-     (W: writers, r: non-recursive readers, R: recursive readers)
+     (E: writers, r: non-recursive readers, R: recursive readers)
 
 
Quoted 6 lines

Documentation/locking/lockdep-design.rst Block condition matrix, Y means the row blocks the column, and N means otherwise · line 468

Quoted 1 line
Documentation/locking/lockdep-design.rst +0 -0
  acquired recursively. Unlike non-recursive read locks, recursive read locks

I would say it should be the other way around. Both W and E refer to the same type of lockers. W emphasizes writer aspect of it and E for exclusive. I think we should change the block condition matrix to use W instead of E.

Quoted 3 lines

The doc uses 'E' to describe dependency egdes too. Should we change them to 'W'? Personally, both 'W' and 'E' are fine.

I also think Waiman's suggestion is solid, there are two ways to classify locks:

1. W (Writers), R (Recursive Readers), r (Non-recursive Readers)

2. E (Exclusive locks), S (Shared locks), R (Recursive Readers),
N (Non-recursive locks)

And the relations between them are as follow:

	E = W
	R = R
	N = W \/ r
	S = R \/ r 

, where "\/" is the set union.

The story is that I used the way #1 at first, and later on realized way #2 is better for BFS implementation, also for reasoning, so here came this leftover..

If you are interested, go ahead sending a patch fixing this, otherwise, I will fix this.

Regards,
Boqun

Quoted 6 lines

Thanks,
Xiongwei

Quoted 4 lines

Cheers,
Longman

#6 lore raw
Quoted 53 lines · Boqun Feng
Quoted 32 lines · Xiongwei Song
Quoted 24 lines · Waiman Long
Quoted 22 lines · Xiongwei Song

From: Xiongwei Song <[email protected]>

The block condition matrix is using 'E' as the writer noation here, so it would be better to use 'E' as the reminder rather than 'W'.

---
  Documentation/locking/lockdep-design.rst | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/locking/lockdep-design.rst +1 -1
index 9f3cfca..c3b923a 100644
@@ -462,7 +462,7 @@ Block condition matrix, Y means the row blocks the column, and N means otherwise
      | R | Y | Y | N |
      +---+---+---+---+
 
-     (W: writers, r: non-recursive readers, R: recursive readers)
+     (E: writers, r: non-recursive readers, R: recursive readers)
 
 
Quoted 6 lines

Documentation/locking/lockdep-design.rst Block condition matrix, Y means the row blocks the column, and N means otherwise · line 468

Quoted 1 line
Documentation/locking/lockdep-design.rst +0 -0
  acquired recursively. Unlike non-recursive read locks, recursive read locks

I would say it should be the other way around. Both W and E refer to the same type of lockers. W emphasizes writer aspect of it and E for exclusive. I think we should change the block condition matrix to use W instead of E.

Quoted 3 lines

The doc uses 'E' to describe dependency egdes too. Should we change them to 'W'? Personally, both 'W' and 'E' are fine.

I also think Waiman's suggestion is solid, there are two ways to classify locks:

1. W (Writers), R (Recursive Readers), r (Non-recursive Readers)

2. E (Exclusive locks), S (Shared locks), R (Recursive Readers),
N (Non-recursive locks)

And the relations between them are as follow:

E = W
R = R
N = W \/ r
S = R \/ r

Quoted 5 lines

, where "\/" is the set union.

The story is that I used the way #1 at first, and later on realized way #2 is better for BFS implementation, also for reasoning, so here came this leftover..

Thanks for the explanation.

Quoted 3 lines

If you are interested, go ahead sending a patch fixing this, otherwise, I will fix this.

Ok. Let me fix.

Thanks,
Xiongwei

Quoted 10 lines

Regards,
Boqun

Quoted 6 lines

Thanks,
Xiongwei

Quoted 4 lines

Cheers,
Longman

#7 lore raw
In reply to Boqun Feng
Quoted 48 lines · Boqun Feng
Quoted 24 lines · Xiongwei Song
Quoted 23 lines · Waiman Long
Quoted 22 lines · Xiongwei Song

From: Xiongwei Song <[email protected]>

The block condition matrix is using 'E' as the writer noation here, so it would be better to use 'E' as the reminder rather than 'W'.

---
   Documentation/locking/lockdep-design.rst | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/locking/lockdep-design.rst +1 -1
index 9f3cfca..c3b923a 100644
@@ -462,7 +462,7 @@ Block condition matrix, Y means the row blocks the column, and N means otherwise
       | R | Y | Y | N |
       +---+---+---+---+
 
-     (W: writers, r: non-recursive readers, R: recursive readers)
+     (E: writers, r: non-recursive readers, R: recursive readers)
 
 
Quoted 8 lines
Quoted 5 lines

Documentation/locking/lockdep-design.rst Block condition matrix, Y means the row blocks the column, and N means otherwise · line 468

Quoted 1 line
Documentation/locking/lockdep-design.rst +0 -0
   acquired recursively. Unlike non-recursive read locks, recursive read locks

I would say it should be the other way around. Both W and E refer to the same type of lockers. W emphasizes writer aspect of it and E for exclusive. I think we should change the block condition matrix to use W instead of E.

The doc uses 'E' to describe dependency egdes too. Should we change them to 'W'? Personally, both 'W' and 'E' are fine.

I also think Waiman's suggestion is solid, there are two ways to classify locks:

1. W (Writers), R (Recursive Readers), r (Non-recursive Readers)

2. E (Exclusive locks), S (Shared locks), R (Recursive Readers),
N (Non-recursive locks)

And the relations between them are as follow:

	E = W
	R = R
	N = W \/ r
	S = R \/ r
Quoted 6 lines

, where "\/" is the set union.

The story is that I used the way #1 at first, and later on realized way #2 is better for BFS implementation, also for reasoning, so here came this leftover..

My suggestion was based on the fact that it is harder to associate E with writer. So from a readability perspective, it is better to change the block condition matrix to use 'W' to make it more readable.

Cheers,
Longman

#8 lore raw
Quoted 51 lines · Waiman Long
Quoted 50 lines · Boqun Feng
Quoted 24 lines · Xiongwei Song
Quoted 23 lines · Waiman Long
Quoted 22 lines · Xiongwei Song

From: Xiongwei Song <[email protected]>

The block condition matrix is using 'E' as the writer noation here, so it would be better to use 'E' as the reminder rather than 'W'.

---
   Documentation/locking/lockdep-design.rst | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/locking/lockdep-design.rst +1 -1
index 9f3cfca..c3b923a 100644
@@ -462,7 +462,7 @@ Block condition matrix, Y means the row blocks the column, and N means otherwise
       | R | Y | Y | N |
       +---+---+---+---+
 
-     (W: writers, r: non-recursive readers, R: recursive readers)
+     (E: writers, r: non-recursive readers, R: recursive readers)
 
 
Quoted 8 lines
Quoted 5 lines

Documentation/locking/lockdep-design.rst Block condition matrix, Y means the row blocks the column, and N means otherwise · line 468

Quoted 1 line
Documentation/locking/lockdep-design.rst +0 -0
   acquired recursively. Unlike non-recursive read locks, recursive read locks

I would say it should be the other way around. Both W and E refer to the same type of lockers. W emphasizes writer aspect of it and E for exclusive. I think we should change the block condition matrix to use W instead of E.

The doc uses 'E' to describe dependency egdes too. Should we change them to 'W'? Personally, both 'W' and 'E' are fine.

I also think Waiman's suggestion is solid, there are two ways to classify locks:

1. W (Writers), R (Recursive Readers), r (Non-recursive Readers)

2. E (Exclusive locks), S (Shared locks), R (Recursive Readers),
N (Non-recursive locks)

And the relations between them are as follow:

	E = W
	R = R
	N = W \/ r
	S = R \/ r

, where "\/" is the set union.

Quoted 8 lines
Quoted 4 lines

The story is that I used the way #1 at first, and later on realized way #2 is better for BFS implementation, also for reasoning, so here came this leftover..

My suggestion was based on the fact that it is harder to associate E with writer. So from a readability perspective, it is better to change the block condition matrix to use 'W' to make it more readable.

Yes, I agree. It's probably due to the curse of knowledge, I cannot see the difficultly of associating E with writer ;-) So thanks for pointing out!

Actually there are two block condition matrices in my mind:

The block condition matrix describes the natural of block conditions of write/read locks, this one provides better readability for lock users, it can be used to answer questions like: which lock blocks another lock.

	|   | W | r | R |
	+---+---+---+---+
	| W | Y | Y | Y |
	+---|---+---+---+
	| r | Y | Y | N |
	+---+---+---+---+
	| R | Y | Y | N |

(answer whether row blocks column)

Based on this, we have a more abstract block condition matrix in lockdep, it's used to reason about deadlock possibility and implement the deadlock detection, it might not be the good one for normal lock users to read.

	|   |  N  |  R  |
	+---+-----+-----+
	| E | Yes | Yes |
	+---+-----+-----+
	| S | Yes | No  |

(answer whether row blocks column)

FWIW, if we are going to put the second block condition matrix in the doc, we'd better place it somewhere in the section "Dependency types and strong dependency paths".

Just clarify a little while we are at it.

Regards,
Boqun

Quoted 3 lines

Cheers,
Longman