Also compile out lct_tp_selftest drivers. We've already disabled selftest in nt36xxx_spi driver so it makes no sense to compile the selftest driver.
Change-Id: I91b1869f31145ff24fa7de477739f09d6666d682
Signed-off-by: Forenche <prahul2003@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
We've already disabled self tests in the device tree and the driver
itself so loading in the self test firmware makes 0 sense.
Change-Id: I90ed9bbf3acf10eeee57a3203bd6c0408dc8b676
Signed-off-by: Forenche <prahul2003@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Kernel complains about this IRQ being misconfigured and causing wakeups.
Change-Id: If82fb0dfe707b1e2dfda10ce25da516ab8782e5e
Signed-off-by: Yaroslav Furman <yaro330@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
IRQs shouldn't have so much stuff in them, move
IRQ processing to a highpri workqueue.
Change-Id: Ia70603e9324b14db7c936d65d432bac4847d5db6
Signed-off-by: Yaroslav Furman <yaro330@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Add static branch predictor hints.
Throw in pm_qos triggers for good measure.
Change-Id: I3e2f2db31f41d6e23931ce16eb48a547a0ae3387
Signed-off-by: Yaroslav Furman <yaro330@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Give fingerprintd the highest priority (MIN_NICE) when the screen is off to
speed up fingerprint processing, and then reset its priority back to normal
when the screen is on.
There are now 2 fingerprint related processes:
- android.hardware.biometrics.fingerprint@2.1-service -> comm:fingerprint@2.1
- com.qualcomm.qti.biometrics.fingerprint.service -> comm:erprint.service
For the match to work properly, use strstr() with "erprint".
[ghostrider-reborn]
- device_available was being set to 0 during fp-unlock-and-wake
which led to niceness being stuck at -20 (except in dt2w)
- Also use xiaomi bridge interface hack to slightly reduce
unlock times, no idea why it was commented in the first place
Change-Id: Ice4a384f99ae4201b2e5e942b0c8cc16c1190f52
Co-authored-by: Fiqri Ardyansyah <fiqri15072019@gmail.com>
Co-authored-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Give fingerprintd the highest priority (MIN_NICE) when the screen is off to
speed up fingerprint processing, and then reset its priority back to normal
when the screen is on.
There are now 2 fingerprint related processes:
- android.hardware.biometrics.fingerprint@2.1-service -> comm:fingerprint@2.1
- com.qualcomm.qti.biometrics.fingerprint.service -> comm:erprint.service
For the match to work properly, use strstr() with "erprint".
Change-Id: Ice4a384f99ae4201b2e5e942b0c8cc16c1190f52
Co-authored-by: Fiqri Ardyansyah <fiqri15072019@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit 9134bba361dd43754a854e5c10d2d6f9b891f5ff.
Change-Id: Ib62ec4a83187a621b68f14b2707b85ab34d26d69
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit dd1608b099584484bb54c76e662d5bff9b529151.
Change-Id: I6f24519743c62d7457e28781fece068eb6bf248f
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit fd4c04af1f8f0fd8e3f10e3110e98707a3226ab6.
Change-Id: Iab59e9b9d8438a328b7f0a4684f14a141e85901f
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Change-Id: I1229bdaa5afcba572c24616aedcd831c93316108
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This code is used to prevent recently used cores from entering deep idle
states. Remove it in hope to save some power.
Change-Id: I620ea62c523caaebe29b935633eec28667e04420
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
There is a lot of CPU time spent in hrtimer_try_to_cancel() when exiting
idle according to perf. This is due to the idle prediction feature
constantly arming and canceling a timer that it uses to track prediction
accuracy. Idle prediction itself is used to try and select shallower
idle states when an incoming wake-up is predicted in order to improve
performance, but performance is actually better without idle prediction,
presumably thanks to eliminating the hrtimer_try_to_cancel() overhead.
The code for idle prediction is removed wholesale because the toggle
doesn't cover everything, and it's easier to just nuke the whole feature
than it is to try and cover everything with a toggle.
Change-Id: I906ed0d5943f1049201ffb7c31001f5e19a10157
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
[dereference23: Forward port to 4.14]
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Change-Id: Id8dbf5087e81598dd1126d2543aff2e699dd8357
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
In non-foreground gc mode, if no victim is selected, the gc process
will wait for no_gc_sleep_time before waking up again. In this
subsequent time, even though a victim will be selected, the gc process
still waits for no_gc_sleep_time before waking up. The configuration
of wait_ms is not reasonable.
After any of the victims have been selected, we need to reset wait_ms to
default sleep time from no_gc_sleep_time.
Change-Id: I79aa139b04de5808fa99a8c08ad2827fa7d83ea6
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Waking up discard thread on 50ms interval is way too aggressive,
even when the user has only 20% of space left.
60000ms vs 50ms is too much of a stark difference.
Use 10 seconds instead.
The use of Rapid GC also makes this switch more reasonable.
Change-Id: Ib9a4de4df3aa4475c1c3da8852a7f667a95c80de
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Mainline's default is set to 500ms and Android switches this to 50ms during boot. However, this is still not enough to sufficiently perform GC.
Hardcode this to 5ms from the kernel.
Change-Id: Ib6dda6a96aa2331d0ef725f59687e4016ecc7238
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit 13cc43b12b3d4200d5bc8d900d05689b23c58aa5.
Change-Id: I990aed89a678011004e123ada5ac07d7b1a8f0f4
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit fba50debe41b34bc281947cecd03c67b79f97403.
Change-Id: I3fc44d88fc72afdc8c4e26dce5dca996ed415ff9
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit 099732c94bc367ad219a1d35ff5bcd66e9ea0e1e.
Change-Id: I9e6f70c472574770352bf9185736b5c5547091e0
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit 253da299d8ed002897580796fef209603610132d.
Change-Id: Ib273e2291d76aae838f5b49ec8da81ca12b56435
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit f47de838078091aedf4de74731d37089daf20bf5.
Change-Id: I0af372562dbd0aa08da685a8d9d432518a8b79e6
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This reverts commit bf2fdd35c1cab2dd1c704ad2a40b20ae4473a4fe.
Change-Id: Iea1e43e248b9f3a6b2b34c2313aef4e0eaad9381
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
IRQ balancing is already performed naturally by moving the i2c IRQ to the CPU that kicks off an i2c transaction. Therefore, opt out from IRQ balancing operations by setting IRQF_NOBALANCING.
Change-Id: I01c3d1889fde7b993826b92829b5f83e585c3f94
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
The effective affinity mask causes a lot of bugs by virtue of many
set_irq_affinity handlers only setting an effective affinity mask for an
IRQ's parent but not the IRQ itself. Since this is a widespread issue that
would require manual fixing on every different SoC, just disable the
effective affinity mask altogether and use the first CPU in an affinity
mask configured.
Change-Id: Ieec06c5c392250608d954dd144e1513a5bdad56f
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
toggle_bp_registers() is called from __schedule() when we don't need it.
Remove it to ever so slightly shave down __schedule() overhead.
Change-Id: I7b7b6cce771b93b6458ac7b8e34e2e31dee52ab3
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This just does the "if the architecture does efficient unaligned
handling, start the memcmp using 'unsigned long' accesses", since
Nikolay Borisov found a load that cares.
This is basically the minimal patch, and limited to architectures that
are known to not have slow unaligned handling. We've had the stupid
byte-at-a-time version forever, and nobody has ever even noticed before,
so let's keep the fix minimal.
A potential further improvement would be to align one of the sources in
order to at least minimize unaligned cases, but the only real case of
bigger memcmp() users seems to be the FIDEDUPERANGE ioctl(). As David
Sterba says, the dedupe ioctl is typically called on ranges spanning
many pages so the common case will all be page-aligned anyway.
All the relevant architectures select HAVE_EFFICIENT_UNALIGNED_ACCESS,
so I'm not going to worry about the combination of a very rare use-case
and a rare architecture until somebody actually hits it. Particularly
since Nikolay also tested the more complex patch with extra alignment
handling code, and it only added overhead.
Link: https://lore.kernel.org/lkml/20210721135926.602840-1-nborisov@suse.com/
Change-Id: I31524a62feb09d31028e870cac46598d0fbfb9cc
Reported-by: Nikolay Borisov <nborisov@suse.com>
Cc: David Sterba <dsterba@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
dm-verity's overhead is non-negligible.
As we're optimizing for performance over security, always use
"check_at_most_once".
Change-Id: Ib8b13d8429ac62bb1553ae81a7175d33fdb2e471
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Keeping the compiler in the dark about which sched_feat() toggles are
set reduces its ability to optimize scheduler code, which results in a
measurably significant performance loss since the affected code is very
hot. Turning sched_feat() definitions into macros that the compiler can
resolve results in smaller and faster code.
The sched_feat() definitions are converted to macros with this sed:
sed -i -E \
-e 's/SCHED_FEAT\((.*),(.*)\)/#define SCHED_FEAT_\1\2/' \
-e 's/true/1/' \
-e 's/false/0/' \
kernel/sched/features.h
The sched_feat() macros are named SCHED_FEAT_*. With this done, we can
now optimize try-to-wake-up code when SCHED_FEAT_TTWU_QUEUE is disabled,
which results in a CPU usage reduction of a few percent inside
try_to_wake_up().
Change-Id: Id3564300537308a2db5aedebc890be6f8932019b
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
During load balance, we try at most env->loop_max time to move a task.
But it can happen that the loop_max LRU tasks (ie tail of
the cfs_tasks list) can't be moved to dst_cpu because of affinity.
In this case, loop in the list until we found at least one.
The maximum of detached tasks remained the same as before.
Link: https://lkml.kernel.org/r/20220825122726.20819-2-vincent.guittot@linaro.org
Change-Id: Icaab04df216fd58001741d6f234a3964d1569031
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
With a default value of 500us, sysctl_sched_migration_cost is
significanlty higher than the cost of load_balance. Remove the
condition and rely on the sd->max_newidle_lb_cost to abort
newidle_balance.
Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Link: https://lore.kernel.org/r/20211019123537.17146-5-vincent.guittot@linaro.org
Change-Id: I5731e7967b03c1c1a542f210d128d58da98fb734
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
In newidle_balance(), the scheduler skips load balance to the new idle cpu
when the 1st sd of this_rq is:
this_rq->avg_idle < sd->max_newidle_lb_cost
Doing a costly call to update_blocked_averages() will not be useful and
simply adds overhead when this condition is true.
Check the condition early in newidle_balance() to skip
update_blocked_averages() when possible.
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Link: https://lore.kernel.org/r/20211019123537.17146-3-vincent.guittot@linaro.org
Change-Id: I615ac6f2147b4aa044b618957d31392927c1c283
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
The time spent to update the blocked load can be significant depending of
the complexity fo the cgroup hierarchy. Take this time into account in
the cost of the 1st load balance of a newly idle cpu.
Also reduce the number of call to sched_clock_cpu() and track more actual
work.
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Link: https://lore.kernel.org/r/20211019123537.17146-2-vincent.guittot@linaro.org
Change-Id: I0921c8b7a37ee1bb764d9de41ca4902ca2bd15c6
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
TEO seems to perform well as a cpuidle governor so let's use it.
Change-Id: I56bf4d73d26a3649bbf73c2efeaafcf3f4a6e05d
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
So it supercedes qcom governor and registers teo as the main cpuidle governor.
Change-Id: I4221fad713c32efec9fdcf5a2d198c0af65c8cd7
Signed-off-by: Kazuki Hashimoto <kazukih@tuta.io>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Add a no_poll flag to teo_find_shallower_state() that will let the
function optionally not consider polling states.
This allows the caller to guard against the function inadvertently
resulting in TEO putting the CPU in a polling state when that
behaviour is undesirable.
Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Tashar02: Backport to k4.19 ]
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Rename two local variables in teo_select() so that their names better
reflect their purpose.
No functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Tashar02: Backport to k4.19 ]
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
There are three mistakes in the loop in teo_select() that is looking
for an alternative candidate idle state. First, it should walk all
of the idle states shallower than the current candidate one,
including all of the disabled ones, but it terminates after the first
enabled idle state. Second, it should not terminate its last step
if idle state 0 is disabled (which is related to the first issue).
Finally, it may return the current alternative candidate idle state
prematurely if the time span criterion is not met by the idle state
under consideration at the moment.
To address the issues mentioned above, make the loop in question walk
all of the idle states shallower than the current candidate idle state
all the way down to idle state 0 and rearrange the checks in it.
Fixes: 77577558f25d ("cpuidle: teo: Rework most recent idle duration values treatment")
Reported-by: Doug Smythies <dsmythies@telus.net>
Tested-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Tashar02: Backport to k4.19 ]
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Fix following coccicheck warning:
drivers/cpuidle/governors/teo.c:315:10-11: Unneeded semicolon
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Tashar02: Backport to k4.19 ]
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
The TEO (Timer Events Oriented) cpuidle governor uses several most
recent idle duration values for a given CPU to refine the idle state
selection in case the previous long-term trends have not been
followed recently and a new trend appears to be forming. That is
done by computing the average of the most recent idle duration
values falling below the time till the next timer event ("sleep
length"), provided that they are the majority of the most recent
idle duration values taken into account, and using it as the new
expected idle duration value.
However, idle state selection based on that value may not be optimal,
because the average does not really indicate which of the idle states
with target residencies less than or equal to it is likely to be the
best fit.
Thus, instead of computing the average, make the governor carry out
computations based on the distribution of the most recent idle
duration values among the bins corresponding to different idle
states. Namely, if the majority of the most recent idle duration
values taken into consideration are less than the current sleep
length (which means that the CPU is likely to wake up early), find
the idle state closest to the "candidate" one "matching" the sleep
length whose target residency is less than or equal to the majority
of the most recent idle duration values that have fallen below the
current sleep length (which means that it is likely to be "shallow
enough" this time).
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Tashar02: Backport to k4.19 ]
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
Two aspects of the current main idle state selection logic in the
TEO (Timer Events Oriented) cpuidle governor are quite questionable.
First of all, the "hits" and "misses" metrics used by it are only
updated for a given idle state if the time till the next timer event
("sleep length") is between the target residency of that state and
the target residency of the next one. Consequently, they are likely
to become stale if the sleep length tends to fall outside that
interval which increases the likelihood of subomtimal idle state
selection.
Second, the decision on whether or not to select the idle state
"matching" the sleep length is based on the metrics collected for
that state alone, whereas in principle the metrics collected for
the other idle states should be taken into consideration when that
decision is made. For example, if the measured idle duration is less
than the target residency of the idle state "matching" the sleep
length, then it is also less than the target residency of any deeper
idle state and that should be taken into account when considering
whether or not to select any of those states, but currently it is
not.
In order to address the above shortcomings, modify the main idle
state selection logic in the TEO governor to take the metrics
collected for all of the idle states into account when deciding
whether or not to select the one "matching" the sleep length.
Moreover, drop the "misses" metric that becomes redundant after the
above change and rename the "early_hits" metric to "intercepts" so
that its role is better reflected by its name (the idea being that
if a CPU wakes up earlier than indicated by the sleep length, then
it must be a result of a non-timer interrupt that "intercepts" the
CPU).
Also rename the states[] array in struct struct teo_cpu to
state_bins[] to avoid confusing it with the states[] array in
struct cpuidle_driver and update the documentation to match the
new code (and make it more comprehensive while at it).
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Tashar02: Backport to k4.19, adapt variables and teo_middle_of_bin() return type to
mircoseconds as unit of time ]
Co-authored-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>