OpenCloudOS-Kernel/include/linux/rqm.h

72 lines
2.1 KiB
C

#ifndef _LINUX_QUALITY_H
#define _LINUX_QUALITY_H
enum rqm_type {
RQM_IO,
RQM_MEM,
RQM_CPU,
RQM_PRIO_CPU,
RQM_NET,
NR_RQM_TYPES,
};
/* Track the cgroup's information that tasks stalled on the cpu */
struct rqm_group_cpu {
/* Record the stall time that caused by other cgroup */
unsigned long long cgroup_stalled_time;
/* Record the stall time that caused by other priority cgroup */
unsigned long long cgroup_prio_stalled_time;
};
/* Track each order pages allocation times */
struct rqm_group_mem {
/* cgroup memory allocation times, account in __alloc_pages_nodemask */
unsigned long long cgroup_mem_ticks;
/* cgroup memory allocation stall in ns */
unsigned long long cgroup_mem_stall;
};
struct rqm_group {
unsigned long score[NR_RQM_TYPES];
unsigned long long last_exec_runtime;
unsigned long long last_prio_stalled_time;
unsigned long long last_stalled_time;
struct rqm_group_mem last_mem_stat;
};
#ifdef CONFIG_RQM
extern struct rqm_group rqm_system;
extern int rqm_show(struct seq_file *m, struct rqm_group *rqm, enum rqm_type type);
void rqm_group_init(struct rqm_group *group);
void rqm_init(void);
extern void sched_rqm_enqueued(struct rq *rq, struct task_struct *t);
extern void sched_rqm_dequeued(struct rq *rq, struct task_struct *t);
extern void sched_rqm_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next);
extern void account_rqm_cgroup_cpu_stat(struct cgroup *cgrp, u64 tmp);
extern void account_rqm_cgroup_mem_stat(struct mem_cgroup *memcg, int order, int latency);
#else /* CONFIG_RQM */
static inline void rqm_group_init(struct rqm_group *group)
{
}
static inline void rqm_init(void)
{
}
static inline void account_rqm_cgroup_cpu_stat(struct cgroup *cgrp, u64 tmp) {}
static inline void sched_rqm_enqueued(struct rq *rq, struct task_struct *t) {}
static inline void sched_rqm_dequeued(struct rq *rq, struct task_struct *t) {}
static inline void sched_rqm_switch(struct rq *rq, struct task_struct *prev,
struct task_struct *next)
{
}
static inline void mem_rqm_account(struct mem_cgroup *memcg, int order, int latency) {}
#endif /* CONFIG_RQM */
#endif /*_LINUX_QUALITY_H*/