mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
Add per-cgroup local event counters to track RDMA resource limit exhaustion from the perspective of individual cgroups. The rdma.events.local file reports two per-resource counters: - max: number of times this cgroup's limit was the one that blocked an allocation in the subtree - alloc_fail: number of allocation attempts originating from this cgroup that failed due to an ancestor's limit This mirrors the design of pids.events.local, where events are attributed to the cgroup that imposed the limit, not necessarily the cgroup where the allocation was attempted. Also extend rdma.events with a hierarchical alloc_fail counter that tracks allocation failures propagating upward from the requesting cgroup, complementing the existing max counter, so that rdma.events and rdma.events.local share the same output format. Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Tejun Heo <tj@kernel.org>
55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2016 Parav Pandit <pandit.parav@gmail.com>
|
|
*/
|
|
|
|
#ifndef _CGROUP_RDMA_H
|
|
#define _CGROUP_RDMA_H
|
|
|
|
#include <linux/cgroup.h>
|
|
|
|
enum rdmacg_resource_type {
|
|
RDMACG_RESOURCE_HCA_HANDLE,
|
|
RDMACG_RESOURCE_HCA_OBJECT,
|
|
RDMACG_RESOURCE_MAX,
|
|
};
|
|
|
|
#ifdef CONFIG_CGROUP_RDMA
|
|
|
|
struct rdma_cgroup {
|
|
struct cgroup_subsys_state css;
|
|
|
|
/*
|
|
* head to keep track of all resource pools
|
|
* that belongs to this cgroup.
|
|
*/
|
|
struct list_head rpools;
|
|
|
|
/* Handles for rdma.events[.local] */
|
|
struct cgroup_file events_file;
|
|
struct cgroup_file events_local_file;
|
|
};
|
|
|
|
struct rdmacg_device {
|
|
struct list_head dev_node;
|
|
struct list_head rpools;
|
|
char *name;
|
|
};
|
|
|
|
/*
|
|
* APIs for RDMA/IB stack to publish when a device wants to
|
|
* participate in resource accounting
|
|
*/
|
|
void rdmacg_register_device(struct rdmacg_device *device);
|
|
void rdmacg_unregister_device(struct rdmacg_device *device);
|
|
|
|
/* APIs for RDMA/IB stack to charge/uncharge pool specific resources */
|
|
int rdmacg_try_charge(struct rdma_cgroup **rdmacg,
|
|
struct rdmacg_device *device,
|
|
enum rdmacg_resource_type index);
|
|
void rdmacg_uncharge(struct rdma_cgroup *cg,
|
|
struct rdmacg_device *device,
|
|
enum rdmacg_resource_type index);
|
|
#endif /* CONFIG_CGROUP_RDMA */
|
|
#endif /* _CGROUP_RDMA_H */
|