Re: [PATCH v4 1/3] perf: add PERF_RECORD_NAMESPACES to include namespaces related info

From: Peter Zijlstra
Date: Thu Dec 15 2016 - 13:47:12 EST


On Fri, Dec 16, 2016 at 12:07:06AM +0530, Hari Bathini wrote:
> +struct perf_ns_link_info {
> + __u64 dev;
> + __u64 ino;
> +};
> +
> +enum {
> + NET_NS_INDEX = 0,
> + UTS_NS_INDEX = 1,
> + IPC_NS_INDEX = 2,
> + PID_NS_INDEX = 3,
> + USER_NS_INDEX = 4,
> + MNT_NS_INDEX = 5,
> + CGROUP_NS_INDEX = 6,
> +
> + NAMESPACES_MAX, /* maximum available namespaces */
> +};
> +
> enum perf_event_type {
>
> /*
> @@ -862,6 +880,17 @@ enum perf_event_type {
> */
> PERF_RECORD_SWITCH_CPU_WIDE = 15,
>
> + /*
> + * struct {
> + * struct perf_event_header header;
> + * u32 pid;
> + * u32 tid;
> + * struct namespace_link_info link_info[NAMESPACES_MAX];
> + * struct sample_id sample_id;
> + * };
> + */
> + PERF_RECORD_NAMESPACES = 16,
> +
> PERF_RECORD_MAX, /* non-ABI */
> };

What happens if a future kernel adds another namespace?