# Customize for performance tuning

Customization is a process that includes fine-tuning various aspects of
the system, which can significantly affect the overall performance and
power of the system.

The CPU scheduler, CPU frequency governor, dynamic voltage and frequency scaling (DVFS) governor, perflock, and memory can be fine-tuned. It's recommended to undertake any tuning only after gaining a thorough understanding through extensive performance and
power analysis.

Caution

Any customization can impact the power and the performance of the device.
Therefore, it's crucial to verify the impact across all the relevant
use cases before performing any customization.

## Customize CPU scheduler

You can customize features of the CPU scheduler, such as utilization clamping (UCLAMP or util clamp) schedulers.

For more information, see [CPU scheduler](https://docs.qualcomm.com/doc/80-70020-10/topic/2-performance-features.html#cpu-scheduler).

### UCLAMP

UCLAMP is a scheduler feature that allows user space to manage the task
performance requirements.

It's a hinting mechanism that helps the scheduler understand the
performance demands and limitations of tasks, as a result, it assists
the scheduler in making informed decisions.

When the `schedutil` CPU frequency governor is used, UCLAMP determines
the CPU frequency selection. The UCLAMP value ranges from 0 to 1024.

The following parameters can be customized for UCLAMP:

- `sched_util_clamp_min`: This parameter sets the minimum acceptable
performance level for individual tasks and task groups, ensuring that
tasks receive sufficient resources to operate effectively, even
during periods of low demand.

    Any requested `uclamp.min` value for a task can't exceed
`sched_util_clamp_min`.

    - For the scheduler, it acts as a lower bound on the per entity load tracking (PELT) signal, which tracks task usage.
    - For the CPU frequency, it instructs the governor to select a
frequency that can meet the performance requirements of the task,
thus ensuring responsiveness and efficiency. The Qualcomm-tuned
value is 1024. To set this parameter, run the following command on
the device:

echo 1024 > /proc/sys/kernel/sched_util_clamp_min
        Copy to clipboard
- `sched_util_clamp_max`: This parameter sets the maximum acceptable
performance level for individual tasks and task groups. It ensures
that tasks don't consume excessive resources, preventing resource
contention and system instability.

    Any requested `uclamp.max` value for a task can't exceed
`sched_util_clamp_max`.

    - For the scheduler, it acts as a ceiling on the PELT signal, which
tracks the task usage.
    - For the CPU frequency, if the task demands exceed the available
frequency, the governor may adjust the frequency to prevent
excessive power consumption. The Qualcomm-tuned value is 1024. To
set this parameter, run the following command on the device:

echo 1024 > /proc/sys/kernel/sched_util_clamp_max
        Copy to clipboard
- `sched_util_clamp_min_rt_default`: By default, the real-time (RT) tasks always
run at the highest frequency and highest CPU capacity. This parameter
allows you to change the default behavior of an RT task when UCLAMP
is being used.

    It allows tuning the best value for an RT task, offering good
performance without pushing it to the maximum performance point. This
behavior addresses the system requirement without burning power and
running at the maximum performance point all the time. The
Qualcomm-tuned value is 128.

    To set this parameter, run the following command on the device:

echo 128 > /proc/sys/kernel/sched_util_clamp_min_rt_default
        Copy to clipboard

For more information, see [Utilization Clamping](https://docs.kernel.org/scheduler/sched-util-clamp.html).

## Customize CPU frequency governor

You can configure a CPU frequency governor using the
`scaling_governor` node to enhance CPU performance.

Note

The commands containing `policy7` aren't supported on QCS5430 FP1.

To customize a frequency governor for Qualcomm Dragonwing^™^ IQ-9075, Qualcomm Dragonwing^™^ IQ-8275, and Qualcomm Dragonwing^™^ IQ-615, see the corresponding addendum. The following guides are available to licensed users with authorized access:

- [Qualcomm Linux Performance Guide - Addendum for Qualcomm Dragonwing IQ-9075](https://docs.qualcomm.com/bundle/resource/topics/80-70020-10A/overview.html)
- [Qualcomm Linux Performance Guide - Addendum for Qualcomm Dragonwing IQ-8275](https://docs.qualcomm.com/bundle/resource/topics/80-70020-10B/overview.html)
- [Qualcomm Linux Performance Guide - Addendum for Qualcomm Dragonwing IQ-615](https://docs.qualcomm.com/bundle/resource/topics/80-70020-10C/overview.html)

Note

The commands specified in the following table should be run on the device.

Table : Commands to customize the CPU frequency governor

| Command | Purpose |
| --- | --- |
| echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor<br>    Copy to clipboard<br><br><br>echo performance > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor<br>    Copy to clipboard<br><br><br>echo performance > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor<br>    Copy to clipboard | Sets the CPU governor to enhance the system performance. |
| cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor<br>    Copy to clipboard<br><br><br>cat /sys/devices/system/cpu/cpufreq/policy4/scaling_governor<br>    Copy to clipboard<br><br><br>cat /sys/devices/system/cpu/cpufreq/policy7/scaling_governor<br>    Copy to clipboard | Verifies the CPU frequency governor. |
| echo schedutil > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor<br>    Copy to clipboard<br><br><br>echo schedutil > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor<br>    Copy to clipboard<br><br><br>echo schedutil > /sys/devices/system/cpu/cpufreq/policy7/scaling_governor<br>    Copy to clipboard | Sets the CPU frequency governor to `schedutil`. |
| echo 1000 > /sys/devices/system/cpu/cpufreq/policyX/schedutil/rate_limit_us<br>    Copy to clipboard | Customizes `rate_limit_us`.<br><br><br>The value of `X` in `policyX` corresponds to clusters 0,<br>4, and 7.<br><br><br>This is a `schedutil` governor parameter. It contains the<br>value in microseconds. The governor waits for<br>`rate_limit_us` time to re-evaluate the load. The Qualcomm-tuned value is 1000. |

## Customize DVFS governor

You can customize the static map DVFS governor and bandwidth monitoring (BWMON) governor using DTSI files according to both the power and the performance requirements of your device.

### Customize static map DVFS governor

You can customize the mapping between the CPU frequency and the L3/DDR
frequency according to both, the power and the performance requirements from the
`arch/arm64/boot/dts/qcom/<target>.dtsi` file in the source code.

In the DTSI file, for each CPU node, there is an entry with
`operating-points-v2 = <&cpux_opp_table>`, where `cpux_opp_table`
holds the static mapping between the CPU frequency, and the L3 and the
DDR frequencies.

For example, the following entry indicates that the CPU 0 frequency
operates at 300 MHz:

cpu0_opp_300mhz: opp-300000000 {
                    opp-hz = /bits/ 64 <300000000>;
                    pp-peak-kBps = <800000 9600000>;
                    };
    Copy to clipboard

When CPU 0 operates at 300 MHz, it performs the following actions:

- Votes L3 to 9600000, which is 9600000/w (where w = 32) = 300,000,
which corresponds to 300 MHz
- Votes DDR to 800000, which is 800000/w (where w = 4) = 200,00, which
corresponds to 200 MHz

In this example, 'w' represents the number of bytes you can write in a single cycle.

- For L3, this value is 32, which means one transaction per cycle at
32 bytes per transaction.
- For dual-channel DDR, this value is 4. Each channel can perform two
transactions per cycle (because it's the DDR memory), and each
transaction is of 2 bytes.

For more information, see [Generic OPP (Operating Performance Points)
Bindings](https://www.kernel.org/doc/Documentation/devicetree/bindings/opp/opp.txt).

The tables specify the per channel DDR values. This implies that the mapping is between the CPU frequency and the bandwidth of each memory controller channel.

Caution

If you change the DTSI files, it impacts the power and the performance of the device. Ensure that you verify the impact across all the relevant
use cases before changing any nodes.

### Customize BWMON governor

You can customize `bwmon_opp_table` for the last level cache controller (LLCC) and DDR voting according to both the power and the performance requirements from the
`arch/arm64/boot/dts/qcom/<target>.dtsi` file in the source code.

The following code samples contain the DDR frequency level and the LLCC frequency level,
and each level translates to LLCC and DDR voting based on the traffic.

The following DTSI entry votes to DDR based on the CPU traffic between
LLCC to DDR, which corresponds to 200 MHz. In this example, 800000/w
(where w = 4) equals 200000:

llcc_bwmon_opp_table: opp-table {
            compatible = "operating-points-v2";
            opp-0 {
                     opp-peak-kBps = <800000>;
             };
    Copy to clipboard

The following DTSI entry votes to LLCC based on the CPU traffic between
CPU and LLCC, which corresponds to 150 MHz. In this example, 2400000/w
(where w = 16) equals 150000:

cpu_bwmon_opp_table: opp-table {
           compatible = "operating-points-v2";
           opp-0 {
                    opp-peak-kBps = <2400000>;
             };
    Copy to clipboard

In these examples, 'w' represents the number of bytes that you can write
in a single cycle.

- For DDR, this value is 4. Each channel can perform two transactions
per cycle (DDR memory), and each transaction is of 2 bytes.
- For LLCC, this value is 16.

## Customize perflock

You can use perflock APIs, run a use case using different tuning
parameters, and debug the perflock issues.

### Perflock APIs

To use the perflock APIs from the user space source code, do the
following:

1. Include a dynamic linking header in the source file:
`#include <dlfcn.h>`.
2. Load `library(libqti-perfd-client.so)` using `dlopen`.
3. Load the `perf_lock_acq()` and `perf_lock_rel()` symbols using `dlsym`.
4. Declare an integer variable to store the returns of `perf_lock_acq()`.
5. Define `perf_lock_opts` with the required resource opcode and value
pairs.
6. Acquire a lock with the specified optimizations using `perf_lock_acq()`.
7. Release the lock using `perf_lock_rel()`.
8. Unload the library using `dlclose` on cleanup.

The following sample code shows the usage of perflock APIs and illustrates how to set the minimum frequency of the Silver core to 1.9 GHz:

#include <stdlib.h>
    #include <stdio.h>
    #include <dlfcn.h>
    #include <error.h>
    #include <unistd.h>
    
    #define PATH_MAX 92
    
    static void *qcopt_handle;
    static int (*perf_lock_acq)(int handle, int duration, int list[], int numArgs);
    static int (*perf_lock_rel)(int handle);
    static int perf_lock_handle;
    char opt_lib_path[PATH_MAX] = "/usr/lib/libqti-perfd-client.so";
    
    int main()
    {
    
        if ((qcopt_handle = dlopen(opt_lib_path, RTLD_NOW)) == NULL)
        {
            printf("dlopen failed with error: NULL\n");
        } else {
            printf("call perflock \n");
            perf_lock_acq = (int (*)(int, int, int *, int))dlsym(qcopt_handle, "perf_lock_acq");
            if(!perf_lock_acq)
                printf("Unable to get perf_lock_rel function handle.\n");
            perf_lock_rel = (int (*)(int))dlsym(qcopt_handle, "perf_lock_rel");
        }
        int perf_lock_opts[2] = {0x44008100,1958400};
        perf_lock_handle = perf_lock_acq(perf_lock_handle, 0, perf_lock_opts, 2);
        printf("perflock acquired %d\n", perf_lock_handle);
    
       //Code section requiring perflock
    
       perf_lock_rel(perf_lock_handle);
       printf("releasing perflock\n");
       dlclose(qcopt_handle);
       return 0;
    }
    Copy to clipboard

### Perflock native test

The perflock native test is a tool designed to evaluate the
effectiveness of specific combinations of perflock opcodes.

This tool is available at `/usr/bin/` on the device.

You can run this utility as a use case to experiment with different
tuning parameters for `<resource, opcode>`. When the required
performance improvements are confirmed, the perflock code can be
integrated into Qualcomm^®^ Linux^®^.

The following code shows the syntax:

perflock_native_test --acq <handle> <duration> <resource opcode, value, resource opcode, value,...>
    Copy to clipboard

The following are some examples of how to use the tool. Run these commands on the device:

- To acquire a perflock for the Silver cluster with minimum frequency
set to 1958400 KHz for 30 seconds, run the following command:

perflock_native_test --acq 0 30000 0x44008100,1958400
        Copy to clipboard
- To verify the minimum frequency of the Silver cluster, run the
following command:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
        Copy to clipboard
- To verify the perflock logging from `syslog`, run the following
command:

cat /var/log/syslog
        Copy to clipboard

    The following are the logs:

perflock\_native\_test: ANDR-PERFLOCK-TESTERANDR-PERFLOCK-TESTER: initialize() 60: NRP: lib name libqti-perfd-client.so

perflock\_native\_test: ANDR-PERFLOCK-TESTERANDR-PERFLOCK-TESTER: main() 502: NRP: resource\_list[0] = 44008100 //silver core min frequency opcode

perflock\_native\_test: ANDR-PERFLOCK-TESTERANDR-PERFLOCK-TESTER: main() 502: NRP: resource\_list[1] = 7a6 // silver core min freq in hex

### Debug perflock

The following are some examples of logging mechanisms to debug the
perflock issues:

Note

The following example commands should be run on the device.

- To verify if the PerfHAL service is available, run the following
command:

ls /usr/bin | grep perf
        Copy to clipboard
- To verify the running status of the PerfHAL service, run the
following command:

systemctl status perf-hal
        Copy to clipboard
- To enable perflock logs and traces in `/var/log/syslog`, run the
following commands:

echo debug.trace.perf=1 >> /etc/build.prop
        Copy to clipboard

echo vendor.debug.trace.perf=1 >> /etc/build.prop
        Copy to clipboard

reboot
        Copy to clipboard

## Customize memory

You can manage virtual memory using Kswapd, regulate system memory using
watermark, and define memory regions for specific subsystems through
memory carveouts.

### Kswapd

Kswapd is a kernel thread that manages the virtual memory. When the
system is low on free memory, Kswapd is activated to reclaim memory by
identifying less frequently used pages from the file cache and moving
them to the swap space (ZRAM).

Kswapd does the following:

- Monitors the memory usage of the system
- Performs swapping activities in the background to maintain an optimal
level of free memory

![../../_images/cpu_usage_performance_using_kswapd.png](data:image/png;base64,UklGRoIoAABXRUJQVlA4THUoAAAvrsJyEOcGuQEkR0p379m+lfDe+yciAUTehMGTFLxn6O4qTBJwa9tWraynuHsx0AM53RI5Hbhm3+WOf87ecGxrT6B8ScYtmUErOpcN0NOxDrZNR2V/xiX/9yFqJDWTYAAcoRKDSODdtA4CCPi00EILRLQgqcN9C5BAHBWRhhlBAo4ggogWWiBS9SElVk7Qk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fQsbSKrFvtwaNWHq7HfQ+uVO1r/z756/tXYCVsL+LTwEej3Ef/5Qs01lEPbFkJ4ym2QlUryPM0Tq21qlRhHXU/LQS7T+M0W53KbB95QGOP1sFRs2Xu3qNSw4XrkKVUTvMCjYXueFtqm+tbXF9Mo2a3B3Yhri4cD/FRs+UOG+BoixsbABpXZOn8LTt4zKIHIOM70PcCR3JJXz6+ckFDjnFEXToGLi+BY3PRUbPbB7sbx3qzhVzfArh8dQu2V0IS4PpmAXy6H7gdAUizxc1tI/nHkY/rx9e3uKYXQLtNcaSxu1xjSS7QXLvLhbXSRkPIP5XsyhbXjkSuAUerqOIg2/Fq6voxabKS3mDL2WisozY3tzcv6c3xzcsrqfwJzRa4uVlJ4XJDpifu1esgbFAOsAFomHKkS0dyQWPBWebt/1LyRRdx96rq7ot40qpKLj7nKauqpzznmRe/dEUlF595x7Of9kXr6XfLs++Qr3rW09bSP8rTnvVVd4jg2Ref8qS7188mT7n4nPwhIs987sU1tMkz7xARAA==)

**Figure : CPU usage vs. performance using Kswapd**

### Watermark

A watermark is a threshold or limit set on memory parameters that helps
regulate the allocation and usage of system memory.

Table : Watermark parameters

| Parameter | Description |
| --- | --- |
| `/proc/sys/vm/min_free_kbytes` | <ul class="simple"><br><li><p>This parameter determines the minimum amount of free<br>memory that the system must maintain across all zones.</p></li><br><li><p>It ensures that a certain reserve of memory remains<br>available for critical operations, such as handling<br>atomic allocations, which can't wait for memory<br>reclamation.</p></li><br><li><p>The number of reserved free pages in each zone is<br>proportional to its size.</p></li><br></ul> |
| `/proc/sys/vm/watermark_scale_factor` | <ul class="simple"><br><li><p>This factor controls the aggressiveness of Kswapd.</p></li><br><li><p>It defines the amount of memory left in a system before<br>Kswapd is woken up, and the amount of free memory<br>required before Kswapd goes back to sleep.</p></li><br><li><p>The unit is in fractions of 10,000.</p></li><br><li><p>The default value of 10 means that the distance between<br>the watermarks is 0.1% of the available memory in the<br>node or system. The maximum value is 1000, or 10% of<br>memory.</p></li><br></ul> |
| `/proc/sys/vm/watermark_boost_factor` | <ul class="simple"><br><li><p>This factor is used to optimize memory fragmentation by<br>temporarily providing a high-watermark for the memory<br>management area, which allows Kswapd to reclaim more<br>memory.</p></li><br><li><p>The unit is in fractions of 10,000.</p></li><br><li><p>The default value of 15,000 means that up to 150% of the<br>high watermark is reclaimed in the event of a pageblock<br>being mixed due to fragmentation.</p></li><br><li><p>The number of fragmentation events that have occurred in<br>the recent past determine the level of reclaim. A boost<br>factor of 0 disables the feature.</p></li><br></ul> |

For more information, see [Documentation for /proc/sys/vm/](https://www.kernel.org/doc/Documentation/admin-guide/sysctl/vm.rst).

### Memory carveout

Memory carveouts refer to specific memory regions that the kernel can't
address, known as no-map regions. Specific subsystems such as modem, camera, aDSP, cDSP, and Qualcomm^®^ Trusted Execution Environment (TEE)/TrustZone (TZ) use these regions exclusively and hence those are inaccessible to the Linux kernel.

These carveouts are defined in the source code at
`arch/arm64/boot/dts/qcom/<target>.dtsi`.

They fall under the `reserved-memory` node and can be configured.

The following code shows the no-map regions for the cDSP, camera, modem,
and QTEE/TrustZone (TZ) subsystems:

reserved-memory {
            cdsp_secure_heap_mem: cdsp-secure-heap@81800000 {
                reg = <0x0 0x81800000 0x0 0x1e00000>;
                no-map;
            };
    
            camera_mem: camera@84300000 {
                reg = <0x0 0x84300000 0x0 0x500000>;
                no-map;
            };
            adsp_mem: adsp@86100000 {
                reg = <0x0 0x86100000 0x0 0x2800000>;
                no-map;
            };
            cdsp_mem: cdsp@88900000 {
                reg = <0x0 0x88900000 0x0 0x1e00000>;
                no-map;
            };
            mpss_mem: mpss@8b800000 {
                reg = <0x0 0x8b800000 0x0 0xf600000>;
                no-map;
            };
    
            tz_stat_mem: tz-stat@c0000000 {
                reg = <0x0 0xc0000000 0x0 0x100000>;
                no-map;
            };
            tags_mem: tags@c0100000 {
                reg = <0x0 0xc0100000 0x0 0x1200000>;
                no-map;
            };
    Copy to clipboard

You can adjust the reserved memory carveout regions based on your
product requirements. This adjustment can include removing a modem
carveout region or reducing the size of QTEE/TrustZone (TZ) application memory
carveout regions.

For example, the following code snippet shows how to disable the modem
memory carveout for memory optimization:

reserved-memory {
            mpss_mem: mpss@8b800000 {
                reg = <0x0 0x8b800000 0x0 0xf600000>;
                no-map;
                        status = "disabled";
            };
    Copy to clipboard

In this code:

- `0x8b800000` is the base address of the modem region.
- `0xf600000` is the size of the modem region, which is 246 MB.
- Add `status = disabled` to make this region available to the Linux kernel.

The following example snippets show how to reduce the memory carveout
size of the QTEE/TrustZone (TZ) applications from 28 MB (`0x1c00000`) to
20 MB (`0x1400000`):

| - Before:<br>    - reserved memory {<br>                     trusted_apps_mem: trusted_apps@c1800000 {<br>                     reg = <0x0 0xc1800000 0x0 0x1c00000>;<br>                     no-map;<br>       };<br>    Copy to clipboard | - After:<br>    - reserved memory {<br>                  trusted_apps_mem: trusted_apps@c1800000 {<br>                  reg = <0x0 0xc1800000 0x0 0x1400000>;<br>                  no-map;<br>    };<br>    Copy to clipboard |
| --- | --- |

## Next steps

- [Troubleshoot performance issues](https://docs.qualcomm.com/doc/80-70020-10/topic/24-debug.html#debug)

Last Published: Jul 08, 2025

[Previous Topic
Configure CPU, GPU, and memory](https://docs.qualcomm.com/bundle/publicresource/80-70020-10/topics/14-configure.md) [Next Topic
Troubleshoot performance issues](https://docs.qualcomm.com/bundle/publicresource/80-70020-10/topics/24-debug.md)