[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87jzf9b12w.fsf@linux.intel.com>
Date: Wed, 18 Sep 2024 05:25:43 -0700
From: Andi Kleen <ak@...ux.intel.com>
To: Liao Chang <liaochang1@...wei.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
Liao Chang <liaochang1@...wei.com> writes:
> +
> +/*
> + * xol_recycle_insn_slot - recycle a slot from the garbage collection list.
> + */
> +static int xol_recycle_insn_slot(struct xol_area *area)
> +{
> + struct uprobe_task *utask;
> + int slot = UINSNS_PER_PAGE;
> +
> + rcu_read_lock();
> + list_for_each_entry_rcu(utask, &area->gc_list, gc) {
> + /*
> + * The utask associated slot is in-use or recycling when
> + * utask associated slot_ref is not one.
> + */
> + if (test_and_put_task_slot(utask)) {
> + slot = utask->insn_slot;
> + utask->insn_slot = UINSNS_PER_PAGE;
> + clear_bit(slot, area->bitmap);
> + atomic_dec(&area->slot_count);
> + get_task_slot(utask);
Doesn't this need some annotation to make ThreadSanitizer happy?
Would be good to have some commentary why doing so
many write operations with merely a rcu_read_lock as protection is safe.
It might be safer to put some write type operations under a real lock.
Also it is unclear how the RCU grace period for utasks is enforced.
-Andi
Powered by blists - more mailing lists