All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Amery Hung <ameryhung@gmail.com>
Cc: netdev@vger.kernel.org, alexei.starovoitov@gmail.com,
	andrii@kernel.org, daniel@iogearbox.net, memxor@gmail.com,
	kpsingh@kernel.org, martin.lau@kernel.org,
	yonghong.song@linux.dev, song@kernel.org, haoluo@google.com,
	kernel-team@meta.com, bpf@vger.kernel.org
Subject: Re: [RFC PATCH bpf-next v1 06/11] bpf: Remove task local storage percpu counter
Date: Fri, 1 Aug 2025 18:15:33 -0700	[thread overview]
Message-ID: <f58385a3-866f-424b-b6ad-ee04edf9aeb9@linux.dev> (raw)
In-Reply-To: <20250729182550.185356-7-ameryhung@gmail.com>

On 7/29/25 11:25 AM, Amery Hung wrote:
>   kernel/bpf/bpf_task_storage.c | 149 ++++------------------------------

nice.

> +BPF_CALL_5(bpf_task_storage_get, struct bpf_map *, map, struct task_struct *,
> +	   task, void *, value, u64, flags, gfp_t, gfp_flags)
>   {
>   	struct bpf_local_storage_data *sdata;
>   
> -	sdata = task_storage_lookup(task, map, nobusy);
> +	WARN_ON_ONCE(!bpf_rcu_lock_held());
> +	if (flags & ~BPF_LOCAL_STORAGE_GET_F_CREATE || !task)
> +		return (unsigned long)NULL;
> +
> +	sdata = task_storage_lookup(task, map, true);
>   	if (sdata)
> -		return sdata->data;
> +		return (unsigned long)sdata->data;
>   
>   	/* only allocate new storage, when the task is refcounted */
>   	if (refcount_read(&task->usage) &&
> -	    (flags & BPF_LOCAL_STORAGE_GET_F_CREATE) && nobusy) {
> +	    (flags & BPF_LOCAL_STORAGE_GET_F_CREATE)) {
>   		sdata = bpf_local_storage_update(
>   			task, (struct bpf_local_storage_map *)map, value,
>   			BPF_NOEXIST, false, gfp_flags);
> -		return IS_ERR(sdata) ? NULL : sdata->data;
> +		WARN_ON(IS_ERR(sdata));

A nit for now. ok during development/RFC. This will eventually need to be 
removed. e.g. it should not WARN_ON ENOMEM.

  reply	other threads:[~2025-08-02  1:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29 18:25 [RFC PATCH bpf-next v1 00/11] Remove task and cgroup local Amery Hung
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 01/11] bpf: Convert bpf_selem_unlink_map to failable Amery Hung
2025-08-01  1:05   ` Martin KaFai Lau
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 02/11] bpf: Convert bpf_selem_link_map " Amery Hung
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 03/11] bpf: Open code bpf_selem_unlink_storage in bpf_selem_unlink Amery Hung
2025-08-02  0:58   ` Martin KaFai Lau
2025-08-05 16:25     ` Amery Hung
2025-08-05 23:10       ` Martin KaFai Lau
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 04/11] bpf: Convert bpf_selem_unlink to failable Amery Hung
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 05/11] bpf: Change local_storage->lock and b->lock to rqspinlock Amery Hung
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 06/11] bpf: Remove task local storage percpu counter Amery Hung
2025-08-02  1:15   ` Martin KaFai Lau [this message]
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 07/11] bpf: Remove cgroup " Amery Hung
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 08/11] bpf: Remove unused percpu counter from bpf_local_storage_map_free Amery Hung
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 09/11] selftests/bpf: Update task_local_storage/recursion test Amery Hung
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 10/11] selftests/bpf: Remove test_task_storage_map_stress_lookup Amery Hung
2025-07-29 18:25 ` [RFC PATCH bpf-next v1 11/11] selftests/bpf: Choose another percpu variable in bpf for btf_dump test Amery Hung
2025-07-29 18:28 ` [RFC PATCH bpf-next v1 00/11] Remove task and cgroup local Amery Hung
2025-08-02  1:46 ` Martin KaFai Lau

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=f58385a3-866f-424b-b6ad-ee04edf9aeb9@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=kernel-team@meta.com \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.