BPF List
 help / color / mirror / Atom feed
From: Chuyi Zhou <zhouchuyi@bytedance.com>
To: Quentin Monnet <quentin@isovalent.com>,
	hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	wuyun.abel@bytedance.com, robin.lu@bytedance.com
Subject: Re: [RFC PATCH 3/5] libbpf, bpftool: Support BPF_PROG_TYPE_OOM_POLICY
Date: Fri, 28 Jul 2023 11:01:23 +0800	[thread overview]
Message-ID: <16326cd3-376b-4d08-409e-e64f43f848af@bytedance.com> (raw)
In-Reply-To: <b22038a1-d06f-8bca-57f1-cc8da84a8fca@isovalent.com>

Hi,

在 2023/7/27 20:26, Quentin Monnet 写道:
> 2023-07-27 15:36 UTC+0800 ~ Chuyi Zhou <zhouchuyi@bytedance.com>
>> Support BPF_PROG_TYPE_OOM_POLICY program in libbpf and bpftool, so that
>> we can identify and use BPF_PROG_TYPE_OOM_POLICY in our application.
>>
>> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
>> ---
>>   tools/bpf/bpftool/common.c     |  1 +
>>   tools/include/uapi/linux/bpf.h | 14 ++++++++++++++
>>   tools/lib/bpf/libbpf.c         |  3 +++
>>   tools/lib/bpf/libbpf_probes.c  |  2 ++
>>   4 files changed, 20 insertions(+)
>>
>> diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
>> index cc6e6aae2447..c5c311299c4a 100644
>> --- a/tools/bpf/bpftool/common.c
>> +++ b/tools/bpf/bpftool/common.c
>> @@ -1089,6 +1089,7 @@ const char *bpf_attach_type_input_str(enum bpf_attach_type t)
>>   	case BPF_TRACE_FENTRY:			return "fentry";
>>   	case BPF_TRACE_FEXIT:			return "fexit";
>>   	case BPF_MODIFY_RETURN:			return "mod_ret";
>> +	case BPF_OOM_POLICY:			return "oom_policy";
> 
> This case is not necessary. This block is here to keep legacy attach
> type strings supported by bpftool. In your case, the name is the same as
> the one provided by libbpf, so...
> 
>>   	case BPF_SK_REUSEPORT_SELECT:		return "sk_skb_reuseport_select";
>>   	case BPF_SK_REUSEPORT_SELECT_OR_MIGRATE:	return "sk_skb_reuseport_select_or_migrate";
>>   	default:	return libbpf_bpf_attach_type_str(t);
> 
> ... we just want to pick it up from libbpf directly, here.
> 
I see..

Thanks.

--
Chuyi Zhou
> [...]
> 
>> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
>> index 214f828ece6b..10496bb9b3bc 100644
>> --- a/tools/lib/bpf/libbpf.c
>> +++ b/tools/lib/bpf/libbpf.c
>> @@ -118,6 +118,7 @@ static const char * const attach_type_name[] = {
>>   	[BPF_TRACE_KPROBE_MULTI]	= "trace_kprobe_multi",
>>   	[BPF_STRUCT_OPS]		= "struct_ops",
>>   	[BPF_NETFILTER]			= "netfilter",
>> +	[BPF_OOM_POLICY]		= "oom_policy",
>>   };
> 

  reply	other threads:[~2023-07-28  3:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  7:36 [RFC PATCH 0/5] mm: Select victim memcg using BPF_OOM_POLICY Chuyi Zhou
2023-07-27  7:36 ` [RFC PATCH 1/5] bpf: Introduce BPF_PROG_TYPE_OOM_POLICY Chuyi Zhou
2023-07-27  7:36 ` [RFC PATCH 2/5] mm: Select victim memcg using bpf prog Chuyi Zhou
2023-07-27  7:36 ` [RFC PATCH 3/5] libbpf, bpftool: Support BPF_PROG_TYPE_OOM_POLICY Chuyi Zhou
2023-07-27 12:26   ` Quentin Monnet
2023-07-28  3:01     ` Chuyi Zhou [this message]
2023-07-27  7:36 ` [RFC PATCH 4/5] bpf: Add a new bpf helper to get cgroup ino Chuyi Zhou
2023-07-27  7:36 ` [RFC PATCH 5/5] bpf: Sample BPF program to set oom policy Chuyi Zhou
2023-07-27  8:15 ` [RFC PATCH 0/5] mm: Select victim memcg using BPF_OOM_POLICY Michal Hocko
2023-07-27 12:12   ` Chuyi Zhou
2023-07-27 17:23     ` Michal Hocko
2023-07-31  6:00       ` Chuyi Zhou
2023-07-31 13:23         ` Michal Hocko
2023-07-31 16:26           ` Chuyi Zhou
2023-08-01  8:18             ` Michal Hocko
2023-08-02  3:04               ` Chuyi Zhou
2023-07-28  4:30   ` Roman Gushchin
2023-07-28  8:06     ` Michal Hocko
2023-07-28 18:42       ` Roman Gushchin
2023-07-31 13:12         ` Michal Hocko
2023-08-01  6:53     ` Abel Wu
2023-07-27 11:43 ` Alan Maguire
2023-07-27 15:57   ` Alexei Starovoitov
2023-07-27 17:17     ` Michal Hocko
2023-07-28  2:34   ` [External] " Chuyi Zhou

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=16326cd3-376b-4d08-409e-e64f43f848af@bytedance.com \
    --to=zhouchuyi@bytedance.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=quentin@isovalent.com \
    --cc=robin.lu@bytedance.com \
    --cc=roman.gushchin@linux.dev \
    --cc=wuyun.abel@bytedance.com \
    /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