From 67c76d6bb340ed7c123afa2e88e76ab6d51ad73b Mon Sep 17 00:00:00 2001 From: kondors1995 Date: Fri, 11 Sep 2020 09:34:28 +0000 Subject: [PATCH] treewide: revert kernel boosting changes Squashed commit of the following: commit 8a39f97027a0155282a5f108ddf420d41d763a47 Author: kondors1995 Date: Wed Sep 9 07:39:14 2020 +0000 Revert "devfreq_boost: Introduce devfreq boost driver" This reverts commit 574fbb390d0778a3d432d44466ae981804024573. commit 3ff01b6c2c45a08bb0e0354318f13d31f7e8aea8 Author: kondors1995 Date: Wed Sep 9 07:39:08 2020 +0000 Revert "devfreq_boost: Mark boost kthreads as performance critical" This reverts commit 99cfb3cd59ea0d94a44d4a0ad23d08ec098cdac6. commit 8b040082b8fef7eb1ba9dedf37ff64a10fbd5907 Author: kondors1995 Date: Wed Sep 9 07:38:15 2020 +0000 Revert "mm: Boost when memory pressure becomes high" This reverts commit bf459bce2cdcb05b2f18bdc24321f81ef309916c. commit 46bc11a1e8b00eb3ac0e71a28adcb5555b47777b Author: kondors1995 Date: Wed Sep 9 07:37:05 2020 +0000 Revert "drm/atomic: boost DDR bus when committing a new frame" This reverts commit cd504c975d4db6161ffa3f6bac605f3e8f659793. commit 9ac11686c1a70967ad3861ef1ff5c7b917f9a6ad Author: kondors1995 Date: Wed Sep 9 07:36:59 2020 +0000 Revert "devfreq_boost: Update and expand to handle CPUBW/LLCCBW boosting" This reverts commit 77817b0443d28cfa30c0a3ed73fa9ce9619d265f. commit 19930f3b514d57cb6e1e343f4322ede8c7b25c7a Author: kondors1995 Date: Wed Sep 9 07:35:48 2020 +0000 Revert "devfreq_boost: perform max devfreq boost for 250ms on touch events" This reverts commit 7daee3c1b6c294d27a26e1550be344dbee20672e. commit 81d4c4e91dc341f15da738c9a3c752daec6c22a2 Author: kondors1995 Date: Wed Sep 9 07:24:41 2020 +0000 Revert "ARM64: configs: raphael: Enable and Configure DEVFREQ_BOOST" This reverts commit 560aedd87986238fa45103cd2dec85be1961f384. commit b5ef5130e8fb813436a7ac1b5c69d99c8a0b100d Author: kondors1995 Date: Wed Sep 9 07:00:08 2020 +0000 Revert "cpu_input_boost: Introduce driver for event-based CPU boosting" This reverts commit b8ba38485cf8c8ff9a967f84b667b33ef32f0471. commit 727aa5a4eff5d70c234779637ced05d05e4d612b Author: kondors1995 Date: Wed Sep 9 07:00:01 2020 +0000 Revert "cpu_input_boost: Mark boost kthread as performance critical" This reverts commit 7f2e816b50985b27b8dbb2a832234b8a6f0cfd2a. commit 80df9a40821c1165d66792f6aa7651cb6dc3aa90 Author: kondors1995 Date: Wed Sep 9 06:59:11 2020 +0000 Revert "cpufreq: cpu_input_boost: Remove all input boost code and adjust" This reverts commit 6899944bb3a9c721fda52a5b3b96e531f49709e7. commit 9526ef9d1b73dcddeb6b36b365f991a4054b2eb6 Author: kondors1995 Date: Wed Sep 9 06:58:15 2020 +0000 Revert "kernel: Boost to the max for when zygote forks" This reverts commit ab25cbf8fb092b53b12d07e9b3cb9f8c59d3409a. commit 29847b0eb3e35321a5fc28f79b55906500fffc1a Author: kondors1995 Date: Wed Sep 9 06:58:08 2020 +0000 Revert "kernel: Boost whenever a zygote-forked process becomes a top app" This reverts commit 1237497eba2f83fa6e9d2c65214ad3d4e55c81df. --- arch/arm64/configs/raphael_defconfig | 5 - drivers/cpufreq/Kconfig | 38 --- drivers/cpufreq/Makefile | 3 - drivers/cpufreq/cpu_input_boost.c | 239 ------------------- drivers/devfreq/Kconfig | 40 ---- drivers/devfreq/Makefile | 3 - drivers/devfreq/devfreq.c | 17 +- drivers/devfreq/devfreq_boost.c | 337 --------------------------- drivers/devfreq/devfreq_devbw.c | 7 - drivers/gpu/drm/drm_atomic.c | 6 - fs/exec.c | 17 -- include/linux/binfmts.h | 1 - include/linux/cpu_input_boost.h | 16 -- include/linux/devfreq.h | 7 - include/linux/devfreq_boost.h | 35 --- kernel/cgroup/cgroup-v1.c | 7 - kernel/fork.c | 5 - mm/page_alloc.c | 5 - 18 files changed, 4 insertions(+), 784 deletions(-) delete mode 100644 drivers/cpufreq/cpu_input_boost.c delete mode 100644 drivers/devfreq/devfreq_boost.c delete mode 100644 include/linux/cpu_input_boost.h delete mode 100644 include/linux/devfreq_boost.h diff --git a/arch/arm64/configs/raphael_defconfig b/arch/arm64/configs/raphael_defconfig index 1310cc0f912a..3cf48b801138 100644 --- a/arch/arm64/configs/raphael_defconfig +++ b/arch/arm64/configs/raphael_defconfig @@ -4289,11 +4289,6 @@ CONFIG_DEVFREQ_SIMPLE_DEV=y CONFIG_QCOM_DEVFREQ_DEVBW=y # CONFIG_DEVFREQ_SPDM is not set CONFIG_DEVFREQ_GOV_CDSPL3=y -CONFIG_DEVFREQ_BOOST=y -CONFIG_DEVFREQ_INPUT_BOOST_DURATION_MS=64 -CONFIG_DEVFREQ_WAKE_BOOST_DURATION_MS=1000 -CONFIG_DEVFREQ_MSM_CPUBW_BOOST_FREQ=4577 -CONFIG_DEVFREQ_MSM_LLCCBW_BOOST_FREQ=2597 # CONFIG_PM_DEVFREQ_EVENT is not set CONFIG_EXTCON=y diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index be399b9e50f4..db8c2890accd 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -295,44 +295,6 @@ config CPU_FREQ_DEFAULT_PRIME_MIN If in doubt, say 0 to use the hardware's minimum frequency. -config CPU_INPUT_BOOST - bool "CPU Input Boost" - help - Boosts the CPU on touchscreen and touchpad input, and allows for - boosting on other custom events, mainly which is intended to be for - boosting when there is a new frame ready to be rendered to the - display. The boost frequencies for this driver should be set so that - frame drops are near-zero at the boosted frequencies and power - consumption is minimized at said frequency combination. - -if CPU_INPUT_BOOST - -config WAKE_BOOST_DURATION_MS - int "Wake boost duration" - default "1000" - help - Wake boost duration in milliseconds. - -config MAX_BOOST_FREQ_LP - int "Low-power cluster max-boost freq" - default "0" - help - Max-boost frequency for the low-power CPU cluster. - -config MAX_BOOST_FREQ_PERF - int "Performance cluster max-boost freq" - default "0" - help - Max-boost frequency for the performance CPU cluster. - -config MAX_BOOST_FREQ_PERFP - int "Prime cluster max-boost freq" - default "0" - help - Max-boost frequency for the prime CPU cluster. - -endif - comment "CPU frequency scaling drivers" config CPUFREQ_DT diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index c5abbf7aa58a..6d92de038fdc 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile @@ -19,9 +19,6 @@ obj-$(CONFIG_CPU_FREQ_GOV_COMMON) += cpufreq_governor.o obj-$(CONFIG_CPU_FREQ_GOV_ATTR_SET) += cpufreq_governor_attr_set.o obj-$(CONFIG_CPU_BOOST) += cpu-boost.o -# CPU Input Boost -obj-$(CONFIG_CPU_INPUT_BOOST) += cpu_input_boost.o - obj-$(CONFIG_CPUFREQ_DT) += cpufreq-dt.o obj-$(CONFIG_CPUFREQ_DT_PLATDEV) += cpufreq-dt-platdev.o diff --git a/drivers/cpufreq/cpu_input_boost.c b/drivers/cpufreq/cpu_input_boost.c deleted file mode 100644 index 27e7ba52d850..000000000000 --- a/drivers/cpufreq/cpu_input_boost.c +++ /dev/null @@ -1,239 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2018-2019 Sultan Alsawaf . - */ - -#define pr_fmt(fmt) "cpu_input_boost: " fmt - -#include -#include -#include -#include -#include -#include -#include - -/* The sched_param struct is located elsewhere in newer kernels */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) -#include -#endif - -enum { - SCREEN_OFF, - MAX_BOOST -}; - -struct boost_drv { - struct delayed_work max_unboost; - struct notifier_block cpu_notif; - struct notifier_block msm_drm_notif; - wait_queue_head_t boost_waitq; - atomic_long_t max_boost_expires; - unsigned long state; -}; - -static void max_unboost_worker(struct work_struct *work); - -static struct boost_drv boost_drv_g __read_mostly = { - .max_unboost = __DELAYED_WORK_INITIALIZER(boost_drv_g.max_unboost, - max_unboost_worker, 0), - .boost_waitq = __WAIT_QUEUE_HEAD_INITIALIZER(boost_drv_g.boost_waitq) -}; - -static unsigned int get_max_boost_freq(struct cpufreq_policy *policy) -{ - unsigned int freq; - - if (cpumask_test_cpu(policy->cpu, cpu_lp_mask)) - freq = CONFIG_MAX_BOOST_FREQ_LP; - else if (cpumask_test_cpu(policy->cpu, cpu_perf_mask)) - freq = CONFIG_MAX_BOOST_FREQ_PERF; - else - freq = CONFIG_MAX_BOOST_FREQ_PERFP; - - return min(freq, policy->max); -} - -static unsigned int get_min_freq(struct cpufreq_policy *policy) -{ - unsigned int freq; - - if (cpumask_test_cpu(policy->cpu, cpu_lp_mask)) - freq = CONFIG_CPU_FREQ_DEFAULT_LITTLE_MIN; - else if (cpumask_test_cpu(policy->cpu, cpu_perf_mask)) - freq = CONFIG_CPU_FREQ_DEFAULT_BIG_MIN; - else - freq = CONFIG_CPU_FREQ_DEFAULT_PRIME_MIN; - - return max(freq, policy->cpuinfo.min_freq); -} - -static void update_online_cpu_policy(void) -{ - unsigned int cpu; - - /* Only one CPU from each cluster needs to be updated */ - get_online_cpus(); - cpu = cpumask_first_and(cpu_lp_mask, cpu_online_mask); - cpufreq_update_policy(cpu); - cpu = cpumask_first_and(cpu_perf_mask, cpu_online_mask); - cpufreq_update_policy(cpu); - cpu = cpumask_first_and(cpu_perfp_mask, cpu_online_mask); - cpufreq_update_policy(cpu); - put_online_cpus(); -} - -static void __cpu_input_boost_kick_max(struct boost_drv *b, - unsigned int duration_ms) -{ - unsigned long boost_jiffies = msecs_to_jiffies(duration_ms); - unsigned long curr_expires, new_expires; - - if (test_bit(SCREEN_OFF, &b->state)) - return; - - do { - curr_expires = atomic_long_read(&b->max_boost_expires); - new_expires = jiffies + boost_jiffies; - - /* Skip this boost if there's a longer boost in effect */ - if (time_after(curr_expires, new_expires)) - return; - } while (atomic_long_cmpxchg(&b->max_boost_expires, curr_expires, - new_expires) != curr_expires); - - set_bit(MAX_BOOST, &b->state); - if (!mod_delayed_work(system_unbound_wq, &b->max_unboost, - boost_jiffies)) - wake_up(&b->boost_waitq); -} - -void cpu_input_boost_kick_max(unsigned int duration_ms) -{ - struct boost_drv *b = &boost_drv_g; - - __cpu_input_boost_kick_max(b, duration_ms); -} - -static void max_unboost_worker(struct work_struct *work) -{ - struct boost_drv *b = container_of(to_delayed_work(work), - typeof(*b), max_unboost); - - clear_bit(MAX_BOOST, &b->state); - wake_up(&b->boost_waitq); -} - -static int cpu_boost_thread(void *data) -{ - static const struct sched_param sched_max_rt_prio = { - .sched_priority = MAX_RT_PRIO - 1 - }; - struct boost_drv *b = data; - unsigned long old_state = 0; - - sched_setscheduler_nocheck(current, SCHED_FIFO, &sched_max_rt_prio); - - while (1) { - bool should_stop = false; - unsigned long curr_state; - - wait_event(b->boost_waitq, - (curr_state = READ_ONCE(b->state)) != old_state || - (should_stop = kthread_should_stop())); - - if (should_stop) - break; - - old_state = curr_state; - update_online_cpu_policy(); - } - - return 0; -} - -static int cpu_notifier_cb(struct notifier_block *nb, unsigned long action, - void *data) -{ - struct boost_drv *b = container_of(nb, typeof(*b), cpu_notif); - struct cpufreq_policy *policy = data; - - if (action != CPUFREQ_ADJUST) - return NOTIFY_OK; - - /* Unboost when the screen is off */ - if (test_bit(SCREEN_OFF, &b->state)) - goto min; - - /* Boost CPU to max frequency for max boost */ - if (test_bit(MAX_BOOST, &b->state)) { - policy->min = get_max_boost_freq(policy); - return NOTIFY_OK; - } - -min: - /* Set policy->min to the absolute min freq for the CPU */ - policy->min = get_min_freq(policy); - return NOTIFY_OK; -} - -static int msm_drm_notifier_cb(struct notifier_block *nb, unsigned long action, - void *data) -{ - struct boost_drv *b = container_of(nb, typeof(*b), msm_drm_notif); - struct msm_drm_notifier *evdata = data; - int *blank = evdata->data; - - /* Parse framebuffer blank events as soon as they occur */ - if (action != MSM_DRM_EARLY_EVENT_BLANK) - return NOTIFY_OK; - - /* Boost when the screen turns on and unboost when it turns off */ - if (*blank == MSM_DRM_BLANK_UNBLANK) { - clear_bit(SCREEN_OFF, &b->state); - __cpu_input_boost_kick_max(b, CONFIG_WAKE_BOOST_DURATION_MS); - } else { - set_bit(SCREEN_OFF, &b->state); - wake_up(&b->boost_waitq); - } - - return NOTIFY_OK; -} - -static int __init cpu_input_boost_init(void) -{ - struct boost_drv *b = &boost_drv_g; - struct task_struct *thread; - int ret; - - b->cpu_notif.notifier_call = cpu_notifier_cb; - ret = cpufreq_register_notifier(&b->cpu_notif, CPUFREQ_POLICY_NOTIFIER); - if (ret) { - pr_err("Failed to register cpufreq notifier, err: %d\n", ret); - return ret; - } - - b->msm_drm_notif.notifier_call = msm_drm_notifier_cb; - b->msm_drm_notif.priority = INT_MAX; - ret = msm_drm_register_client(&b->msm_drm_notif); - if (ret) { - pr_err("Failed to register msm_drm notifier, err: %d\n", ret); - goto unregister_cpu_notif; - } - - thread = kthread_run_perf_critical(cpu_boost_thread, b, "cpu_boostd"); - if (IS_ERR(thread)) { - ret = PTR_ERR(thread); - pr_err("Failed to start CPU boost thread, err: %d\n", ret); - goto unregister_fb_notif; - } - - return 0; - -unregister_fb_notif: - msm_drm_unregister_client(&b->msm_drm_notif); -unregister_cpu_notif: - cpufreq_unregister_notifier(&b->cpu_notif, CPUFREQ_POLICY_NOTIFIER); - return ret; -} -subsys_initcall(cpu_input_boost_init); diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig index 2e007925fa26..813417c57703 100644 --- a/drivers/devfreq/Kconfig +++ b/drivers/devfreq/Kconfig @@ -263,46 +263,6 @@ config DEVFREQ_GOV_CDSPL3 CDSP resource manager will use this governor to vote for L3 clock for IO-coherent traffic generated from CDSP -config DEVFREQ_BOOST - bool "Devfreq Boost" - help - Boosts enumerated devfreq devices upon input, and allows for boosting - specific devfreq devices on other custom events. The boost frequencies - for this driver should be set so that frame drops are near-zero at the - boosted frequencies and power consumption is minimized at said - frequencies. The goal of this driver is to provide an interface to - achieve optimal device performance by requesting boosts on key events, - such as when a frame is ready to rendered to the display. - -if DEVFREQ_BOOST - -config DEVFREQ_INPUT_BOOST_DURATION_MS - int "Input boost duration" - default "100" - help - Input boost duration in milliseconds for all boostable devices. - -config DEVFREQ_WAKE_BOOST_DURATION_MS - int "Wake boost duration" - default "1000" - help - Wake boost duration in milliseconds for all boostable devices. - -config DEVFREQ_MSM_CPUBW_BOOST_FREQ - int "Boost freq for cpubw device" - default "0" - help - CPUBW boost frequency for the MSM DDR bus. - - -config DEVFREQ_MSM_LLCCBW_BOOST_FREQ - int "Boost freq for llccbw device" - default "0" - help - LLCCBW boost frequency for the MSM DDR bus. - -endif - source "drivers/devfreq/event/Kconfig" endif # PM_DEVFREQ diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile index 7511f78ed909..f819efc03a1e 100644 --- a/drivers/devfreq/Makefile +++ b/drivers/devfreq/Makefile @@ -30,6 +30,3 @@ obj-$(CONFIG_DEVFREQ_SPDM) += devfreq_spdm.o devfreq_spdm_debugfs.o # DEVFREQ Event Drivers obj-$(CONFIG_PM_DEVFREQ_EVENT) += event/ - -# DEVFREQ Boost -obj-$(CONFIG_DEVFREQ_BOOST) += devfreq_boost.o diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index dc0643a6a55e..b54c152ae516 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -263,15 +263,10 @@ int update_devfreq(struct devfreq *devfreq) if (!devfreq->governor) return -EINVAL; - if (devfreq->max_boost) { - /* Use the max freq for max boosts */ - freq = ULONG_MAX; - } else { - /* Reevaluate the proper frequency */ - err = devfreq->governor->get_target_freq(devfreq, &freq); - if (err) - return err; - } + /* Reevaluate the proper frequency */ + err = devfreq->governor->get_target_freq(devfreq, &freq); + if (err) + return err; /* * Adjust the frequency with user freq and QoS. @@ -1133,10 +1128,6 @@ static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr, int ret; unsigned long max; - /* Minfreq is managed by devfreq_boost */ - if (df->is_boost_device) - return count; - ret = sscanf(buf, "%lu", &value); if (ret != 1) return -EINVAL; diff --git a/drivers/devfreq/devfreq_boost.c b/drivers/devfreq/devfreq_boost.c deleted file mode 100644 index 0fcd6487886b..000000000000 --- a/drivers/devfreq/devfreq_boost.c +++ /dev/null @@ -1,337 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2018-2019 Sultan Alsawaf . - */ - -#define pr_fmt(fmt) "devfreq_boost: " fmt - -#include -#include -#include -#include -#include -#include - -enum { - SCREEN_OFF, - INPUT_BOOST, - MAX_BOOST -}; - -struct boost_dev { - struct devfreq *df; - struct delayed_work input_unboost; - struct delayed_work max_unboost; - wait_queue_head_t boost_waitq; - atomic_long_t max_boost_expires; - unsigned long boost_freq; - unsigned long state; -}; - -struct df_boost_drv { - struct boost_dev devices[DEVFREQ_MAX]; - struct notifier_block msm_drm_notif; -}; - -static void devfreq_input_unboost(struct work_struct *work); -static void devfreq_max_unboost(struct work_struct *work); - -#define BOOST_DEV_INIT(b, dev, freq) .devices[dev] = { \ - .input_unboost = \ - __DELAYED_WORK_INITIALIZER((b).devices[dev].input_unboost, \ - devfreq_input_unboost, 0), \ - .max_unboost = \ - __DELAYED_WORK_INITIALIZER((b).devices[dev].max_unboost, \ - devfreq_max_unboost, 0), \ - .boost_waitq = \ - __WAIT_QUEUE_HEAD_INITIALIZER((b).devices[dev].boost_waitq), \ - .boost_freq = freq \ -} - -static struct df_boost_drv df_boost_drv_g __read_mostly = { - BOOST_DEV_INIT(df_boost_drv_g, DEVFREQ_MSM_CPUBW, - CONFIG_DEVFREQ_MSM_CPUBW_BOOST_FREQ), - BOOST_DEV_INIT(df_boost_drv_g, DEVFREQ_MSM_LLCCBW, - CONFIG_DEVFREQ_MSM_LLCCBW_BOOST_FREQ) -}; - -static void __devfreq_boost_kick(struct boost_dev *b) -{ - if (!READ_ONCE(b->df) || test_bit(SCREEN_OFF, &b->state)) - return; - - set_bit(INPUT_BOOST, &b->state); - if (!mod_delayed_work(system_unbound_wq, &b->input_unboost, - msecs_to_jiffies(CONFIG_DEVFREQ_INPUT_BOOST_DURATION_MS))) - wake_up(&b->boost_waitq); -} - -void devfreq_boost_kick(enum df_device device) -{ - struct df_boost_drv *d = &df_boost_drv_g; - - __devfreq_boost_kick(d->devices + device); -} - -static void __devfreq_boost_kick_max(struct boost_dev *b, - unsigned int duration_ms) -{ - unsigned long boost_jiffies = msecs_to_jiffies(duration_ms); - unsigned long curr_expires, new_expires; - - if (!READ_ONCE(b->df) || test_bit(SCREEN_OFF, &b->state)) - return; - - do { - curr_expires = atomic_long_read(&b->max_boost_expires); - new_expires = jiffies + boost_jiffies; - - /* Skip this boost if there's a longer boost in effect */ - if (time_after(curr_expires, new_expires)) - return; - } while (atomic_long_cmpxchg(&b->max_boost_expires, curr_expires, - new_expires) != curr_expires); - - set_bit(MAX_BOOST, &b->state); - if (!mod_delayed_work(system_unbound_wq, &b->max_unboost, - boost_jiffies)) - wake_up(&b->boost_waitq); -} - -void devfreq_boost_kick_max(enum df_device device, unsigned int duration_ms) -{ - struct df_boost_drv *d = &df_boost_drv_g; - - __devfreq_boost_kick_max(d->devices + device, duration_ms); -} - -void devfreq_register_boost_device(enum df_device device, struct devfreq *df) -{ - struct df_boost_drv *d = &df_boost_drv_g; - struct boost_dev *b; - - df->is_boost_device = true; - b = d->devices + device; - WRITE_ONCE(b->df, df); -} - -static void devfreq_input_unboost(struct work_struct *work) -{ - struct boost_dev *b = container_of(to_delayed_work(work), - typeof(*b), input_unboost); - - clear_bit(INPUT_BOOST, &b->state); - wake_up(&b->boost_waitq); -} - -static void devfreq_max_unboost(struct work_struct *work) -{ - struct boost_dev *b = container_of(to_delayed_work(work), - typeof(*b), max_unboost); - - clear_bit(MAX_BOOST, &b->state); - wake_up(&b->boost_waitq); -} - -static void devfreq_update_boosts(struct boost_dev *b, unsigned long state) -{ - struct devfreq *df = b->df; - - mutex_lock(&df->lock); - if (test_bit(SCREEN_OFF, &state)) { - df->min_freq = df->profile->freq_table[0]; - df->max_boost = false; - } else { - df->min_freq = test_bit(INPUT_BOOST, &state) ? - min(b->boost_freq, df->max_freq) : - df->profile->freq_table[0]; - df->max_boost = test_bit(MAX_BOOST, &state); - } - update_devfreq(df); - mutex_unlock(&df->lock); -} - -static int devfreq_boost_thread(void *data) -{ - static const struct sched_param sched_max_rt_prio = { - .sched_priority = MAX_RT_PRIO - 1 - }; - struct boost_dev *b = data; - unsigned long old_state = 0; - - sched_setscheduler_nocheck(current, SCHED_FIFO, &sched_max_rt_prio); - - while (1) { - bool should_stop = false; - unsigned long curr_state; - - wait_event(b->boost_waitq, - (curr_state = READ_ONCE(b->state)) != old_state || - (should_stop = kthread_should_stop())); - - if (should_stop) - break; - - old_state = curr_state; - devfreq_update_boosts(b, curr_state); - } - - return 0; -} - -static int msm_drm_notifier_cb(struct notifier_block *nb, unsigned long action, - void *data) -{ - struct df_boost_drv *d = container_of(nb, typeof(*d), msm_drm_notif); - int i; - struct msm_drm_notifier *evdata = data; - int *blank = evdata->data; - - /* Parse framebuffer blank events as soon as they occur */ - if (action != MSM_DRM_EARLY_EVENT_BLANK) - return NOTIFY_OK; - - /* Boost when the screen turns on and unboost when it turns off */ - for (i = 0; i < DEVFREQ_MAX; i++) { - struct boost_dev *b = d->devices + i; - - if (*blank == MSM_DRM_BLANK_UNBLANK) { - clear_bit(SCREEN_OFF, &b->state); - __devfreq_boost_kick_max(b, - CONFIG_DEVFREQ_WAKE_BOOST_DURATION_MS); - } else { - set_bit(SCREEN_OFF, &b->state); - wake_up(&b->boost_waitq); - } - } - - return NOTIFY_OK; -} - -static void devfreq_boost_input_event(struct input_handle *handle, - unsigned int type, unsigned int code, - int value) -{ - struct df_boost_drv *d = handle->handler->private; - int i; - - for (i = 0; i < DEVFREQ_MAX; i++) - __devfreq_boost_kick_max(d->devices + i, 250); -} - -static int devfreq_boost_input_connect(struct input_handler *handler, - struct input_dev *dev, - const struct input_device_id *id) -{ - struct input_handle *handle; - int ret; - - handle = kzalloc(sizeof(*handle), GFP_KERNEL); - if (!handle) - return -ENOMEM; - - handle->dev = dev; - handle->handler = handler; - handle->name = "devfreq_boost_handle"; - - ret = input_register_handle(handle); - if (ret) - goto free_handle; - - ret = input_open_device(handle); - if (ret) - goto unregister_handle; - - return 0; - -unregister_handle: - input_unregister_handle(handle); -free_handle: - kfree(handle); - return ret; -} - -static void devfreq_boost_input_disconnect(struct input_handle *handle) -{ - input_close_device(handle); - input_unregister_handle(handle); - kfree(handle); -} - -static const struct input_device_id devfreq_boost_ids[] = { - /* Multi-touch touchscreen */ - { - .flags = INPUT_DEVICE_ID_MATCH_EVBIT | - INPUT_DEVICE_ID_MATCH_ABSBIT, - .evbit = { BIT_MASK(EV_ABS) }, - .absbit = { [BIT_WORD(ABS_MT_POSITION_X)] = - BIT_MASK(ABS_MT_POSITION_X) | - BIT_MASK(ABS_MT_POSITION_Y) } - }, - /* Touchpad */ - { - .flags = INPUT_DEVICE_ID_MATCH_KEYBIT | - INPUT_DEVICE_ID_MATCH_ABSBIT, - .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) }, - .absbit = { [BIT_WORD(ABS_X)] = - BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) } - }, - /* Keypad */ - { - .flags = INPUT_DEVICE_ID_MATCH_EVBIT, - .evbit = { BIT_MASK(EV_KEY) } - }, - { } -}; - -static struct input_handler devfreq_boost_input_handler = { - .event = devfreq_boost_input_event, - .connect = devfreq_boost_input_connect, - .disconnect = devfreq_boost_input_disconnect, - .name = "devfreq_boost_handler", - .id_table = devfreq_boost_ids -}; - -static int __init devfreq_boost_init(void) -{ - struct df_boost_drv *d = &df_boost_drv_g; - struct task_struct *thread[DEVFREQ_MAX]; - int i, ret; - - for (i = 0; i < DEVFREQ_MAX; i++) { - struct boost_dev *b = d->devices + i; - - thread[i] = kthread_run_perf_critical(devfreq_boost_thread, b, - "devfreq_boostd/%d", i); - if (IS_ERR(thread[i])) { - ret = PTR_ERR(thread[i]); - pr_err("Failed to create kthread, err: %d\n", ret); - goto stop_kthreads; - } - } - - devfreq_boost_input_handler.private = d; - ret = input_register_handler(&devfreq_boost_input_handler); - if (ret) { - pr_err("Failed to register input handler, err: %d\n", ret); - goto stop_kthreads; - } - - d->msm_drm_notif.notifier_call = msm_drm_notifier_cb; - d->msm_drm_notif.priority = INT_MAX; - ret = msm_drm_register_client(&d->msm_drm_notif); - if (ret) { - pr_err("Failed to register fb notifier, err: %d\n", ret); - goto unregister_handler; - } - - return 0; - -unregister_handler: - input_unregister_handler(&devfreq_boost_input_handler); -stop_kthreads: - while (i--) - kthread_stop(thread[i]); - return ret; -} -late_initcall(devfreq_boost_init); diff --git a/drivers/devfreq/devfreq_devbw.c b/drivers/devfreq/devfreq_devbw.c index 497958024f19..a6b8b9fe1cc7 100644 --- a/drivers/devfreq/devfreq_devbw.c +++ b/drivers/devfreq/devfreq_devbw.c @@ -31,7 +31,6 @@ #include #include #include -#include /* Has to be ULL to prevent overflow where this macro is used. */ #define MBYTE (1ULL << 20) @@ -238,12 +237,6 @@ int devfreq_add_devbw(struct device *dev) return PTR_ERR(d->df); } - if (!strcmp(dev_name(dev), "soc:qcom,cpu-cpu-llcc-bw")) - devfreq_register_boost_device(DEVFREQ_MSM_CPUBW, d->df); - - if (!strcmp(dev_name(dev), "soc:qcom,cpu-llcc-ddr-bw")) - devfreq_register_boost_device(DEVFREQ_MSM_LLCCBW, d->df); - return 0; } diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index e22de7c98d29..a87ead3c5c20 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "drm_crtc_internal.h" @@ -2248,11 +2247,6 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) return -EINVAL; - if (!(arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)) { - devfreq_boost_kick(DEVFREQ_MSM_CPUBW); - devfreq_boost_kick(DEVFREQ_MSM_LLCCBW); - } - drm_modeset_acquire_init(&ctx, 0); state = drm_atomic_state_alloc(dev); diff --git a/fs/exec.c b/fs/exec.c index 3fb5e4bd523e..2bd49fbdf38b 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -77,16 +77,6 @@ int suid_dumpable = 0; static LIST_HEAD(formats); static DEFINE_RWLOCK(binfmt_lock); -#define ZYGOTE32_BIN "/system/bin/app_process32" -#define ZYGOTE64_BIN "/system/bin/app_process64" -static struct signal_struct *zygote32_sig; -static struct signal_struct *zygote64_sig; - -bool task_is_zygote(struct task_struct *p) -{ - return p->signal == zygote32_sig || p->signal == zygote64_sig; -} - void __register_binfmt(struct linux_binfmt * fmt, int insert) { BUG_ON(!fmt); @@ -1809,13 +1799,6 @@ static int do_execveat_common(int fd, struct filename *filename, if (retval < 0) goto out; - if (is_global_init(current->parent)) { - if (unlikely(!strcmp(filename->name, ZYGOTE32_BIN))) - zygote32_sig = current->signal; - else if (unlikely(!strcmp(filename->name, ZYGOTE64_BIN))) - zygote64_sig = current->signal; - } - /* execve succeeded */ current->fs->in_exec = 0; current->in_execve = 0; diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 4e7a46907b6d..ef6f37c7ed39 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -139,7 +139,6 @@ extern int prepare_bprm_creds(struct linux_binprm *bprm); extern void install_exec_creds(struct linux_binprm *bprm); extern void set_binfmt(struct linux_binfmt *new); extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t); -extern bool task_is_zygote(struct task_struct *p); extern int do_execve(struct filename *, const char __user * const __user *, diff --git a/include/linux/cpu_input_boost.h b/include/linux/cpu_input_boost.h deleted file mode 100644 index 3c0860cc3c9b..000000000000 --- a/include/linux/cpu_input_boost.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2018-2019 Sultan Alsawaf . - */ -#ifndef _CPU_INPUT_BOOST_H_ -#define _CPU_INPUT_BOOST_H_ - -#ifdef CONFIG_CPU_INPUT_BOOST -void cpu_input_boost_kick_max(unsigned int duration_ms); -#else -static inline void cpu_input_boost_kick_max(unsigned int duration_ms) -{ -} -#endif - -#endif /* _CPU_INPUT_BOOST_H_ */ diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index dbe04a26b687..f26c0fe68623 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -154,8 +154,6 @@ struct devfreq { unsigned long min_freq; unsigned long max_freq; - bool is_boost_device; - bool max_boost; bool stop_polling; /* information for device frequency transition */ @@ -388,11 +386,6 @@ static inline int devfreq_update_stats(struct devfreq *df) { return -EINVAL; } - -static inline int update_devfreq(struct devfreq *devfreq) -{ - return -EINVAL; -} #endif /* CONFIG_PM_DEVFREQ */ #endif /* __LINUX_DEVFREQ_H__ */ diff --git a/include/linux/devfreq_boost.h b/include/linux/devfreq_boost.h deleted file mode 100644 index 391aec1a8043..000000000000 --- a/include/linux/devfreq_boost.h +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2018-2019 Sultan Alsawaf . - */ -#ifndef _DEVFREQ_BOOST_H_ -#define _DEVFREQ_BOOST_H_ - -#include - -enum df_device { - DEVFREQ_MSM_CPUBW, - DEVFREQ_MSM_LLCCBW, - DEVFREQ_MAX -}; - -#ifdef CONFIG_DEVFREQ_BOOST -void devfreq_boost_kick(enum df_device device); -void devfreq_boost_kick_max(enum df_device device, unsigned int duration_ms); -void devfreq_register_boost_device(enum df_device device, struct devfreq *df); -#else -static inline -void devfreq_boost_kick(enum df_device device) -{ -} -static inline -void devfreq_boost_kick_max(enum df_device device, unsigned int duration_ms) -{ -} -static inline -void devfreq_register_boost_device(enum df_device device, struct devfreq *df) -{ -} -#endif - -#endif /* _DEVFREQ_BOOST_H_ */ diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 6a3e34f07b36..7f53d00f19ae 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -13,8 +13,6 @@ #include #include #include -#include -#include #include @@ -553,11 +551,6 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, ret = cgroup_attach_task(cgrp, task, threadgroup); - /* This covers boosting for app launches and app transitions */ - if (!ret && !threadgroup && !strcmp(of->kn->parent->name, "top-app") && - task_is_zygote(task->parent)) - cpu_input_boost_kick_max(1000); - out_finish: cgroup_procs_write_finish(task); out_unlock: diff --git a/kernel/fork.c b/kernel/fork.c index e4e47a9a8be6..17a5cc8e7880 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -95,7 +95,6 @@ #include #include #include -#include #include #include @@ -2207,10 +2206,6 @@ long _do_fork(unsigned long clone_flags, int trace = 0; long nr; - /* Boost CPU to the max for 3000 ms when userspace launches an app */ - if (task_is_zygote(current)) - cpu_input_boost_kick_max(3000); - /* * Determine whether and which event to report to ptracer. When * called from kernel_thread or CLONE_UNTRACED is explicitly diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d5d16b53d2c1..befb416e517f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -69,7 +69,6 @@ #include #include #include -#include #include #include @@ -4227,10 +4226,6 @@ retry: if (costly_order && !(gfp_mask & __GFP_RETRY_MAYFAIL)) goto nopage; - /* Boost when memory is low so allocation latency doesn't get too bad */ - devfreq_boost_kick_max(DEVFREQ_MSM_LLCCBW, 100); - devfreq_boost_kick_max(DEVFREQ_MSM_CPUBW, 100); - if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, did_some_progress > 0, &no_progress_loops)) goto retry;