793520 Commits

Author SHA1 Message Date
Deepak Kumar
c1ac7dfa12 msm: kgsl: Change start variable type to int in kgsl_iommu_add_global
Variable start should be of type int instead of u32. Correct this to
ensure while loop can exit and WARN_ON statement is effective in
case global VA space doesn't have enough space for current request.

Change-Id: I0bc817abc9a16934b5c91fc31ba9c6dff3545c90
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:56:41 +05:30
Aniket Randive
041bf2eb97 i2c: i2c-msm-geni: Selectively disable DMA and operate in FIFO mode
Currently for SSC QUP, we are not supporting the DMA mode
on SA8155 and SA8195 platform. so for some non-gsi transfer
if the mode of SE is DMA then it will switch to the FIFO
mode and complete the transfer.

Change-Id: I4cbc2ed9ceff7d1c4fdfec3a1efeda80af2fc2bf
Signed-off-by: Aniket Randive <arandive@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:45 +05:30
Vivek Golani
b2ace36f1b diag: Enable graceful transfer of transport
Avoid channel close by setting flags if socket
transport close is invoked after rpmsg transport
has been probed.

Change-Id: I5d94894e05bbbe079a566d9356eb08a6aeac7799
Signed-off-by: Vivek Golani <vgolani@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:45 +05:30
Vivek Golani
8cbb49c395 diag: Add handling for invalid max channel size
Add handling for error case where zero or negative
max channel size is returned.

Change-Id: I43dff897595327484c153f68a6e30ca8f888c3e6
Signed-off-by: Vivek Golani <vgolani@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:45 +05:30
Manoj Prabhu B
bd955ad3ff diag: Prevent possible out of bound copy to userspace
While copying log and msg masks to userspace prevent possible
out of bound access with a check for available buffer for copying.

Change-Id: Ic92f1efb43dae7e467830157012b4cc292669740
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:45 +05:30
Manoj Prabhu B
b742a8f157 diag: Do not hold cntl lock while switching transport
Holding the cntl lock while switching the transport can
possibly lead to deadlock with a thread waiting for cntl lock
processing the socket feature.

Change-Id: I8e8b81e1329e647fe6d46f9f7211974351fe4254
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:45 +05:30
Ashish kori
bb3fb616c1 i2c-qcom-geni: Add bus recovery support for I2C master
I2C slave can get stuck during a transfer and may hold I2C
data line. In that case, I2C slave might require 9 clock pulses
from I2C master to release the data line.

Add bus clear support to recover I2C bus in above mentioned
scenario.

Change-Id: I51e896c84ddc97960eedbd2f828293a6d45a2604
Signed-off-by: Ashish Kori <akori@codeaurora.org>
2021-06-05 14:55:42 +05:30
Vivek Golani
e0ed733924 diag: Handle drops for diag over rpmsg
Handle log drops for modem to apps diag communication over rpmsg.
Changes were made to clear the rpmsg buffers after they are marked
free and delete packets from the rx list only after they are processed.

Change-Id: Iee899640a20f9be0dc8d12428504ad986508ebc2
Signed-off-by: Vivek Golani <vgolani@codeaurora.org>
2021-06-05 14:55:42 +05:30
Jeya R
b2a568fa1b msm: adsprpc: Fix Excessive Logging in Map
Avoided printing the message when map, unmap
and invoke functions when process is not
initialized.

Change-Id: I6ede88abc087c06a77636bfd5041b3e4156a93ca
Acked-by: Krishnaiah Tadakamalla <ktadakam@qti.qualcomm.com>
Signed-off-by: Jeya R <jeyr@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:42 +05:30
Vamsi krishna Gattupalli
3e109749ed msm: adsprpc: Fix deadlock during SSR
Deadlock is happening because map_mutex and smd_mutex lock is
acquired before fastrpc_mmap_remove_ssr() call and inside again
in get_args() and fastrpc_invoke_send() respectively. Added
lock only to critical sections in need.

Change-Id: I900e44790ec0285b7b156542bf599092479dc864
Signed-off-by: Vamsi krishna Gattupalli <vgattupa@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:41 +05:30
Anuj Garg
4dd150e3db msm: adsprpc: Don't create debugfs global file if already exists
The adsprpc driver creates the debugfs global file for each instance
of msm_fastrpc_compute_cb but it fails to create after the first one.
This change will check the existence of the file before it attempts
to create the new one.

Change-Id: I90fa44071a9baeca43213561943ed6830977f82c
Signed-off-by: Anuj Garg <anujgarg@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:41 +05:30
Can Guo
c7b34f96e4 block: pm: Fix possible unbalanced nr_pending
When someone calls blk_get_request() and blk_put_request() without invoking
blk_execute_rq() in between, nr_pending will be unbalanced. Fix this by
adding a flag, namely the RQF_PM_ADDED, to track the usage of nr_pending,
so that blk_pm_put_request() won't touch nr_pending if the flag is not set.
Extra care should be given to blk_pm_requeue_request(), because blk-flush.c
inserts flush requests into queue without calling blk_pm_add_request(), if
the flush requests get requeued by LLD, blk_pm_requeue_request() should
anyways decrease nr_pending in this situation to keep it balanced.

Change-Id: I7baa2049ac532e4fd22a0ce358133ba88266a314
Signed-off-by: Ziqi Chen <ziqichen@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:41 +05:30
Ziqi Chen
c2bc75ede3 scsi: ufs: Fix imbalanced scsi_block_reqs_cnt caused by ufshcd_hold()
The scsi_block_reqs_cnt increased in ufshcd_hold() is supposed to be
decreased back in ufshcd_ungate_work() in a paired way. However, if
specific ufshcd_hold/release sequences are met, it is possible that
scsi_block_reqs_cnt is increased twice but only one ungate work is
queued. To make sure scsi_block_reqs_cnt is handled by ufshcd_hold() and
ufshcd_ungate_work() in a paired way, increase it only if queue_work()
returns true.

Change-Id: I35f870e49cc832bb6f4b58763e3240f05b98ec13
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Ziqi Chen <ziqichen@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:41 +05:30
Ziqi Chen
e91637a36e scsi: ufs: Disable irq before turning off clocks in suspend path
In ufs suspend path we are turning off the clocks first and then
disabling the irq. But in few scenarios link remains in active state
(say rpm_lvl=2) and there is a chance that link can trigger error
interrupts. If interrupt gets triggered after disabling clocks and
before disabling irq, ISR gets invoked and tries to read registers
which can lead to un-clocked access.

To avoid this scenario, disable irq before disabling clocks.

Change-Id: I90f01c06f72cb10920641e82e99177c99b656117
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
Signed-off-by: Ziqi Chen <ziqichen@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:41 +05:30
Can Guo
3879476438 scsi: ufs-qcom: Turn off PHY only if link is not active
Do not assume that AH8 always puts the link to hibern8 state before
turnning off PHY during suspend. Turn off PHY only if link is not
active.

Change-Id: Ia50fdbe95e29e825b40679ba4519b49e2806b67a
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:41 +05:30
laoyi
bb32c75f6c fs: proc: Update perms of process_reclaim node
Other userspace apps like AppCOmpaction would like to use this node,
so update permission.

Change-Id: Ied22bd6ad489bef4028cde943ac185d1354ab971
Signed-off-by: <laoyi@codeaurora.org>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:41 +05:30
John Dias
f1033fb035 fs: Improve eventpoll logging to stop indicting timerfd
timerfd doesn't create any wakelocks; eventpoll can, and is creating the
wakelocks we see called "[timerfd]".  eventpoll creates two kinds of
wakelocks: a single top-level lock associated with the eventpoll fd
itself, and one additional lock for each fd it is polling that needs such
a lock (e.g. those using EPOLLWAKEUP).  Current code names the per-fd
locks using the undecorated names of the fds' associated files (hence
"[timerfd]"), and is naming the top-level lock after the PID of the caller
and the name of the file behind the first fd for which a per-fd lock is
created.  To make things clearer, the top-level lock is now named using
the caller PID and an "epollfd" designation, while the per-fd locks are
also named with the caller's PID (to associate them with the top-level
lock) and their respective fds' file names.

Port of fix already applied to previous 2 generations.  Note that this
set of changes does not fully solve the problem of eventpoll/timerfd
wakelock attribution to the original process, since most activity is
relayed through system_server, but it does at least ensure that different
eventpoll wakelocks - and their stats - are properly disambiguated.

Test: Ran on device and observed new wakelock naming in
/d/wakeup_sources and (file naming in) lsof output.
Bug: 116363986
Change-Id: I34bada5ddab04cf3830762c745f46bfcd1549cb8
Signed-off-by: John Dias <joaodias@google.com>
Signed-off-by: Kelly Rossmoyer <krossmo@google.com>
Signed-off-by: Miguel de Dios <migueldedios@google.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:41 +05:30
Sultan Alsawaf
94598231de bpf: Eliminate CONFIG_MODULES limitation from JIT for arm64
CONFIG_MODULES is only needed for its memory allocator, which is trivial
to add back into arm64 when modules aren't enabled. Do so in order to
take advantage of JIT compilation when CONFIG_MODULES=n.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2021-06-05 14:55:40 +05:30
Adithya R
1cd596b249 Merge tag 'LA.UM.9.1.r1-10200-SMxxx0.0' of https://source.codeaurora.org/quic/la/platform/vendor/opensource/audio-kernel into staging/LA.UM.9.x
"LA.UM.9.1.r1-10200-SMxxx0.0"
2021-06-05 14:54:16 +05:30
Adithya R
e3f73a5a8d Merge tag 'LA.UM.9.1.r1-10200-SMxxx0.0' of https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/wlan/qca-wifi-host-cmn into staging/LA.UM.9.x
"LA.UM.9.1.r1-10200-SMxxx0.0"
2021-06-05 14:41:40 +05:30
Adithya R
bbd4ca491c Merge tag 'LA.UM.9.1.r1-10200-SMxxx0.0' of https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/wlan/qcacld-3.0 into staging/LA.UM.9.x
"LA.UM.9.1.r1-10200-SMxxx0.0"
2021-06-05 14:40:33 +05:30
Adithya R
4ad4df234e Merge tag 'LA.UM.9.1.r1-10200-SMxxx0.0' of https://source.codeaurora.org/quic/la/kernel/msm-4.14 into staging/LA.UM.9.x
"LA.UM.9.1.r1-10200-SMxxx0.0"
2021-06-05 14:39:57 +05:30
Adithya R
9ea5ae0229 drm/msm: dsi_display: Prevent GPU boosting with battery saver
refer 3db0705104385b945dfa6f475c60d00b38b082db
2021-06-04 13:34:58 +05:30
Adithya R
fa86a4a095 Revert "ARM64/configs: surya: Disable RELR relocations"
This reverts commit a90526691613bc755d985c3fcc32081ff496f6a2.
2021-06-04 13:01:58 +05:30
FlyFrog
3c2d7070a3 lib: int_sqrt: Improve 3x faster integer sqrt.
Result on 10,000,000 call.
Old:
sqrt(12345689) = 3513
real	0m0.768s
user	0m0.760s
sys	0m0.004s

New:
sqrt(12345689) = 3513
real	0m0.222s
user	0m0.224s
sys	0m0.000s

Signed-off-by: Vaisakh Murali <mvaisakh@statixos.com>
2021-06-01 17:06:34 +05:30
Mohammed Nayeem Ur Rahman
b5d4c7f447 char: adsprpc: Set QoS only to silver cluster
Glink IRQ mostly is taken by the silver cluster. RPC driver vote
for sliver cluster prevents collapsing gold cluster. This saves
significant power.

Change-Id: Ic24bddceb7ae37d1182d2fca683c622b4ab71a55
Acked-by: Tadakamalla Krishnaiah <ktadakam@qti.qualcomm.com>
Signed-off-by: Mohammed Nayeem Ur Rahman <mohara@codeaurora.org>
Signed-off-by: celtare21 <celtare21@gmail.com
2021-06-01 17:06:32 +05:30
Vaisakh Murali
7a6332d901 msm: ipa: Only include emulation init with CONFIG_IPA_EMULATION
* Native code doesn't seem to have any use for this.

Change-Id: I59b33af3a67b5b5a7f4b42dbffa6f41f21aae567
Signed-off-by: Vaisakh Murali <mvaisakh@statixos.com>
2021-06-01 17:06:32 +05:30
Linux Build Service Account
d2fd228796 Merge 516a0a6251f23be4dc7136a996b762d586423079 on remote branch
Change-Id: Ie0361b7309d4b15904757569ecd7b461f12d1825
2021-05-27 10:46:33 -07:00
Linux Build Service Account
857bd2e080 Merge f8526eed1d13bee359929006ea9f3f7f0fe26438 on remote branch
Change-Id: I49addd030b5fdc3586d37dda20b25956097b7d0f
2021-05-27 10:44:41 -07:00
Linux Build Service Account
c0206fbd70 Merge 407d2eafc7aca94bb28098710cbc48555c3dfb55 on remote branch
Change-Id: I4f0901a343384e33bcda53a96231e7522ed18e1d
2021-05-27 10:44:34 -07:00
Linux Build Service Account
9838220d29 Merge 42140f1656cd1a6b073540039d116f7c2f6f78f5 on remote branch
Change-Id: I69f41511ff63fc6651655f1bd832ab5c3cd0a665
2021-05-27 10:40:20 -07:00
Adithya R
8207e6c43c build.sh: Switch to transfer.sh for zip upload 2021-05-25 19:26:37 +05:30
Adithya R
18b2b5faa4 ARM64/configs: surya: Enable fuse short circuit 2021-05-25 19:26:37 +05:30
Adhitya Mohan
8a4166ccd4 fs/fuse: shortcircuit: Make it compile 2021-05-25 19:26:37 +05:30
LibXZR
0f1df8b6c0 fs/fuse: shortcircuit: Disable logging 2021-05-25 19:26:37 +05:30
LibXZR
a650eef6fc fs: fuse: Implement fuse short circuit
* This significantly improves i/o performance under /sdcard
* From OnePlus 8T Oxygen OS 11.0.8.11.KB05AA and OnePlus 8 Oxygen OS 11.0.5.5.IN21AA and OnePlus 8 Pro Oxygen OS 11.0.5.5.IN11AA

RealJohnGalt: make proper Kconfig, add back dependencies from OnePlus
source onto our CAF tree.

Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-05-25 19:26:37 +05:30
Theodore Ts'o
b8328115cd ext4: Improve smp scalability for inode generation
->s_next_generation is protected by s_next_gen_lock but its usage
pattern is very primitive.  We don't actually need sequentially
increasing new generation numbers, so let's use prandom_u32() instead.

Reported-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: kdrag0n <dragon@khronodragon.com>
2021-05-25 19:26:37 +05:30
Vincent Guittot
9f4d369621 sched/fair: Fix unthrottle_cfs_rq() for leaf_cfs_rq list
Although not exactly identical, unthrottle_cfs_rq() and enqueue_task_fair()
are quite close and follow the same sequence for enqueuing an entity in the
cfs hierarchy. Modify unthrottle_cfs_rq() to use the same pattern as
enqueue_task_fair(). This fixes a problem already faced with the latter and
add an optimization in the last for_each_sched_entity loop.

Fixes: fe61468b2cb (sched/fair: Fix enqueue_task_fair warning)
Reported-by Tao Zhou <zohooouoto@zoho.com.cn>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Phil Auld <pauld@redhat.com>
Reviewed-by: Ben Segall <bsegall@google.com>
Link: https://lkml.kernel.org/r/20200513135528.4742-1-vincent.guittot@linaro.org
2021-05-25 19:26:37 +05:30
Muchun Song
1bbdcf23b4 sched/fair: Mark sched_init_granularity __init
Function sched_init_granularity() is only called from __init
functions, so mark it __init as well.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://lkml.kernel.org/r/20200406074750.56533-1-songmuchun@bytedance.com
2021-05-25 19:26:37 +05:30
Huaixin Chang
0951f4d996 sched/fair: Refill bandwidth before scaling
In order to prevent possible hardlockup of sched_cfs_period_timer()
loop, loop count is introduced to denote whether to scale quota and
period or not. However, scale is done between forwarding period timer
and refilling cfs bandwidth runtime, which means that period timer is
forwarded with old "period" while runtime is refilled with scaled
"quota".

Move do_sched_cfs_period_timer() before scaling to solve this.

Fixes: 2e8e19226398 ("sched/fair: Limit sched_cfs_period_timer() loop to avoid hard lockup")
Signed-off-by: Huaixin Chang <changhuaixin@linux.alibaba.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ben Segall <bsegall@google.com>
Reviewed-by: Phil Auld <pauld@redhat.com>
Link: https://lkml.kernel.org/r/20200420024421.22442-3-changhuaixin@linux.alibaba.com
2021-05-25 19:26:37 +05:30
Peng Wang
aa3d11385a sched/fair: Simplify the code of should_we_balance()
We only consider group_balance_cpu() after there is no idle
cpu. So, just do comparison before return at these two cases.

Signed-off-by: Peng Wang <rocking@linux.alibaba.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/245c792f0e580b3ca342ad61257f4c066ee0f84f.1586594833.git.rocking@linux.alibaba.com
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-05-25 19:26:37 +05:30
Paul Turner
24619225af sched/fair: Eliminate bandwidth race between throttling and distribution
There is a race window in which an entity begins throttling before quota
is added to the pool, but does not finish throttling until after we have
finished with distribute_cfs_runtime(). This entity is not observed by
distribute_cfs_runtime() because it was not on the throttled list at the
time that distribution was running. This race manifests as rare
period-length statlls for such entities.

Rather than heavy-weight the synchronization with the progress of
distribution, we can fix this by aborting throttling if bandwidth has
become available. Otherwise, we immediately add the entity to the
throttled list so that it can be observed by a subsequent distribution.

Additionally, we can remove the case of adding the throttled entity to
the head of the throttled list, and simply always add to the tail.
Thanks to 26a8b12747c97, distribute_cfs_runtime() no longer holds onto
its own pool of runtime. This means that if we do hit the !assign and
distribute_running case, we know that distribution is about to end.

Signed-off-by: Paul Turner <pjt@google.com>
Signed-off-by: Ben Segall <bsegall@google.com>
Signed-off-by: Josh Don <joshdon@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Phil Auld <pauld@redhat.com>
Link: https://lkml.kernel.org/r/20200410225208.109717-2-joshdon@google.com
2021-05-25 19:26:36 +05:30
Peter Zijlstra
77c9280087 sched,rt: Use cpumask_any*_distribute()
Replace a bunch of cpumask_any*() instances with
cpumask_any*_distribute(), by injecting this little bit of random in
cpu selection, we reduce the chance two competing balance operations
working off the same lowest_mask pick the same CPU.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Reviewed-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Link: https://lkml.kernel.org/r/20201023102347.190759694@infradead.org
2021-05-25 19:26:36 +05:30
Paul Turner
3155932a9e sched/core: Distribute tasks within affinity masks
Currently, when updating the affinity of tasks via either cpusets.cpus,
or, sched_setaffinity(); tasks not currently running within the newly
specified mask will be arbitrarily assigned to the first CPU within the
mask.

This (particularly in the case that we are restricting masks) can
result in many tasks being assigned to the first CPUs of their new
masks.

This:
 1) Can induce scheduling delays while the load-balancer has a chance to
    spread them between their new CPUs.
 2) Can antogonize a poor load-balancer behavior where it has a
    difficult time recognizing that a cross-socket imbalance has been
    forced by an affinity mask.

This change adds a new cpumask interface to allow iterated calls to
distribute within the intersection of the provided masks.

The cases that this mainly affects are:
 - modifying cpuset.cpus
 - when tasks join a cpuset
 - when modifying a task's affinity via sched_setaffinity(2)

Signed-off-by: Paul Turner <pjt@google.com>
Signed-off-by: Josh Don <joshdon@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Qais Yousef <qais.yousef@arm.com>
Tested-by: Qais Yousef <qais.yousef@arm.com>
Link: https://lkml.kernel.org/r/20200311010113.136465-1-joshdon@google.com
2021-05-25 19:26:36 +05:30
Peter Zijlstra
171dc61962 sched: core: Fix balance_callback()
The intent of balance_callback() has always been to delay executing
balancing operations until the end of the current rq->lock section.
This is because balance operations must often drop rq->lock, and that
isn't safe in general.

However, as noted by Scott, there were a few holes in that scheme;
balance_callback() was called after rq->lock was dropped, which means
another CPU can interleave and touch the callback list.

Rework code to call the balance callbacks before dropping rq->lock
where possible, and otherwise splice the balance list onto a local
stack.

This guarantees that the balance list must be empty when we take
rq->lock. IOW, we'll only ever run our own balance callbacks.

Reported-by: Scott Wood <swood@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Reviewed-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Link: https://lkml.kernel.org/r/20201023102346.203901269@infradead.org
2021-05-25 19:26:36 +05:30
Vincent Guittot
957309028f sched/fair: Optimize update_blocked_averages()
commit 31bc6aeaab1d1de8959b67edbed5c7a4b3cdbe7c upstream.

Removing a cfs_rq from rq->leaf_cfs_rq_list can break the parent/child
ordering of the list when it will be added back. In order to remove an
empty and fully decayed cfs_rq, we must remove its children too, so they
will be added back in the right order next time.

With a normal decay of PELT, a parent will be empty and fully decayed
if all children are empty and fully decayed too. In such a case, we just
have to ensure that the whole branch will be added when a new task is
enqueued. This is default behavior since :

  commit f6783319737f ("sched/fair: Fix insertion in rq->leaf_cfs_rq_list")

In case of throttling, the PELT of throttled cfs_rq will not be updated
whereas the parent will. This breaks the assumption made above unless we
remove the children of a cfs_rq that is throttled. Then, they will be
added back when unthrottled and a sched_entity will be enqueued.

As throttled cfs_rq are now removed from the list, we can remove the
associated test in update_blocked_averages().

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: sargun@sargun.me
Cc: tj@kernel.org
Cc: xiexiuqi@huawei.com
Cc: xiezhipeng1@huawei.com
Link: https://lkml.kernel.org/r/1549469662-13614-2-git-send-email-vincent.guittot@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Vishnu Rangayyan <vishnu.rangayyan@apple.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-25 19:26:36 +05:30
Vincent Guittot
1c5a28a2b9 sched/fair: Move the rq_of() helper function
Move rq_of() helper function so it can be used in pelt.c

[ mingo: Improve readability while at it. ]

Bug: 120440300
Change-Id: I2133979476631d68baaffcaa308f4cdab94f22b1
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Morten.Rasmussen@arm.com
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bsegall@google.com
Cc: dietmar.eggemann@arm.com
Cc: patrick.bellasi@arm.com
Cc: pjt@google.com
Cc: pkondeti@codeaurora.org
Cc: quentin.perret@arm.com
Cc: rjw@rjwysocki.net
Cc: srinivas.pandruvada@linux.intel.com
Cc: thara.gopinath@linaro.org
Link: https://lkml.kernel.org/r/1548257214-13745-2-git-send-email-vincent.guittot@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 62478d9911fab9694c195f0ca8e4701de09be98e)
Signed-off-by: Quentin Perret <quentin.perret@arm.com>
Signed-off-by: DennySPB <dennyspb@gmail.com>
2021-05-25 19:26:36 +05:30
Srikar Dronamraju
c40b2cdda2 BACKPORT: sched/fair: Optimize select_idle_core()
Currently we loop through all threads of a core to evaluate if the core is
idle or not. This is unnecessary. If a thread of a core is not idle, skip
evaluating other threads of a core. Also while clearing the cpumask, bits
of all CPUs of a core can be cleared in one-shot.

Collecting ticks on a Power 9 SMT 8 system around select_idle_core
while running schbench shows us

(units are in ticks, hence lesser is better)
Without patch
    N        Min     Max     Median         Avg      Stddev
x 130        151    1083        284   322.72308   144.41494

With patch
    N        Min     Max     Median         Avg      Stddev   Improvement
x 164         88     610        201   225.79268   106.78943        30.03%

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Link: https://lkml.kernel.org/r/20191206172422.6578-1-srikar@linux.vnet.ibm.com
Signed-off-by: DennySPB <dennyspb@gmail.com>
2021-05-25 19:26:36 +05:30
bsegall@google.com
282c967bd3 sched/fair: Don't push cfs_bandwith slack timers forward
When a cfs_rq sleeps and returns its quota, we delay for 5ms before
waking any throttled cfs_rqs to coalesce with other cfs_rqs going to
sleep, as this has to be done outside of the rq lock we hold.

The current code waits for 5ms without any sleeps, instead of waiting
for 5ms from the first sleep, which can delay the unthrottle more than
we want. Switch this around so that we can't push this forward forever.

This requires an extra flag rather than using hrtimer_active, since we
need to start a new timer if the current one is in the process of
finishing.

Signed-off-by: Ben Segall <bsegall@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Xunlei Pang <xlpang@linux.alibaba.com>
Acked-by: Phil Auld <pauld@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/xm26a7euy6iq.fsf_-_@bsegall-linux.svl.corp.google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: DennySPB <dennyspb@gmail.com>
2021-05-25 19:26:36 +05:30
Vincent Guittot
cc0fe39ac0 sched/fair: Fix runnable_avg for throttled cfs
When a cfs_rq is throttled, its group entity is dequeued and its running
tasks are removed. We must update runnable_avg with the old h_nr_running
and update group_se->runnable_weight with the new h_nr_running at each
level of the hierarchy.

Reviewed-by: Ben Segall <bsegall@google.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Fixes: 9f68395333ad ("sched/pelt: Add a new runnable average signal")
Link: https://lkml.kernel.org/r/20200227154115.8332-1-vincent.guittot@linaro.org
2021-05-25 19:26:36 +05:30