@@ -876,6 +876,7 @@ enum cpu_idle_type {
#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
#define SD_NUMA 0x4000 /* cross-node balancing */
+#define SD_WORKLOAD_CONSOLIDATION 0x8000 /* consolidate CPU workload */
extern int __weak arch_sd_sibiling_asym_packing(void);
@@ -960,6 +961,11 @@ struct sched_domain {
struct rcu_head rcu; /* used during destruction */
};
+ unsigned int total_groups; /* total group number */
+ unsigned int group_number; /* this CPU's group sequence */
+ unsigned int consolidating_coeff; /* consolidating coefficient */
+ struct sched_group *first_group; /* ordered by CPU number */
+
unsigned int span_weight;
/*
* Span of all CPUs in this domain.
@@ -4840,7 +4840,7 @@ set_table_entry(struct ctl_table *entry,
static struct ctl_table *
sd_alloc_ctl_domain_table(struct sched_domain *sd)
{
- struct ctl_table *table = sd_alloc_ctl_entry(14);
+ struct ctl_table *table = sd_alloc_ctl_entry(15);
if (table == NULL)
return NULL;
@@ -4873,7 +4873,9 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)
sizeof(long), 0644, proc_doulongvec_minmax, false);
set_table_entry(&table[12], "name", sd->name,
CORENAME_MAX_SIZE, 0444, proc_dostring, false);
- /* &table[13] is terminator */
+ set_table_entry(&table[13], "consolidating_coeff", &sd->consolidating_coeff,
+ sizeof(int), 0644, proc_dointvec, false);
+ /* &table[14] is terminator */
return table;
}
Workload Consolidation is completely CPU topology and policy driven. To do so, we define SD_WORKLOAD_CONSOLIDATION, and add some fields in sched_domain struct: 1) total_groups is the group number in total in this domain 2) group_number is this CPU's group sequence number 3) consolidating_coeff is the coefficient for consolidating CPUs, and is changeable via sysctl tool to make consolidation more aggressive or less 4) first_group is the pointer to this domain's first group ordered by CPU number Signed-off-by: Yuyang Du <yuyang.du@intel.com> --- include/linux/sched.h | 6 ++++++ kernel/sched/core.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-)