* [PATCH] CodeSamples/defer: Make hazard partition consistent with hazptr_thread_exit
@ 2023-04-20 7:40 Alan Huang
2023-04-24 16:02 ` Paul E. McKenney
0 siblings, 1 reply; 5+ messages in thread
From: Alan Huang @ 2023-04-20 7:40 UTC (permalink / raw)
To: paulmck; +Cc: perfbook, Alan Huang
Signed-off-by: Alan Huang <mmpgouride@gmail.com>
---
CodeSamples/defer/hazptrtorture.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CodeSamples/defer/hazptrtorture.h b/CodeSamples/defer/hazptrtorture.h
index 29761e3d..acdd532b 100644
--- a/CodeSamples/defer/hazptrtorture.h
+++ b/CodeSamples/defer/hazptrtorture.h
@@ -99,7 +99,7 @@ void *hazptr_read_perf_test(void *arg)
{
int i;
int me = (long)arg;
- int base = me * K;
+ int base = smp_thread_id() * K;
long long n_reads_local = 0;
hazptr_head_t hh;
hazptr_head_t *hhp = &hh;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] CodeSamples/defer: Make hazard partition consistent with hazptr_thread_exit
2023-04-20 7:40 [PATCH] CodeSamples/defer: Make hazard partition consistent with hazptr_thread_exit Alan Huang
@ 2023-04-24 16:02 ` Paul E. McKenney
2023-04-25 3:39 ` Akira Yokosawa
2023-04-25 13:32 ` Alan Huang
0 siblings, 2 replies; 5+ messages in thread
From: Paul E. McKenney @ 2023-04-24 16:02 UTC (permalink / raw)
To: Alan Huang; +Cc: perfbook
On Thu, Apr 20, 2023 at 07:40:30AM +0000, Alan Huang wrote:
> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
> ---
> CodeSamples/defer/hazptrtorture.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/CodeSamples/defer/hazptrtorture.h b/CodeSamples/defer/hazptrtorture.h
> index 29761e3d..acdd532b 100644
> --- a/CodeSamples/defer/hazptrtorture.h
> +++ b/CodeSamples/defer/hazptrtorture.h
> @@ -99,7 +99,7 @@ void *hazptr_read_perf_test(void *arg)
> {
> int i;
> int me = (long)arg;
> - int base = me * K;
> + int base = smp_thread_id() * K;
Suppose specify a number of threads greater than the number of CPUs.
For example, on my 12-hardware-thread laptop:
./route_hazptr --stresstest --nreaders 24
In that case, don't we want "me" rather than "smp_thread_id()"?
Thanx, Paul
> long long n_reads_local = 0;
> hazptr_head_t hh;
> hazptr_head_t *hhp = &hh;
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CodeSamples/defer: Make hazard partition consistent with hazptr_thread_exit
2023-04-24 16:02 ` Paul E. McKenney
@ 2023-04-25 3:39 ` Akira Yokosawa
2023-04-25 13:32 ` Alan Huang
1 sibling, 0 replies; 5+ messages in thread
From: Akira Yokosawa @ 2023-04-25 3:39 UTC (permalink / raw)
To: paulmck, Alan Huang; +Cc: perfbook, Akira Yokosawa
On Mon, 24 Apr 2023 09:02:57 -0700, Paul E. McKenney wrote:
> On Thu, Apr 20, 2023 at 07:40:30AM +0000, Alan Huang wrote:
>> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
>> ---
>> CodeSamples/defer/hazptrtorture.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/CodeSamples/defer/hazptrtorture.h b/CodeSamples/defer/hazptrtorture.h
>> index 29761e3d..acdd532b 100644
>> --- a/CodeSamples/defer/hazptrtorture.h
>> +++ b/CodeSamples/defer/hazptrtorture.h
>> @@ -99,7 +99,7 @@ void *hazptr_read_perf_test(void *arg)
>> {
>> int i;
>> int me = (long)arg;
>> - int base = me * K;
>> + int base = smp_thread_id() * K;
>
> Suppose specify a number of threads greater than the number of CPUs.
> For example, on my 12-hardware-thread laptop:
>
> ./route_hazptr --stresstest --nreaders 24
>
> In that case, don't we want "me" rather than "smp_thread_id()"?
But route_hazptr.c includes routetorture.h
Furthermore, route_hazptr.c doesn't call hp_record() which just
got fixed.
So it looks to me that Alan's fixes won't have any effect on
route_hazptr ...
But I might be missing something here.
Thanks, Akira
>
> Thanx, Paul
>
>> long long n_reads_local = 0;
>> hazptr_head_t hh;
>> hazptr_head_t *hhp = &hh;
>> --
>> 2.34.1
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CodeSamples/defer: Make hazard partition consistent with hazptr_thread_exit
2023-04-24 16:02 ` Paul E. McKenney
2023-04-25 3:39 ` Akira Yokosawa
@ 2023-04-25 13:32 ` Alan Huang
2023-04-25 18:36 ` Paul E. McKenney
1 sibling, 1 reply; 5+ messages in thread
From: Alan Huang @ 2023-04-25 13:32 UTC (permalink / raw)
To: paulmck, akiyks; +Cc: perfbook
> 2023年4月25日 00:02,Paul E. McKenney <paulmck@kernel.org> 写道:
>
> On Thu, Apr 20, 2023 at 07:40:30AM +0000, Alan Huang wrote:
>> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
>> ---
>> CodeSamples/defer/hazptrtorture.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/CodeSamples/defer/hazptrtorture.h b/CodeSamples/defer/hazptrtorture.h
>> index 29761e3d..acdd532b 100644
>> --- a/CodeSamples/defer/hazptrtorture.h
>> +++ b/CodeSamples/defer/hazptrtorture.h
>> @@ -99,7 +99,7 @@ void *hazptr_read_perf_test(void *arg)
>> {
>> int i;
>> int me = (long)arg;
>> - int base = me * K;
>> + int base = smp_thread_id() * K;
>
> Suppose specify a number of threads greater than the number of CPUs.
> For example, on my 12-hardware-thread laptop:
>
> ./route_hazptr --stresstest --nreaders 24
>
> In that case, don't we want "me" rather than "smp_thread_id()"?
As Akira said, route_hazptr.c includes routetorture.h and route_hazptr.c doesn't call hp_record().
The fix won't have any effect on route_hazptr.
Thanks,
Alan
>
> Thanx, Paul
>
>> long long n_reads_local = 0;
>> hazptr_head_t hh;
>> hazptr_head_t *hhp = &hh;
>> --
>> 2.34.1
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CodeSamples/defer: Make hazard partition consistent with hazptr_thread_exit
2023-04-25 13:32 ` Alan Huang
@ 2023-04-25 18:36 ` Paul E. McKenney
0 siblings, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2023-04-25 18:36 UTC (permalink / raw)
To: Alan Huang; +Cc: akiyks, perfbook
On Tue, Apr 25, 2023 at 09:32:46PM +0800, Alan Huang wrote:
> > 2023年4月25日 00:02,Paul E. McKenney <paulmck@kernel.org> 写道:
> >
> > On Thu, Apr 20, 2023 at 07:40:30AM +0000, Alan Huang wrote:
> >> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
> >> ---
> >> CodeSamples/defer/hazptrtorture.h | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/CodeSamples/defer/hazptrtorture.h b/CodeSamples/defer/hazptrtorture.h
> >> index 29761e3d..acdd532b 100644
> >> --- a/CodeSamples/defer/hazptrtorture.h
> >> +++ b/CodeSamples/defer/hazptrtorture.h
> >> @@ -99,7 +99,7 @@ void *hazptr_read_perf_test(void *arg)
> >> {
> >> int i;
> >> int me = (long)arg;
> >> - int base = me * K;
> >> + int base = smp_thread_id() * K;
> >
> > Suppose specify a number of threads greater than the number of CPUs.
> > For example, on my 12-hardware-thread laptop:
> >
> > ./route_hazptr --stresstest --nreaders 24
> >
> > In that case, don't we want "me" rather than "smp_thread_id()"?
Never mind, I was confused. Maybe I should have waited another
day after return before looking at this. :-/
$ ./hazptr 24 perf
sched_setaffinity: Invalid argument
Aborted (core dumped)
But that is a pre-existing problem. If I keep the number within the
number of hardware threads, it works fine:
$ ./hazptr 12 perf
n_reads: 576608000 n_updates: 314343 nreaders: 12 nupdaters: 1 duration: 1
ns/read: 20.8114 ns/update: 3181.24
I am not all that worried about this. Running multiple threads per
hardware thread in a performance test isn't all that useful, after all.
And there is a robust diagnostic. Perhaps not as helpful as one might
like, but definitely robust. ;-)
> As Akira said, route_hazptr.c includes routetorture.h and route_hazptr.c doesn't call hp_record().
> The fix won't have any effect on route_hazptr.
Agreed, again, my post-vacation confusion, apologies!!!
Thanx, Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-04-25 18:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-20 7:40 [PATCH] CodeSamples/defer: Make hazard partition consistent with hazptr_thread_exit Alan Huang
2023-04-24 16:02 ` Paul E. McKenney
2023-04-25 3:39 ` Akira Yokosawa
2023-04-25 13:32 ` Alan Huang
2023-04-25 18:36 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox