[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e9a3066a-ff07-6d57-9b97-17ecebe95e59@huawei.com>
Date: Fri, 27 Sep 2024 18:01:39 +0800
From: "Liao, Chang" <liaochang1@...wei.com>
To: Andi Kleen <ak@...ux.intel.com>
CC: <mhiramat@...nel.org>, <oleg@...hat.com>, <andrii@...nel.org>,
<peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<namhyung@...nel.org>, <mark.rutland@....com>,
<alexander.shishkin@...ux.intel.com>, <jolsa@...nel.org>,
<irogers@...gle.com>, <adrian.hunter@...el.com>, <kan.liang@...ux.intel.com>,
<linux-kernel@...r.kernel.org>, <linux-trace-kernel@...r.kernel.org>,
<linux-perf-users@...r.kernel.org>, <bpf@...r.kernel.org>
Subject: Re: [PATCH] uprobes: Improve the usage of xol slots for better
scalability
在 2024/9/24 7:52, Andi Kleen 写道:
>> Thanks for the suggestions, I will experiment with a read-write lock, meanwhile,
>> adding the documentation and testing for the lockless scheme.
>
> Read-write locks are usually not worth it for short critical sections,
> in fact they can be slower due to cache line effects.
OK, I will start from a simple spinlock.
>
>> Sorry, I may not probably get the point clear here, and it would be very
>> nice if more details are provided for the concern. Do you mean it's necessary
>> to make the if-body excution exclusive among the CPUs? If that's the case,
>> I guess the test_and_put_task_slot() is the equvialent to the race condition
>> check. test_and_put_task_slot() uses a compare and exchange operation on the
>> slot_ref of utask instance. Regardless of the work type being performed by
>> other CPU, it will always bail out unless the slot_ref has a value of one,
>> indicating the utask is free to access from local CPU.
>
> What I meant is that the typical pattern for handling races in destruction
> is to detect someone else is racing and then let it do the destruction
> work or reacquire the resource (so just bail out).
Agreed.
>
> But that's not what you're doing here, in fact you're adding a
> completely new code path that has different semantics? I haven't checked
> all the code, but it looks dubious.
Andi, I've just sent v2. Looking forward to your feedback. Thanks.
https://lore.kernel.org/all/20240927094549.3382916-1-liaochang1@huawei.com/
>
> -Andi
>
--
BR
Liao, Chang
Powered by blists - more mailing lists