Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4be6c078 authored by Vikas Shivappa's avatar Vikas Shivappa Committed by Thomas Gleixner
Browse files

x86/intel_rdt: Introduce rdt_enable_key for scheduling



Introduce the usage of rdt_enable_key in sched_in code as a preparation
to add RDT monitoring support for sched_in.

Signed-off-by: default avatarVikas Shivappa <vikas.shivappa@linux.intel.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: ravi.v.shankar@intel.com
Cc: tony.luck@intel.com
Cc: fenghua.yu@intel.com
Cc: peterz@infradead.org
Cc: eranian@google.com
Cc: vikas.shivappa@intel.com
Cc: ak@linux.intel.com
Cc: davidcc@google.com
Cc: reinette.chatre@intel.com
Link: http://lkml.kernel.org/r/1501017287-28083-24-git-send-email-vikas.shivappa@linux.intel.com
parent 4af4a88e
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -27,10 +27,12 @@ struct intel_pqr_state {

DECLARE_PER_CPU(struct intel_pqr_state, pqr_state);
DECLARE_PER_CPU_READ_MOSTLY(struct intel_pqr_state, rdt_cpu_default);

DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key);

/*
 * intel_rdt_sched_in() - Writes the task's CLOSid to IA32_PQR_MSR
 * __intel_rdt_sched_in() - Writes the task's CLOSid to IA32_PQR_MSR
 *
 * Following considerations are made so that this has minimal impact
 * on scheduler hot path:
@@ -42,7 +44,7 @@ DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key);
 *
 * Must be called with preemption disabled.
 */
static inline void intel_rdt_sched_in(void)
static inline void __intel_rdt_sched_in(void)
{
	if (static_branch_likely(&rdt_alloc_enable_key)) {
		struct intel_pqr_state *state = this_cpu_ptr(&pqr_state);
@@ -63,6 +65,12 @@ static inline void intel_rdt_sched_in(void)
	}
}

static inline void intel_rdt_sched_in(void)
{
	if (static_branch_likely(&rdt_enable_key))
		__intel_rdt_sched_in();
}

#else

static inline void intel_rdt_sched_in(void) {}