diff options
| author | Kunwu Chan <kunwu.chan@linux.dev> | 2026-01-19 23:11:30 +0800 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@kernel.org> | 2026-02-03 16:27:27 -0800 |
| commit | 252c345e0a494842ef1f4755f7ac32e43e332267 (patch) | |
| tree | cfa440eff5473b50ea79326f7c9a13134645502b | |
| parent | 850ca3d485963419d099802545027edc73132e84 (diff) | |
| download | perfbook-master.tar.gz | |
The text incorrectly stated that 'line 8 finds' the pointer condition,
but in Listing 9.4, line 7 contains the if statement that performs
the check, while line 8 contains the return statement.
This commit:
1. Adds a label (htr:check) to the if statement on line 7
2. Updates the text to reference the if check (htr:check) instead of
the return statement (htr:race1) for the condition check
3. Clarifies that the if check finds the condition and the return
statement returns the value
This makes the description more accurate and reflects the actual
code execution flow.
Signed-off-by: Kunwu Chan <kunwu.chan@linux.dev>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
| -rw-r--r-- | CodeSamples/defer/hazptr.h | 2 | ||||
| -rw-r--r-- | defer/hazptr.tex | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/CodeSamples/defer/hazptr.h b/CodeSamples/defer/hazptr.h index bdeb5c15..2d5a098f 100644 --- a/CodeSamples/defer/hazptr.h +++ b/CodeSamples/defer/hazptr.h @@ -74,7 +74,7 @@ static inline void *_h_t_r_impl(void **p, //\lnlbl{htr:b} void *tmp; tmp = READ_ONCE(*p); //\lnlbl{htr:ro1} - if (!tmp || tmp == (void *)HAZPTR_POISON) + if (!tmp || tmp == (void *)HAZPTR_POISON) //\lnlbl{htr:check} return tmp; //\lnlbl{htr:race1} WRITE_ONCE(hp->p, tmp); //\lnlbl{htr:store} smp_mb(); //\lnlbl{htr:mb} diff --git a/defer/hazptr.tex b/defer/hazptr.tex index 22fca499..50ff0996 100644 --- a/defer/hazptr.tex +++ b/defer/hazptr.tex @@ -69,8 +69,8 @@ Finally, if it fails due to racing with an update, it returns a special }\QuickQuizEnd \Clnref{htr:ro1} reads the pointer to the object to be protected. -If \clnref{htr:race1} finds that this pointer was either \co{NULL} or -the special \co{HAZPTR_POISON} deleted-object token, it returns +If \clnref{htr:check} finds that this pointer was either \co{NULL} or +the special \co{HAZPTR_POISON} deleted-object token, then \clnref{htr:race1} returns the pointer's value to inform the caller of the failure. Otherwise, \clnref{htr:store} stores the pointer into the specified hazard pointer, and \clnref{htr:mb} forces full ordering of that |
