From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC35FC433FE for ; Tue, 18 Oct 2022 18:09:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230178AbiJRSJD (ORCPT ); Tue, 18 Oct 2022 14:09:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbiJRSJA (ORCPT ); Tue, 18 Oct 2022 14:09:00 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4924A5D719 for ; Tue, 18 Oct 2022 11:08:58 -0700 (PDT) Message-ID: <67048049-dee4-3ff0-035c-65af34555725@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1666116536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BcBt8n259OXgHUHwaBe4UV4ilVQ3sCLcRXjhJyDn3V4=; b=gE4wkuBlSgzkBYOueKlHfaouT7tDPDqOUGI9cxWLij4YahcZiQkHoE1gXx8Bkv7eYErxGO BzNWlGyx6B+fdvUOetDxknunyFzrKJL1tAED4p0obL8iCTdTGaUh0fkrizVkPx0edCDaB4 N1HO/N4NuTz3YFq1O204ckAyJkvooS8= Date: Tue, 18 Oct 2022 11:08:46 -0700 MIME-Version: 1.0 Subject: Re: [PATCH bpf-next 2/5] bpf: Implement cgroup storage available to non-cgroup-attached bpf progs Content-Language: en-US To: Alexei Starovoitov Cc: Yonghong Song , Yosry Ahmed , Yonghong Song , bpf , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Kernel Team , KP Singh , Martin KaFai Lau , Tejun Heo , Stanislav Fomichev References: <06e37b29-b384-7432-d966-ad89901de55d@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 10/18/22 10:17 AM, Alexei Starovoitov wrote: > On Tue, Oct 18, 2022 at 10:08 AM wrote: >>>> >>>> '#define BPF_MAP_TYPE_CGROUP_STORAGE BPF_MAP_TYPE_CGRP_LOCAL_STORAGE /* >>>> depreciated by BPF_MAP_TYPE_CGRP_STORAGE */' in the uapi. >>>> >>>> The new cgroup storage uses a shorter name "cgrp", like >>>> BPF_MAP_TYPE_CGRP_STORAGE and bpf_cgrp_storage_get()? >> >>> This might work and the naming convention will be similar to >>> existing sk/inode/task storage. >> >> +1, CGRP_STORAGE sounds good! > > +1 from me as well. > > Something like this ? > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h > index 17f61338f8f8..13dcb2418847 100644 > --- a/include/uapi/linux/bpf.h > +++ b/include/uapi/linux/bpf.h > @@ -922,7 +922,8 @@ enum bpf_map_type { > BPF_MAP_TYPE_CPUMAP, > BPF_MAP_TYPE_XSKMAP, > BPF_MAP_TYPE_SOCKHASH, > - BPF_MAP_TYPE_CGROUP_STORAGE, > + BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED, > + BPF_MAP_TYPE_CGROUP_STORAGE = BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED, +1 > BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, > BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, > BPF_MAP_TYPE_QUEUE, > @@ -935,6 +936,7 @@ enum bpf_map_type { > BPF_MAP_TYPE_TASK_STORAGE, > BPF_MAP_TYPE_BLOOM_FILTER, > BPF_MAP_TYPE_USER_RINGBUF, > + BPF_MAP_TYPE_CGRP_STORAGE, > }; > > What are we going to do with BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE ? > Probably should come up with a replacement as well? Yeah, need to come up with a percpu answer for it. The percpu usage has never come up on the sk storage and also the later task/inode storage. or the user is just getting by with an array like map's value. May be the bpf prog can call bpf_mem_alloc() to alloc the percpu memory in the future and then store it as the kptr in the BPF_MAP_TYPE_CGRP_STORAGE?