This is a note to let you know that I've just added the patch titled Revert "sched/core: Optimize SCHED_SMT" to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-sched-core-optimize-sched_smt.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9393c14486259dfbe11c5b9a22142162bae9ce54 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Date: Wed, 19 Jul 2017 09:58:49 +0200 Subject: Revert "sched/core: Optimize SCHED_SMT" From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> This reverts commit 1b568f0aabf280555125bc7cefc08321ff0ebaba. For the 4.9 kernel tree, this patch causes scheduler regressions. It is fixed in newer kernels with a large number of individual patches, the sum of which is too big for the stable kernel tree. Ingo recommended just reverting the single patch for this tree, as it's much simpler. Reported-by: Ben Guthro <ben@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Cc: Mike Galbraith <efault@xxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- kernel/sched/core.c | 19 ------------------- kernel/sched/fair.c | 8 +------- kernel/sched/sched.h | 23 ++++++----------------- 3 files changed, 7 insertions(+), 43 deletions(-) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7422,22 +7422,6 @@ int sched_cpu_dying(unsigned int cpu) } #endif -#ifdef CONFIG_SCHED_SMT -DEFINE_STATIC_KEY_FALSE(sched_smt_present); - -static void sched_init_smt(void) -{ - /* - * We've enumerated all CPUs and will assume that if any CPU - * has SMT siblings, CPU0 will too. - */ - if (cpumask_weight(cpu_smt_mask(0)) > 1) - static_branch_enable(&sched_smt_present); -} -#else -static inline void sched_init_smt(void) { } -#endif - void __init sched_init_smp(void) { cpumask_var_t non_isolated_cpus; @@ -7467,9 +7451,6 @@ void __init sched_init_smp(void) init_sched_rt_class(); init_sched_dl_class(); - - sched_init_smt(); - sched_smp_initialized = true; } --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5376,7 +5376,7 @@ static inline bool test_idle_cores(int c * Since SMT siblings share all cache levels, inspecting this limited remote * state should be fairly cheap. */ -void __update_idle_core(struct rq *rq) +void update_idle_core(struct rq *rq) { int core = cpu_of(rq); int cpu; @@ -5408,9 +5408,6 @@ static int select_idle_core(struct task_ struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask); int core, cpu, wrap; - if (!static_branch_likely(&sched_smt_present)) - return -1; - if (!test_idle_cores(target, false)) return -1; @@ -5444,9 +5441,6 @@ static int select_idle_smt(struct task_s { int cpu; - if (!static_branch_likely(&sched_smt_present)) - return -1; - for_each_cpu(cpu, cpu_smt_mask(target)) { if (!cpumask_test_cpu(cpu, tsk_cpus_allowed(p))) continue; --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -43,6 +43,12 @@ extern void cpu_load_update_active(struc static inline void cpu_load_update_active(struct rq *this_rq) { } #endif +#ifdef CONFIG_SCHED_SMT +extern void update_idle_core(struct rq *rq); +#else +static inline void update_idle_core(struct rq *rq) { } +#endif + /* * Helpers for converting nanosecond timing to jiffy resolution */ @@ -731,23 +737,6 @@ static inline int cpu_of(struct rq *rq) #endif } - -#ifdef CONFIG_SCHED_SMT - -extern struct static_key_false sched_smt_present; - -extern void __update_idle_core(struct rq *rq); - -static inline void update_idle_core(struct rq *rq) -{ - if (static_branch_unlikely(&sched_smt_present)) - __update_idle_core(rq); -} - -#else -static inline void update_idle_core(struct rq *rq) { } -#endif - DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); #define cpu_rq(cpu) (&per_cpu(runqueues, (cpu))) Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-4.9/binfmt_elf-use-elf_et_dyn_base-only-for-pie.patch queue-4.9/xen-netfront-rework-the-fix-for-rx-stall-during-oom-and-network-stress.patch queue-4.9/cfg80211-validate-frequencies-nested-in-nl80211_attr_scan_frequencies.patch queue-4.9/mnt-in-propgate_umount-handle-visiting-mounts-in-any-order.patch queue-4.9/vrf-fix-bug_on-triggered-by-rx-when-destroying-a-vrf.patch queue-4.9/net-mlx5-cancel-delayed-recovery-work-when-unloading-the-driver.patch queue-4.9/exec-limit-arg-stack-to-at-most-75-of-_stk_lim.patch queue-4.9/rocker-move-dereference-before-free.patch queue-4.9/cfg80211-check-if-pmkid-attribute-is-of-expected-size.patch queue-4.9/revert-sched-core-optimize-sched_smt.patch queue-4.9/crypto-atmel-only-treat-ebusy-as-transient-if-backlog.patch queue-4.9/vt-fix-unchecked-__put_user-in-tioclinux-ioctls.patch queue-4.9/parisc-use-compat_sys_keyctl.patch queue-4.9/net-handle-napi_gro_free_stolen_head-case-also-in-napi_frags_finish.patch queue-4.9/brcmfmac-fix-possible-buffer-overflow-in-brcmf_cfg80211_mgmt_tx.patch queue-4.9/bpf-prevent-leaking-pointer-via-xadd-on-unpriviledged.patch queue-4.9/net-dp83640-avoid-null-pointer-dereference.patch queue-4.9/crypto-caam-properly-set-iv-after-en-de-crypt.patch queue-4.9/crypto-talitos-extend-max-key-length-for-sha384-512-hmac-and-aead.patch queue-4.9/net-phy-micrel-configure-intterupts-after-autoneg-workaround.patch queue-4.9/arm64-dts-marvell-armada37xx-fix-timer-interrupt-specifiers.patch queue-4.9/cfg80211-define-nla_policy-for-nl80211_attr_local_mesh_power_mode.patch queue-4.9/nvmem-core-fix-leaks-on-registration-errors.patch queue-4.9/ipv6-avoid-unregistering-inet6_dev-for-loopback.patch queue-4.9/net-mlx5e-fix-tx-carrier-errors-report-in-get-stats-ndo.patch queue-4.9/mm-fix-overflow-check-in-expand_upwards.patch queue-4.9/ipv6-dad-don-t-remove-dynamic-addresses-if-link-is-down.patch queue-4.9/s390-reduce-elf_et_dyn_base.patch queue-4.9/mm-list_lru.c-fix-list_lru_count_node-to-be-race-free.patch queue-4.9/brcmfmac-fix-glom_skb-leak-in-brcmf_sdiod_recv_chain.patch queue-4.9/arm-move-elf_et_dyn_base-to-4mb.patch queue-4.9/tcp-reset-sk_rx_dst-in-tcp_disconnect.patch queue-4.9/fs-dcache.c-fix-spin-lockup-issue-on-nlru-lock.patch queue-4.9/sfc-don-t-read-beyond-unicast-address-list.patch queue-4.9/crypto-caam-fix-signals-handling.patch queue-4.9/cfg80211-check-if-nan-service-id-is-of-expected-size.patch queue-4.9/vxlan-fix-hlist-corruption.patch queue-4.9/rds-tcp-use-sock_create_lite-to-create-the-accept-socket.patch queue-4.9/parisc-dma-api-return-error-instead-of-bug_on-for-dma-ops-on-non-dma-devs.patch queue-4.9/crypto-sha1-ssse3-disable-avx2.patch queue-4.9/net-sched-fix-one-possible-panic-when-no-destroy-callback.patch queue-4.9/rcu-add-memory-barriers-for-nocb-leader-wakeup.patch queue-4.9/net-ipv6-compare-lwstate-in-detecting-duplicate-nexthops.patch queue-4.9/bridge-mdb-fix-leak-on-complete_info-ptr-on-fail-path.patch queue-4.9/arm64-move-elf_et_dyn_base-to-4gb-4mb.patch queue-4.9/net-prevent-sign-extension-in-dev_get_stats.patch queue-4.9/net_sched-fix-error-recovery-at-qdisc-creation.patch queue-4.9/net-core-fix-slab-out-of-bounds-in-netdev_stats_to_stats64.patch queue-4.9/selftests-capabilities-fix-the-test_execve-test.patch queue-4.9/mnt-in-umount-propagation-reparent-in-a-separate-pass.patch queue-4.9/liquidio-fix-bug-in-soft-reset-failure-detection.patch queue-4.9/irqchip-gic-v3-fix-out-of-bound-access-in-gic_set_affinity.patch queue-4.9/parisc-mm-ensure-irqs-are-off-in-switch_mm.patch queue-4.9/mnt-make-propagate_umount-less-slow-for-overlapping-mount-propagation-trees.patch queue-4.9/thp-mm-fix-crash-due-race-in-madv_free-handling.patch queue-4.9/powerpc-move-elf_et_dyn_base-to-4gb-4mb.patch queue-4.9/kernel-extable.c-mark-core_kernel_text-notrace.patch queue-4.9/checkpatch-silence-perl-5.26.0-unescaped-left-brace-warnings.patch queue-4.9/brcmfmac-fix-a-memory-leak-in-error-handling-path-in-brcmf_cfg80211_attach.patch queue-4.9/parisc-report-sigsegv-instead-of-sigbus-when-running-out-of-stack.patch queue-4.9/tools-lib-lockdep-reduce-max_lock_depth-to-avoid-overflowing-lock_chain-depth.patch