This patch fixes hazard torture. Signed-off-by: Alan Huang <mmpgouride@xxxxxxxxx> --- CodeSamples/defer/hazptr.h | 2 +- CodeSamples/defer/hazptrtorture.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CodeSamples/defer/hazptr.h b/CodeSamples/defer/hazptr.h index 759ab53d..e061303d 100644 --- a/CodeSamples/defer/hazptr.h +++ b/CodeSamples/defer/hazptr.h @@ -87,7 +87,7 @@ static inline void *hp_record(void **p, //\lnlbl{hr:b} void *tmp; do { - tmp = hp_try_record(*p, hp); + tmp = hp_try_record(p, hp); } while (tmp == (void *)HAZPTR_POISON); return tmp; } //\lnlbl{hr:e} diff --git a/CodeSamples/defer/hazptrtorture.h b/CodeSamples/defer/hazptrtorture.h index 53efa259..29761e3d 100644 --- a/CodeSamples/defer/hazptrtorture.h +++ b/CodeSamples/defer/hazptrtorture.h @@ -241,8 +241,7 @@ DEFINE_PER_THREAD(long long [HAZPTR_STRESS_PIPE_LEN + 1], hazptr_stress_count); void *hazptr_read_stress_test(void *arg) { - int me = (int)(long)arg; - int base = me * K; + int base = smp_thread_id() * K; struct hazptr_stress *p; int pc; -- 2.34.1