On changing the llc_override, rebuild the sched domains.

For the rebuild to happen, indicate it to the scheduler that
complete rebuild of the sched domains need to happen
via arch_update_cpu_topology(). 

With this, llc_override functionality is complete.

For example, on CPU10, 
domain0/name:SMT
domain1/name:MC
domain2/name:PKG

echo 0 > /sys/kernel/debug/powerpc/llc_override
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE 
SD_SHARE_CPUCAPACITY SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE 
SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE 
SD_PREFER_SIBLING

echo mc > /sys/kernel/debug/powerpc/llc_override
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE 
SD_SHARE_CPUCAPACITY SD_SHARE_LLC SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE SD_SHARE_LLC 
SD_PREFER_SIBLING
SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE 
SD_PREFER_SIBLING

Signed-off-by: Shrikanth Hegde <[email protected]>
---
 arch/powerpc/kernel/smp.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 4b6512d25f73..6a4ee7d3b8e5 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -37,6 +37,7 @@
 #include <linux/clockchips.h>
 #include <linux/kexec.h>
 #include <linux/debugfs.h>
+#include <linux/cpuset.h>
 
 #include <asm/ptrace.h>
 #include <linux/atomic.h>
@@ -1863,6 +1864,16 @@ void __noreturn arch_cpu_idle_dead(void)
 
 #endif
 
+int arch_update_cpu_topology(void)
+{
+       if (READ_ONCE(llc_override_changed)) {
+               WRITE_ONCE(llc_override_changed, 0);
+               return 1;
+       }
+
+       return 0;
+}
+
 static ssize_t llc_override_get(struct file *file, char __user *ubuf,
                                size_t count, loff_t *ppos)
 {
@@ -1909,10 +1920,10 @@ static ssize_t llc_override_set(struct file *file, 
const char __user *ubuf,
        if (override != READ_ONCE(llc_override)) {
                WRITE_ONCE(llc_override, override);
                WRITE_ONCE(llc_override_changed, 1);
-               pr_info("sched LLC override set to %s\n",
+               pr_info("sched LLC override set to %s. Rebuilding sched 
domains\n",
                        llc_override_str[override]);
 
-               /* Will be calling rebuild sched domain in later patches */
+               rebuild_sched_domains();
        }
 
        mutex_unlock(&llc_override_mutex);
-- 
2.52.0


Reply via email to