__cpu_map_lookup_elem);
 }
 
+static u64 cpu_map_mem_usage(const struct bpf_map *map)
+{
+       u64 usage = sizeof(struct bpf_cpu_map);
+
+       /* Currently the dynamically allocated elements are not counted */
+       usage += (u64)map->max_entries * sizeof(struct bpf_cpu_map_entry *);
+       return usage;
+}
+
 BTF_ID_LIST_SINGLE(cpu_map_btf_ids, struct, bpf_cpu_map)
 const struct bpf_map_ops cpu_map_ops = {
        .map_meta_equal         = bpf_map_meta_equal,
        .map_lookup_elem        = cpu_map_lookup_elem,
        .map_get_next_key       = cpu_map_get_next_key,
        .map_check_btf          = map_check_no_btf,
+       .map_mem_usage          = cpu_map_mem_usage,
        .map_btf_id             = &cpu_map_btf_ids[0],
        .map_redirect           = cpu_map_redirect,
 };