Index: sys/conf/options =================================================================== --- sys/conf/options +++ sys/conf/options @@ -645,6 +645,7 @@ EARLY_AP_STARTUP opt_global.h SMP opt_global.h NUMA opt_global.h +CPUGRP_SCORE opt_global.h # Size of the kernel message buffer MSGBUF_SIZE opt_msgbuf.h Index: sys/kern/subr_smp.c =================================================================== --- sys/kern/subr_smp.c +++ sys/kern/subr_smp.c @@ -49,6 +49,7 @@ #include #include "opt_sched.h" +#include "opt_global.h" #ifdef SMP MALLOC_DEFINE(M_TOPO, "toponodes", "SMP topology data"); @@ -740,7 +741,9 @@ top->cg_children = 0; top->cg_level = CG_SHARE_NONE; top->cg_flags = 0; - +#if defined(CPUGRP_SCORE) + memset(top->cg_score, CG_SCORE_DEFAULT, sizeof(top->cg_score)); +#endif return (top); } @@ -762,6 +765,9 @@ child->cg_count = count; child->cg_flags = flags; child->cg_mask = mask; +#if defined(CPUGRP_SCORE) + memset(child->cg_score, CG_SCORE_DEFAULT, sizeof(child->cg_score)); +#endif parent->cg_children++; for (; parent != NULL; parent = parent->cg_parent) { if (CPU_OVERLAP(&parent->cg_mask, &child->cg_mask)) Index: sys/sys/smp.h =================================================================== --- sys/sys/smp.h +++ sys/sys/smp.h @@ -19,6 +19,8 @@ #include #include +#include "opt_global.h" + /* * Types of nodes in the topological tree. */ @@ -74,6 +76,13 @@ * The topology may be omitted by systems where all CPUs are equal. */ +#if defined(CPUGRP_SCORE) +#define CG_SCORE_CLASS_MAX 8 +#define CG_SCORE_CAPABILITY_MAX 2 + +#define CG_SCORE_DEFAULT 0x80 +#endif + struct cpu_group { struct cpu_group *cg_parent; /* Our parent group. */ struct cpu_group *cg_child; /* Optional children groups. */ @@ -84,6 +93,10 @@ int16_t cg_children; /* Number of children groups. */ int8_t cg_level; /* Shared cache level. */ int8_t cg_flags; /* Traversal modifiers. */ +#if defined(CPUGRP_SCORE) + uint8_t cg_score[CG_SCORE_CLASS_MAX][CG_SCORE_CAPABILITY_MAX]; + /* Performance/Efficiency Score from Intel HFI/ITD */ +#endif }; typedef struct cpu_group *cpu_group_t; Index: sys/x86/x86/mp_x86.c =================================================================== --- sys/x86/x86/mp_x86.c +++ sys/x86/x86/mp_x86.c @@ -37,6 +37,7 @@ #include "opt_sched.h" #include "opt_smp.h" #include "opt_stack.h" +#include "opt_global.h" #include #include @@ -852,6 +853,13 @@ else cg_root->cg_flags = 0; +#if defined(CPUGRP_SCORE) + /* + * Set default performance/efficiency score. + */ + memset(cg_root->cg_score, CG_SCORE_DEFAULT, sizeof(cg_root->cg_score)); +#endif + /* * Check how many core nodes we have under the given root node. * If we have multiple logical processors, but not multiple