[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210225192859.pfvkox7dgz236b3w@kafai-mbp.dhcp.thefacebook.com>
Date: Thu, 25 Feb 2021 11:28:59 -0800
From: Martin KaFai Lau <kafai@...com>
To: Song Liu <songliubraving@...com>
CC: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <ast@...nel.org>,
<daniel@...earbox.net>, <kernel-team@...com>,
<peterz@...radead.org>, kernel test robot <lkp@...el.com>,
KP Singh <kpsingh@...nel.org>
Subject: Re: [PATCH v5 bpf-next 1/6] bpf: enable task local storage for
tracing programs
On Tue, Feb 23, 2021 at 02:28:40PM -0800, Song Liu wrote:
> To access per-task data, BPF programs usually creates a hash table with
> pid as the key. This is not ideal because:
> 1. The user need to estimate the proper size of the hash table, which may
> be inaccurate;
> 2. Big hash tables are slow;
> 3. To clean up the data properly during task terminations, the user need
> to write extra logic.
>
> Task local storage overcomes these issues and offers a better option for
> these per-task data. Task local storage is only available to BPF_LSM. Now
> enable it for tracing programs.
>
> Unlike LSM programs, tracing programs can be called in IRQ contexts.
> Helpers that access task local storage are updated to use
> raw_spin_lock_irqsave() instead of raw_spin_lock_bh().
>
> Tracing programs can attach to functions on the task free path, e.g.
> exit_creds(). To avoid allocating task local storage after
> bpf_task_storage_free(). bpf_task_storage_get() is updated to not allocate
> new storage when the task is not refcounted (task->usage == 0).
Acked-by: Martin KaFai Lau <kafai@...com>
Powered by blists - more mailing lists