BPF List
 help / color / mirror / Atom feed
From: "Liao, Chang" <liaochang1@huawei.com>
To: Andi Kleen <ak@linux.intel.com>
Cc: <mhiramat@kernel.org>, <oleg@redhat.com>, <andrii@kernel.org>,
	<peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>,
	<namhyung@kernel.org>, <mark.rutland@arm.com>,
	<alexander.shishkin@linux.intel.com>, <jolsa@kernel.org>,
	<irogers@google.com>, <adrian.hunter@intel.com>,
	<kan.liang@linux.intel.com>, <linux-kernel@vger.kernel.org>,
	<linux-trace-kernel@vger.kernel.org>,
	<linux-perf-users@vger.kernel.org>, <bpf@vger.kernel.org>
Subject: Re: [PATCH] uprobes: Improve the usage of xol slots for better scalability
Date: Fri, 27 Sep 2024 18:01:39 +0800	[thread overview]
Message-ID: <e9a3066a-ff07-6d57-9b97-17ecebe95e59@huawei.com> (raw)
In-Reply-To: <ZvH_LiUeOtAwommF@tassilo>



在 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

  reply	other threads:[~2024-09-27 10:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18  1:27 [PATCH] uprobes: Improve the usage of xol slots for better scalability Liao Chang
2024-09-18 12:25 ` Andi Kleen
2024-09-19 12:20   ` Liao, Chang
2024-09-19 13:34     ` Andi Kleen
2024-09-23 10:29       ` Liao, Chang
2024-09-23 23:52         ` Andi Kleen
2024-09-27 10:01           ` Liao, Chang [this message]
2024-09-18 14:41 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9a3066a-ff07-6d57-9b97-17ecebe95e59@huawei.com \
    --to=liaochang1@huawei.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox