793159 Commits

Author SHA1 Message Date
Adithya R
e62addcfc7 Revert "ASoC: fix valid stream condition"
This reverts commit 0075f99fb42ddcf77c527740fa9503bbad0f98d0.
2021-04-19 23:10:40 +05:30
celtare21
4fe3fbec03 techpack: audio: Remove pm_qos usage
Signed-off-by: celtare21 <celtare21@gmail.com>
2021-04-19 14:32:41 +05:30
Panchajanya1999
014b4c0548 techpack/audio: sm6150: Remove pm_qos usage
Change-Id: I69e6010b20f895faf61951d97e9028c8909bada7
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-19 12:20:20 +05:30
Manaf Meethalavalappu Pallikunhi
b3062743f1 thermal: Ignore spurious BCL interrupts whenever BCL is in polling
Whenever BCL interrupt triggers, it notifies thermal framework.
The framework disables the BCL interrupt and initiates a passive
polling to monitor clear threshold. But BCL peripheral interrupts
are lazy IRQ disable in nature by default. Even if BCL has initiated
disable interrupt, there is a chance it may take some time to disable
in hardware. During this time hardware can trigger interrupt again.
But BCL driver assumes it as spurious interrupt and disables the
interrupt again which will cause permanent disablement of that
interrupt.

If BCL interrupt is triggering again post BCL interrupt
disable, just ignore that interrupt to avoid nested interrupt
disablement. From above scenario, BCL is already in polling mode,
ignoring this spurious interrupt doesn't cause any issue.

Bug: 118493676
Change-Id: Ia77fc66eaf66f97bacee96906cc6a5735a6ed158
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
Signed-off-by: Wei Wang <wvw@google.com>
2021-04-19 12:20:20 +05:30
Wei Wang
798dd77dcb arch_topology: Wire up thermal limit for arch_scale_max_freq_capacity
before patch and "echo 50000 > /sys/class/thermal/tz-by-name/sdm-therm/emul_temp"
com.android.uibench.janktests.UiBenchJankTests#testInvalidateTree: PASSED (02m6.247s)
        gfx-avg-slow-ui-thread: 0.07110321338664297
        gfx-avg-missed-vsync: 0.0
        gfx-avg-high-input-latency: 74.25140826299423
        gfx-max-frame-time-50: 12
        gfx-min-total-frames: 2250
        gfx-avg-frame-time-99: 11.8
        gfx-avg-num-frame-deadline-missed: 1.6
        gfx-avg-frame-time-50: 9.6
        gfx-max-high-input-latency: 99.86666666666667
        gfx-avg-frame-time-90: 11.0
        gfx-avg-frame-time-95: 11.0
        gfx-max-frame-time-95: 13
        gfx-max-frame-time-90: 13
        gfx-max-slow-draw: 0.0
        gfx-max-frame-time-99: 13
        gfx-avg-slow-draw: 0.0
        gfx-max-total-frames: 2251
        gfx-avg-jank: 43.678000000000004
        gfx-max-slow-bitmap-uploads: 0.0
        gfx-max-missed-vsync: 0.0
        gfx-avg-total-frames: 2250
        gfx-max-jank: 96.67
        gfx-max-slow-ui-thread: 0.13333333333333333
        gfx-max-num-frame-deadline-missed: 3
        gfx-avg-slow-bitmap-uploads: 0.0

aefore patch and "echo 50000 > /sys/class/thermal/tz-by-name/sdm-therm/emul_temp"
google/perf/jank/UIBench/UIBench (1 Test)
----------------------------------------
[1/1] com.android.uibench.janktests.UiBenchJankTests#testInvalidateTree: PASSED (02m7.027s)
        gfx-avg-slow-ui-thread: 0.0
        gfx-avg-missed-vsync: 0.0
        gfx-avg-high-input-latency: 11.53777777777778
        gfx-max-frame-time-50: 7
        gfx-min-total-frames: 2250
        gfx-avg-frame-time-99: 8.0
        gfx-avg-num-frame-deadline-missed: 0.0
        gfx-avg-frame-time-50: 7.0
        gfx-max-high-input-latency: 41.15555555555556
        gfx-avg-frame-time-90: 7.2
        gfx-avg-frame-time-95: 7.8
        gfx-max-frame-time-95: 8
        gfx-max-frame-time-90: 8
        gfx-max-slow-draw: 0.0
        gfx-max-frame-time-99: 8
        gfx-avg-slow-draw: 0.0
        gfx-max-total-frames: 2250
        gfx-avg-jank: 0.0
        gfx-max-slow-bitmap-uploads: 0.0
        gfx-max-missed-vsync: 0.0
        gfx-avg-total-frames: 2250
        gfx-max-jank: 0.0
        gfx-max-slow-ui-thread: 0.0
        gfx-max-num-frame-deadline-missed: 0
        gfx-avg-slow-bitmap-uploads: 0.0

Bug: 143162654
Test: use emul_temp to change thermal condition and see capacity changed
Change-Id: Idbf943f9c831c288db40d820682583ade3bbf05e
Signed-off-by: Wei Wang <wvw@google.com>
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-04-19 12:20:20 +05:30
Wei Wang
3542468c19 thermal: core: Skip update disabled thermal zones after suspend
It is unnecessary to update disabled thermal zones post suspend and
sometimes leads error/warning in bad behaved thermal drivers.

Bug: 129435616
Change-Id: If5d3bfe84879779ec1ee024c0cf388ea3b4be2ea
Signed-off-by: Wei Wang <wvw@google.com>
2021-04-19 12:20:20 +05:30
Pzqqt
011f533808 soc: qcom: ssr: Prevent kernel panic caused by modem crash
Just restart the modem if the modem crash,
not worth making the kernel panic.

This solves the problem of kernel panic
after modifying "Lock Bands" in the "Network Signal Guru" application.

Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-19 12:20:20 +05:30
Sultan Alsawaf
89484c9758 mm/slab_common: Align all caches' objects to hardware cachelines
This only increases the memory used by all caches by about 10%, which is
relatively very little for the performance benefit of cacheline
alignment.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2021-04-19 12:20:20 +05:30
Luca Stefani
f36632db5f mkdtboimg: Make filepath search recursive
* On some devices the dtbo could live in different sub-directories
  -> Walk the main dtbdir up to the corresponding filename and
     use it instead

Change-Id: I1ef3100d7925bb8bf67b2ab276a9becd192135d4
2021-04-18 13:41:12 +05:30
Hridya Valsaraju
87e20f3564 mkdtboimg: Make mkdtboimg.py compatible with python3
There are a few changes needed to run mkdtboimg.py with python3.
-No more implicit conversion between char and byte.
-xrange was renamed to range in python3
-floor division must be done with the  '//' operator

Bug: 166496956
Test: ./mkdtboimg_testdata.sh
Test: atest FirmwareDtboVerification
Change-Id: I8b9b97b7b9f31768cc133f37d0144420cb1a0e81
2021-04-18 13:41:12 +05:30
Gah0
2fd8a66545 mkdtboimg: Remove redundant argument on compression_info()
when dump a image will happen compression_info() takes exactly 1 argument (2 given).
compression_info() don't need to pass in parameters

Change-Id: I8656049853d600658189055b45dacdac66b5855d
2021-04-18 13:41:12 +05:30
Subramanian Ananthanarayanan
6b71140fe9 slimbus: slim-msm-ngd: Propagate tip changes from 4.19
Changes are to propagate the tip changes of 4.19 to 4.14 kernel

'commit ba4a167fc0500 ("slim-msm-ngd: Prevent race condition for suspend
and SSR")'.
'commit 51149ab8211ef ("drivers: slimbus: slim-msm-ngd: Set 32 bit DMA
mask")'.
'commit 3beddbd9273ce ("drivers: slimbus: Cleanup unused APIs")'.
'commit 40ba0aea474d4 ("slim-msm-ngd: Add support for slimbus to use
LPASS memory")'.
'commit ffc622c65b578 ("slim-msm-ngd: Add wake lock to avoid race with
suspend and SSR")'.
'commit 1408f5a2ad0d4 ("slim-msm-ngd: Add qmi deferred response check
in pm resume")'.
'commit d4ed06de8689f ("slim-msm-ngd: Depend on PIL driver notification
instead of qmi")'.
'commit a9fed7cf6ffa7 ("slim-msm-ngd: slim-msm-ngd: Prevent system
suspend during initialization")'.
'commit 81706e668fe7e ("slim-msm-ngd: Check current state of sub system
restart notifier")'.

Bug: 151595197
Change-Id: I928366e7e92f5f694a2cf5db58f4a9f62b1472ac
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-18 13:41:12 +05:30
Pranav Vashi
559efe7e7c power: supply: Increase threshold for detecting charge type
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-18 13:41:11 +05:30
Pranav Vashi
33ccc14177 power: supply: Stabilize fluctuation in charging speed
* 35-36 degrees threshold for toggling fast charge mode is bad
   since it is ambient temperature in most places.
   Increased it to 39-40 degrees. 45-46 degrees still remain cutoff threshold.

Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-18 13:41:11 +05:30
Haijian Ma
1159734a3c power: smb5: Rerun APSD to ensure proper charger detection
Rerun APSD to ensure proper charger detection if device
boots with charger connected.

Change-Id: I21c9be0c098b7e7ba388f71e9ba4b90180bfd112
Signed-off-by: Haijian Ma <mahj8@motorola.com>
Reviewed-on: https://gerrit.mot.com/1366956
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
2021-04-18 13:41:08 +05:30
Yaroslav Furman
3526b0a8d2 scsi: ufs: Set IRQ's affinity to CPU1
CPU0 handles most of the IRQs and UFS IRQ is one of the most
frequent ones, however it doesn't directly affect UX so it's
not worth it to move it to perf cluster (we only have 2 big cores).

Let's move it to CPU1 to reduce the load on CPU0 a little.

Signed-off-by: Yaroslav Furman <yaro330@gmail.com>
2021-04-17 20:18:06 +05:30
Shaokun Zhang
630a3cfde8 BACKPORT: cgroup: Remove unused cgrp variable
The 'cgrp' is set but not used in commit <76f969e8948d8>
("cgroup: cgroup v2 freezer").
Remove it to avoid [-Wunused-but-set-variable] warning.

Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Acked-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from 533307dc20a9e84a0687d4ca24aeb669516c0243)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
Change-Id: I6221a975c04f06249a4f8d693852776ae08a8d8e
(cherry picked from commit 16824e5cf17313cbc2f67d4547446ddaa4f05258)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:57 +05:30
Oleg Nesterov
a65c19454c BACKPORT: cgroup: freezer: call cgroup_enter_frozen() with preemption disabled in ptrace_stop()
ptrace_stop() does preempt_enable_no_resched() to avoid the preemption,
but after that cgroup_enter_frozen() does spin_lock/unlock and this adds
another preemption point.

Reported-and-tested-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Fixes: 76f969e8948d ("cgroup: cgroup v2 freezer")
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

Change-Id: Ic53e0f2d6624b0bb90817b0c57060fb7db971348
(cherry picked from commit 937c6b27c73e02cd4114f95f5c37ba2c29fadba1)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit e1d012822232da6109493cefd904b827bbd2adf2)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:57 +05:30
Roman Gushchin
137b98095c BACKPORT: cgroup: freezer: fix frozen state inheritance
If a new child cgroup is created in the frozen cgroup hierarchy
(one or more of ancestor cgroups is frozen), the CGRP_FREEZE cgroup
flag should be set. Otherwise if a process will be attached to the
child cgroup, it won't become frozen.

The problem can be reproduced with the test_cgfreezer_mkdir test.

This is the output before this patch:
  ~/test_freezer
  ok 1 test_cgfreezer_simple
  ok 2 test_cgfreezer_tree
  ok 3 test_cgfreezer_forkbomb
  Cgroup /sys/fs/cgroup/cg_test_mkdir_A/cg_test_mkdir_B isn't frozen
  not ok 4 test_cgfreezer_mkdir
  ok 5 test_cgfreezer_rmdir
  ok 6 test_cgfreezer_migrate
  ok 7 test_cgfreezer_ptrace
  ok 8 test_cgfreezer_stopped
  ok 9 test_cgfreezer_ptraced
  ok 10 test_cgfreezer_vfork

And with this patch:
  ~/test_freezer
  ok 1 test_cgfreezer_simple
  ok 2 test_cgfreezer_tree
  ok 3 test_cgfreezer_forkbomb
  ok 4 test_cgfreezer_mkdir
  ok 5 test_cgfreezer_rmdir
  ok 6 test_cgfreezer_migrate
  ok 7 test_cgfreezer_ptrace
  ok 8 test_cgfreezer_stopped
  ok 9 test_cgfreezer_ptraced
  ok 10 test_cgfreezer_vfork

Reported-by: Mark Crossen <mcrossen@fb.com>
Signed-off-by: Roman Gushchin <guro@fb.com>
Fixes: 76f969e8948d ("cgroup: cgroup v2 freezer")
Cc: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Tejun Heo <tj@kernel.org>

Change-Id: I6ba7b8dec5600e78bb7448f03fd97a9b43838fa0
(cherry picked from commit 97a61369830ab085df5aed0ff9256f35b07d425a)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit c17a8b6b2fd57447790df4eab8ccee7d1ba80648)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:57 +05:30
Roman Gushchin
951f428a8e BACKPORT: signal: unconditionally leave the frozen state in ptrace_stop()
Alex Xu reported a regression in strace, caused by the introduction of
the cgroup v2 freezer. The regression can be reproduced by stracing
the following simple program:

  #include <unistd.h>

  int main() {
      write(1, "a", 1);
      return 0;
  }

An attempt to run strace ./a.out leads to the infinite loop:
  [ pre-main omitted ]
  write(1, "a", 1)                        = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
  write(1, "a", 1)                        = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
  write(1, "a", 1)                        = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
  write(1, "a", 1)                        = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
  write(1, "a", 1)                        = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
  write(1, "a", 1)                        = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
  [ repeats forever ]

The problem occurs because the traced task leaves ptrace_stop()
(and the signal handling loop) with the frozen bit set. So let's
call cgroup_leave_frozen(true) unconditionally after sleeping
in ptrace_stop().

With this patch applied, strace works as expected:
  [ pre-main omitted ]
  write(1, "a", 1)                        = 1
  exit_group(0)                           = ?
  +++ exited with 0 +++

Reported-by: Alex Xu <alex_y_xu@yahoo.ca>
Fixes: 76f969e8948d ("cgroup: cgroup v2 freezer")
Signed-off-by: Roman Gushchin <guro@fb.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Tejun Heo <tj@kernel.org>

Change-Id: If644b15ead36ce13f0c2c3dd57eebe3658e3edf7
(cherry picked from commit 05b289263772b0698589abc47771264a685cd365)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit fa924fde25c4b8ac3a95314b169359a3f193d57e)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:56 +05:30
Roman Gushchin
c58f8e9e29 BACKPORT: cgroup: cgroup v2 freezer
Cgroup v1 implements the freezer controller, which provides an ability
to stop the workload in a cgroup and temporarily free up some
resources (cpu, io, network bandwidth and, potentially, memory)
for some other tasks. Cgroup v2 lacks this functionality.

This patch implements freezer for cgroup v2.

Cgroup v2 freezer tries to put tasks into a state similar to jobctl
stop. This means that tasks can be killed, ptraced (using
PTRACE_SEIZE*), and interrupted. It is possible to attach to
a frozen task, get some information (e.g. read registers) and detach.
It's also possible to migrate a frozen tasks to another cgroup.

This differs cgroup v2 freezer from cgroup v1 freezer, which mostly
tried to imitate the system-wide freezer. However uninterruptible
sleep is fine when all tasks are going to be frozen (hibernation case),
it's not the acceptable state for some subset of the system.

Cgroup v2 freezer is not supporting freezing kthreads.
If a non-root cgroup contains kthread, the cgroup still can be frozen,
but the kthread will remain running, the cgroup will be shown
as non-frozen, and the notification will not be delivered.

* PTRACE_ATTACH is not working because non-fatal signal delivery
is blocked in frozen state.

There are some interface differences between cgroup v1 and cgroup v2
freezer too, which are required to conform the cgroup v2 interface
design principles:
1) There is no separate controller, which has to be turned on:
the functionality is always available and is represented by
cgroup.freeze and cgroup.events cgroup control files.
2) The desired state is defined by the cgroup.freeze control file.
Any hierarchical configuration is allowed.
3) The interface is asynchronous. The actual state is available
using cgroup.events control file ("frozen" field). There are no
dedicated transitional states.
4) It's allowed to make any changes with the cgroup hierarchy
(create new cgroups, remove old cgroups, move tasks between cgroups)
no matter if some cgroups are frozen.

Signed-off-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
No-objection-from-me-by: Oleg Nesterov <oleg@redhat.com>
Cc: kernel-team@fb.com
Change-Id: I3404119678cbcd7410aa56e9334055cee79d02fa
(cherry picked from commit 76f969e8948d82e78e1bc4beb6b9465908e74873)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 666d8913b8f1adef750ae86d9acb74c9cb84c4ef)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:56 +05:30
Roman Gushchin
b6ee94fb40 BACKPORT: cgroup: implement __cgroup_task_count() helper
The helper is identical to the existing cgroup_task_count()
except it doesn't take the css_set_lock by itself, assuming
that the caller does.

Also, move cgroup_task_count() implementation into
kernel/cgroup/cgroup.c, as there is nothing specific to cgroup v1.

Signed-off-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: kernel-team@fb.com
Change-Id: Iaa9085d2375d395a051543d2555389213c2892d6
(cherry picked from commit aade7f9efba098859681f8e88d81a5b44ad09b12)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit b3ae5f18b2caa9068135e6720a9b4a5dfda1e142)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:55 +05:30
Roman Gushchin
6b86b47a42 BACKPORT: cgroup: rename freezer.c into legacy_freezer.c
Freezer.c will contain an implementation of cgroup v2 freezer,
so let's rename the v1 freezer to avoid naming conflicts.

Signed-off-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: kernel-team@fb.com
Change-Id: Ie196fbcca1e0bf46af9200752d8fdf90b97e5a8b
(cherry picked from commit 50943f3e136adfc421f9768d6ae09ba7b83aaefd)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 7d88331535a07a36e9526b24f250f43a8dc436fa)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:55 +05:30
Shakeel Butt
31e787c03c BACKPORT: cgroup: remove extra cgroup_migrate_finish() call
The callers of cgroup_migrate_prepare_dst() correctly call
cgroup_migrate_finish() for success and failure cases both. No need to
call it in cgroup_migrate_prepare_dst() in failure case.

Signed-off-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: I785d7ab70a42b1b79aea9852bb14ba5abefcaa9b
(cherry picked from commit d6e486ee0ef2f99a4069d9186e53dac61b28cb3c)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 4f7bb9d8fc662202bbb835d728e2aa1a55015d16)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:54 +05:30
Al Viro
9caa573dac BACKPORT: cgroup: saner refcounting for cgroup_root
* make the reference from superblock to cgroup_root counting -
do cgroup_put() in cgroup_kill_sb() whether we'd done
percpu_ref_kill() or not; matching grab is done when we allocate
a new root.  That gives the same refcounting rules for all callers
of cgroup_do_mount() - a reference to cgroup_root has been grabbed
by caller and it either is transferred to new superblock or dropped.

* have cgroup_kill_sb() treat an already killed refcount as "just
don't bother killing it, then".

* after successful cgroup_do_mount() have cgroup1_mount() recheck
if we'd raced with mount/umount from somebody else and cgroup_root
got killed.  In that case we drop the superblock and bugger off
with -ERESTARTSYS, same as if we'd found it in the list already
dying.

* don't bother with delayed initialization of refcount - it's
unreliable and not needed.  No need to prevent attempts to bump
the refcount if we find cgroup_root of another mount in progress -
sget will reuse an existing superblock just fine and if the
other sb manages to die before we get there, we'll catch
that immediately after cgroup_do_mount().

* don't bother with kernfs_pin_sb() - no need for doing that
either.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Change-Id: I8e088dfc516b76c42d9d4b34db7f49f0cebc5414
(cherry picked from commit 35ac1184244f1329783e1d897f74926d8bb1103a)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 492eddfab04e41872f549aa92e883275da9d6a4c)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:54 +05:30
Tejun Heo
d9cb3aeae9 BACKPORT: cgroup: Add named hierarchy disabling to cgroup_no_v1 boot param
It can be useful to inhibit all cgroup1 hierarchies especially during
transition and for debugging.  cgroup_no_v1 can block hierarchies with
controllers which leaves out the named hierarchies.  Expand it to
cover the named hierarchies so that "cgroup_no_v1=all,named" disables
all cgroup1 hierarchies.

Signed-off-by: Tejun Heo <tj@kernel.org>
Suggested-by: Marcin Pawlowski <mpawlowski@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: Ibd093dd9b70d15402a21db3c1ef56005ebc7f99e
(cherry picked from commit 3fc9c12d27b4ded4f1f761a800558dab2e6bbac5)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit eecbbe1429334e1a6884121831e2dad2a17c6248)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:53 +05:30
Yangtao Li
ad796ea2c4 BACKPORT: cgroup: remove unnecessary unlikely()
WARN_ON() already contains an unlikely(), so it's not necessary to use
unlikely.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: I092c0aae2a06b13d3fc9ecfbb24ab3e8d10235f6
(cherry picked from commit 4d9ebbe2b061a9c25e12ba8539ba172533132eb6)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 8559142778afbd714e6afd18a25da823d6d88403)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:52 +05:30
Andrey Ignatov
0226651ff4 BACKPORT: cgroup: Simplify cgroup_ancestor
Simplify cgroup_ancestor function. This is follow-up for
commit 7723628101aa ("bpf: Introduce bpf_skb_ancestor_cgroup_id helper")

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrey Ignatov <rdna@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: I9e96704713f34fbc68e92b9f91c01b593708220f
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 808c43b7c7f70360ed7b9e43e2cf980f388e71fa)
This cherry pick differs from the original in that cgroup_ancestor is added
in place of being just modified. The patch originally introducing the
function was 7723628101aae (bpf: Introduce bpf_skb_ancestor_cgroup_id
helper) which also relied on bpf dependencies not present in
android-4.14. cgroup_ancestor is independent from the bpf_skb code and
can hence be taken alone
(cherry picked from commit 22fe07d3a8cc54d4ade52a46776afbb9fbd13eee)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:52 +05:30
Tejun Heo
0aea305780 BACKPORT: cgroup: Explicitly remove core interface files
The "cgroup." core interface files bypass the usual interface removal
path and get removed recursively along with the cgroup itself.  While
this works now, the subtle discrepancy gets in the way of implementing
common mechanisms.

This patch updates cgroup core interface file handling so that it's
consistent with controller interface files.  When added, the css is
marked CSS_VISIBLE and they're explicitly removed before the cgroup is
destroyed.

This doesn't cause user-visible behavior changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: I4091581388cb1514171d6de8fdac5f0fe6ae1695
(cherry picked from commit 5faaf05f2976fd9ec0ecd582bcfb3a41cde4c65e)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 1c95325d9b62e843a2bfca3a8a3b5d7b11deebb1)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:51 +05:30
Matt Roper
ea1587274f BACKPORT: cgroup: Update documentation reference
The cgroup_subsys structure references a documentation file that has been
renamed after the v1/v2 split.  Since the v2 documentation doesn't
currently contain any information on kernel interfaces for controllers,
point the user to the v1 docs.

Cc: Tejun Heo <tj@kernel.org>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: I81c2866f6a192547e373279911b37d304ba22d1a
(cherry picked from commit 392536b731cfe82eea414f4b09c128ef37cd477e)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 6dbce050b4c5f14ba62571527474a9aa18f4173d)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:51 +05:30
Roman Gushchin
fdbe1121c2 BACKPORT: cgroup: make cgroup.threads delegatable
Make cgroup.threads file delegatable.
The behavior of cgroup.threads should follow the behavior of cgroup.procs.

Signed-off-by: Roman Gushchin <guro@fb.com>
Discovered-by: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: I82d23cd511122e5a75b23b26e03ccc9e43b171e5
(cherry picked from commit 4f58424da3deead2605e39a9df65f5f06107a3cb)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 2823470a35ea6af77b8c3da6ef7d218720a3e426)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:51 +05:30
Tejun Heo
4f9ba6d1d0 BACKPORT: string: drop __must_check from strscpy() and restore strscpy() usages in cgroup
e7fd37ba1217 ("cgroup: avoid copying strings longer than the buffers")
converted possibly unsafe strncpy() usages in cgroup to strscpy().
However, although the callsites are completely fine with truncated
copied, because strscpy() is marked __must_check, it led to the
following warnings.

  kernel/cgroup/cgroup.c: In function ‘cgroup_file_name’:
  kernel/cgroup/cgroup.c:1400:10: warning: ignoring return value of ‘strscpy’, declared with attribute warn_unused_result [-Wunused-result]
     strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
	       ^

To avoid the warnings, 50034ed49645 ("cgroup: use strlcpy() instead of
strscpy() to avoid spurious warning") switched them to strlcpy().

strlcpy() is worse than strlcpy() because it unconditionally runs
strlen() on the source string, and the only reason we switched to
strlcpy() here was because it was lacking __must_check, which doesn't
reflect any material differences between the two function.  It's just
that someone added __must_check to strscpy() and not to strlcpy().

These basic string copy operations are used in variety of ways, and
one of not-so-uncommon use cases is safely handling truncated copies,
where the caller naturally doesn't care about the return value.  The
__must_check doesn't match the actual use cases and forces users to
opt for inferior variants which lack __must_check by happenstance or
spread ugly (void) casts.

Remove __must_check from strscpy() and restore strscpy() usages in
cgroup.

Signed-off-by: Tejun Heo <tj@kernel.org>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
(cherry picked from commit 08a77676f9c5fc69a681ccd2cd8140e65dcb26c7)
[backport the cgroup portions that weren't applied with the earlier
patch
779128d80cb01e6434936e13754fc25a1cc30929 'string: drop __must_check from
strscpy() and restore strscpy() usages in cgroup']
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
Change-Id: Iaa636d39d15c44be47fc6b6ba202ecb7ff73c5e7
(cherry picked from commit 0b9e380c2246e105f27816258f030bebdabb598c)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:50 +05:30
Arnd Bergmann
347f76913c BACKPORT: cgroup: use strlcpy() instead of strscpy() to avoid spurious warning
As long as cft->name is guaranteed to be NUL-terminated, using strlcpy() would
work just as well and avoid that warning, so the change below could be folded
into that commit.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: I8215beea12d94fda6a7834f8be6f8e0891285d0e
(cherry picked from commit 50034ed49645463a16327cad05694e201e6b4126)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit f6a58f922163cba0a99c1588b094f127982e87af)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:50 +05:30
Ma Shimiao
e854f5e563 BACKPORT: cgroup: avoid copying strings longer than the buffers
cgroup root name and file name have max length limit, we should
avoid copying longer name than that to the name.

tj: minor update to $SUBJ.

Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: Iff4f30be79184f19d9f3ec253bbab9c4ad91f36c
(cherry picked from commit e7fd37ba12170cc414be8b639dfc2c5f7172fac2)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit d4440591421eeda5d5dae5d36883513b7a28f35a)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:49 +05:30
Roman Gushchin
8cffb625f8 BACKPORT: cgroup: export list of cgroups v2 features using sysfs
The active development of cgroups v2 sometimes leads to a creation
of interfaces, which are not turned on by default (to provide
backward compatibility). It's handy to know from userspace, which
cgroup v2 features are supported without calculating it based
on the kernel version. So, let's export the list of such features
using /sys/kernel/cgroup/features pseudo-file.

The list is hardcoded and has to be extended when new functionality
is added. Each feature is printed on a new line.

Example:
  $ cat /sys/kernel/cgroup/features
  nsdelegate

Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: kernel-team@fb.com
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: I2baf0b7bcc27491568772defc43a06d0a5ed46bf
(cherry picked from commit 5f2e673405b742be64e7c3604ed4ed3ac14f35ce)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit 0007e6331622a80da8c02653b6319bdc08518910)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:49 +05:30
Roman Gushchin
17d4688763 BACKPORT: cgroup: export list of delegatable control files using sysfs
Delegatable cgroup v2 control files may require special handling
(e.g. chowning), and the exact list of such files varies between
kernel versions (and likely to be extended in the future).

To guarantee correctness of this list and simplify the life
of userspace (systemd, first of all), let's export the list
via /sys/kernel/cgroup/delegate pseudo-file.

Format is siple: each control file name is printed on a new line.
Example:
  $ cat /sys/kernel/cgroup/delegate
  cgroup.procs
  cgroup.subtree_control

Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: kernel-team@fb.com
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: I9d3143ecbae9d7579d2b1e6ccf381190ef5d3255
(cherry picked from commit 01ee6cfb1483fe57c9cbd8e73817dfbf9bacffd3)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit ac2c0193a454c36919c3b4b952aa9f0e6362ba69)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:48 +05:30
Tejun Heo
067f80ff8c BACKPORT: cgroup: statically initialize init_css_set->dfl_cgrp
Like other csets, init_css_set's dfl_cgrp is initialized when the cset
gets linked.  init_css_set gets linked in cgroup_init().  This has
been fine till now but the recently added basic CPU usage accounting
may end up accessing dfl_cgrp of init before cgroup_init() leading to
the following oops.

  SELinux:  Initializing.
  BUG: unable to handle kernel NULL pointer dereference at 00000000000000b0
  IP: account_system_index_time+0x60/0x90
  PGD 0 P4D 0
  Oops: 0000 [#1] SMP
  Modules linked in:
  CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-rc2-00003-g041cd64 #10
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
  +1.9.3-20161025_171302-gandalf 04/01/2014
  task: ffffffff81e10480 task.stack: ffffffff81e00000
  RIP: 0010:account_system_index_time+0x60/0x90
  RSP: 0000:ffff880011e03cb8 EFLAGS: 00010002
  RAX: ffffffff81ef8800 RBX: ffffffff81e10480 RCX: 0000000000000003
  RDX: 0000000000000000 RSI: 00000000000f4240 RDI: 0000000000000000
  RBP: ffff880011e03cc0 R08: 0000000000010000 R09: 0000000000000000
  R10: 0000000000000020 R11: 0000003b9aca0000 R12: 000000000001c100
  R13: 0000000000000000 R14: ffffffff81e10480 R15: ffffffff81e03cd8
  FS:  0000000000000000(0000) GS:ffff880011e00000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 00000000000000b0 CR3: 0000000001e09000 CR4: 00000000000006b0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
   <IRQ>
   account_system_time+0x45/0x60
   account_process_tick+0x5a/0x140
   update_process_times+0x22/0x60
   tick_periodic+0x2b/0x90
   tick_handle_periodic+0x25/0x70
   timer_interrupt+0x15/0x20
   __handle_irq_event_percpu+0x7e/0x1b0
   handle_irq_event_percpu+0x23/0x60
   handle_irq_event+0x42/0x70
   handle_level_irq+0x83/0x100
   handle_irq+0x6f/0x110
   do_IRQ+0x46/0xd0
   common_interrupt+0x9d/0x9d

Fix it by statically initializing init_css_set.dfl_cgrp so that init's
default cgroup is accessible from the get-go.

Fixes: 041cd640b2f3 ("cgroup: Implement cgroup2 basic CPU usage accounting")
Reported-by: “kbuild-all@01.org” <kbuild-all@01.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Change-Id: Ia754e3d34561ff09db126712e1a40d993b28f5d9
(cherry picked from commit 38683148828165ea0b66ace93a9fedc2d3281e27)
Bug: 154548692
Signed-off-by: Marco Ballesio <balejs@google.com>
(cherry picked from commit aaee653e4a773e3e6533493509aa7aff73fbd17d)
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-17 19:08:48 +05:30
Adithya R
cc444c474f ARM64/configs: surya: Enable dynamic schedtune boost 2021-04-15 11:10:38 +05:30
Josh Choo
b6fb20fd15 cpu-boost: Create separate tunable for Dynamic Schedtune Boost duration
Tunable: /sys/module/cpu_boost/parameters/dynamic_stune_boost_ms

Also run the Schedtune unboost in a separate function.

[ghostrider-reborn]
- Adapted for powerkey boost and changes from TheCrazyLex

Signed-off-by: RenderBroken <zkennedy87@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-15 11:10:38 +05:30
joshuous
641981457b cpu-boost: Update functions for newer Dynamic Schedtune Boost changes
We now need to pass the functions a boost slot argument.

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-15 11:10:36 +05:30
joshuous
0ab83d686b cpu-boost: Reset Dynamic SchedTune Boost only if it is currently active
We need to ensure that every do_stune_boost() that is called is met by
the same number of reset_stune_boost() so that the stune_boost_count is
managed correctly.

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-15 11:09:53 +05:30
joshuous
daf7ff61b4 cpu-boost: Implement Dynamic SchedTune Boost v3
Dynamic SchedTune Boost occurs on-the-fly during interactions, such
as touch input. This idea was conceived because of an existing battery
drain issue whereby setting a permanent schedtune boost would cause
boosting to occur even when the phone was idling. For example, if a user
sets the /dev/stune/top-app/schedtune.boost to 10, the device may not
idle at the lowest frequency step, which can lead to higher idle and
active drain rates. Thus it should consume less power to boost only
during interactions.

v1 worked by changing the value returned by schedtune_cpu_boost(), but
did not change the true boost value of the top-app cgroup. In comparison,
v2 modifies the value in /dev/stune/top-app/schedtune.boost directly.
v3 reworks the entire Dynamic SchedTune Boost code and improves detection
of top-app or any other SchedTune group.

The tunable can be found in /sys/module/cpu_boost/parameters/dynamic_stune_boost.

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2021-04-15 11:09:08 +05:30
RenderBroken
482a18b15d sched/boost: Perform SchedTune boosting when sched_boost is triggered
Boost top-app SchedTune tasks using the dynamic_boost value when
/proc/sys/kernel/sched_boost is activated. This is usually triggered by
CAF's perf daemon.

Signed-off-by: RenderBroken <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
2021-04-15 10:51:17 +05:30
joshuous
19586a6e11 sched/tune: Switch Dynamic Schedtune Boost to a slot-based tracking system
Switch from a counter-based system to a slot-based system for managing
multiple dynamic Schedtune boost requests.

The primary limitations of the counter-based system was that it could
only keep track of two boost values at a time: the current dynamic boost
value and the default boost value. When more than one boost request is
issued, the system would only remember the highest value of them all.
Even if the task that requested the highest value had unboosted, this
value is still maintained as long as there are other active boosts that
are still running. A more ideal outcome would be for the system to
unboost to the maximum boost value of the remaining active boosts.

The slot-based system provides a solution to the problem by keeping
track of the boost values of all ongoing active boosts. It ensures that
the current boost value will be equal to the maximum boost value of
all ongoing active boosts. This is achieved with two linked lists
(active_boost_slots and available_boost_slots), which assign and keep
track of boost slot numbers for each successful boost request. The boost
value of each request is stored in an array (slot_boost[]), at an index
value equal to the assigned boost slot number.

For now we limit the number of active boost slots to 5 per Schedtune
group.

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
2021-04-15 10:51:17 +05:30
joshuous
b5f321bf06 sched/stune: Rename stune_boost() to do_stune_sched_boost()
To reflect that the function is to be used mainly with CAF's devices
that have sched_boost. However, developers may use it as a switch to
dynamically boost schedtune to the values specified in
/dev/stune/*/schedtune.sched_boost.

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
2021-04-15 10:51:17 +05:30
joshuous
6a133fed81 sched/tune: Rename dynamic_boost parameter to sched_boost
This was confusing to deal with given that it had the same name as the
Dynamic Schedtune Boost framework. It will be more apt to call it
sched_boost given that it was created to work with the sched_boost
feature in CAF devices.

The new tunable can be found in /dev/stune/*/schedtune.sched_boost

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
2021-04-15 10:51:16 +05:30
joshuous
885e97b453 sched/tune: Track active boosts on a per-Schedtune basis
It does not make sense to be unable to reset Schedtune boost for a
particular Schedtune group if another Schedtune group's boost is still
active. Instead of using a global count, we should use a per-Schedtune
group count to keep track of active boosts taking place.

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
2021-04-15 10:51:16 +05:30
joshuous
ed2dbdb64c sched/tune: Reset Dynamic Schedtune Boost only if no more boosts running
We will need to take care to ensure that every do_stune_boost() we call
is followed eventually by a reset_stune_boost() so that
stune_boost_count is managed correctly.

This allows us to stack several Dynamic Schedtune Boosts and reset only
when all Dynamic Schedtune Boosts have been disengaged.

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
2021-04-15 10:51:16 +05:30
joshuous
5f6a7de24c sched/tune: Introduce stune_boost() function
Add a simple function to activate Dynamic Schedtune Boost and use the
dynamic_boost value of the SchedTune CGroup.

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
2021-04-15 10:51:16 +05:30
joshuous
14da12bbdf sched/tune: Refactor do_stune_boost()
For added flexibility and in preparation for introducing another function.

Signed-off-by: joshuous <joshuous@gmail.com>
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: celtare21 <celtare21@gmail.com>
2021-04-15 10:51:15 +05:30