# Features

Source: [https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html](https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html)

The Qualcomm Linux kernel includes features, such as the CPU scheduler, CPU frequency
            governor, dynamic voltage and frequency scaling (DVFS), and memory management. This
            guide provides an overview of each feature and related reference links. Additionally,
            Qualcomm has added a feature called PerfHAL to enhance performance.

## CPU scheduler

Source: [https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html](https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html)

The CPU scheduler manages how CPU time is distributed among the processes running on
        Linux systems.

It uses the earliest eligible virtual deadline first (EEVDF) scheduler, a feature
            provided by the Linux kernel. The EEVDF CPU scheduler uses per entity load tracking
            (PELT) to monitor the task load.

For more information, see:

- [An
                    EEVDF CPU scheduler for Linux](https://lwn.net/Articles/925371/)
- [Per-entity load tracking \[LWN.net\]](https://lwn.net/Articles/531853/)

Utilization clamping (UCLAMP or util clamp) is a scheduler feature that helps manage
            performance requirements for tasks.

For more information, see:

- [https://docs.kernel.org/scheduler/sched-util-clamp.html](https://docs.kernel.org/scheduler/sched-util-clamp.html)
- [Customize CPU scheduler](https://docs.qualcomm.com/doc/80-70015-10/topic/18-customize.html#customize-scheduler)

## CPU frequency governor

Source: [https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html](https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html)

A CPU frequency governor adjusts the CPU frequency based on the task load. The CPU
        scheduler provides the necessary inputs for this process.

Qualcomm Linux uses the `schedutil` governor, a feature provided by the
            Linux kernel.

This governor increases the frequency when the system is heavily loaded and reduces it
            when the load is low, ensuring an optimal balance between power consumption and
            performance.

For more information, see:
- [https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt](https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt)
- [Configure CPU](https://docs.qualcomm.com/doc/80-70015-10/topic/14-configure.html#cpu)
- [Customize CPU frequency governor](https://docs.qualcomm.com/doc/80-70015-10/topic/18-customize.html#cpu-frequency-governer)

## DVFS governors

Source: [https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html](https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html)

DVFS governors control the frequencies of CPU caches (L3), the last level cache
        controller (LLCC), and the DDR based on the system workload.

These governors increase the frequency when the workload is high and decrease it when the
            workload is low, ensuring an optimal balance between power consumption and
            performance.

Qualcomm Linux supports two types of DVFS governors for L3 cache, LLCC, and DDR.

### Static map DVFS governor

This governor aligns the frequencies of the CPU L3 cache and DDR with the current CPU
                frequency to balance power and performance requirements.

For example, if the CPU frequency is at its maximum, the L3 cache and DDR frequencies
                must also be at their maximum levels.

The static mapping is available in the source code at
                    arch/arm64/boot/dts/qcom/&lt;target&gt;.dtsi.

For customization options, see [Customize static map DVFS governor](https://docs.qualcomm.com/doc/80-70015-10/topic/18-customize.html#dvfs_0__section_u1x_jps_51c_caharris_03-20-24-2005-37-832).

### BWMON governor

The bandwidth monitoring (BWMON) governor dynamically adjusts the frequencies of the
                LLCC and DDR based on the measured traffic flow from the CPU to the LLCC and then to
                the DDR.

The BWMON hardware block measures this traffic. It monitors the data throughput
                between memory and other subsystems within a specified sampling window and uses this
                information to scale the LLCC and DDR frequencies to meet the required
                bandwidth.

The BWMON governor driver is available in the source code at
                    drivers/soc/qcom/icc-bwmon.c.

For more information, see:

- [\[PATCH v3 0/4\] soc/arm64: qcom: Add initial
                        version of bwmon](https://lwn.net/ml/linux-kernel/20220531105137.110050-1-krzysztof.kozlowski@linaro.org/)
- [Customize BWMON governor](https://docs.qualcomm.com/doc/80-70015-10/topic/18-customize.html#dvfs_0__section_qxs_4ps_51c_caharris_03-20-24-2007-2-926)

## PerfHAL

Source: [https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html](https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html)

PerfHAL is a Qualcomm proprietary service that offers added functionality by making
        perflock APIs accessible. It is beneficial when you need short-term performance enhancements
        or power savings.

Perflocks help in modifying system behavior to manage intermittent workloads. For
            example, if a specific code segment must run at a higher CPU frequency for a certain
            duration, perflocks can be used within that code to boost the CPU frequency.

PerfHAL efficiently handles concurrent perflock requests from multiple clients. When
            several requests are aimed at the same resource, PerfHAL aggregates them to achieve the
            optimal performance level needed by the device.

When a perflock of a client is no longer active, PerfHAL releases all the perflocks
            associated with that client.

### Perflock APIs

Source: [https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html](https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html)

Perflock APIs are designed to allow applications to adjust system parameters for
        specific use cases, helping them meet their performance and power objectives.

User space applications use the perf\_lock\_acq() and
                perf\_lock\_rel() APIs to request specific values of system tunable
            parameters for both, a set or an indefinite time period.

### Acquire perflock 

The perf\_lock\_acq() function is used to acquire a perflock with
                the necessary optimizations.

The syntax for this function is as follows:

`int perf_lock_acq(int handle, int duration, int list[], int
                numArgs)`

Table : perf_lock_acq API parameters

| Parameter | Description |
| --- | --- |
| `handle` | Identifies the client request. |
| `duration` | <ul class="ul" id="perflockapi__ul_fhn_fmz_q1c"><br>                                        <li class="li">Indicates the maximum timeout period that a perflock<br>                                            must be held, in milliseconds.</li><br><br>                                        <li class="li"><code class="ph codeph">duration</code> parameter can be set for a<br>                                            definite time or for an indefinite time<br>                                                <code class="ph codeph">(0)</code>.<ul class="ul" id="perflockapi__ul_htm_rps_s1c"><br>                                                <li class="li">Definite perflocks require a positive integer<br>                                                  value to specify the maximum timeout period. A<br>                                                  timer is created and the perflock is released when<br>                                                  the timer expires.</li><br><br>                                                <li class="li">Indefinite perflocks are held until the client<br>                                                  calls the release function. To manually release a<br>                                                  perflock that has been set for an indefinite<br>                                                  duration, use the<br>                                                  <span class="keyword apiname">perf_lock_rel()</span> function.</li><br><br>                                            </ul><br></li><br><br>                                    </ul> |
| `list` | An array of resource opcodes and value pairs. Opcodes<br>                                        indicate a system parameter (resource) and the value to set<br>                                        it (level). |
| `numArgs` | Number of elements in the list array. |

Table : perf_lock_acq API returns and result

| Returns | Result |
| --- | --- |
| A non-zero integer | Success |
| -1 | Failure |

### Perflock release

The perf\_lock\_rel() function is used to release a perflock that is
                held by the perf\_lock\_acq() API. This function is used only for
                the perflocks that are set for an indefinite duration. The syntax for this function
                is as follows:

`int perf_lock_rel(int handle)`

Table : perf_lock_rel API parameters

| Parameter | Description |
| --- | --- |
| `handle` | <ul class="ul" id="perflockapi__ul_vhd_bxz_q1c"><br>                                        <li class="li">Tracks unique requests</li><br><br>                                        <li class="li">Passes the same handle that<br>                                                <code class="ph codeph">perf_lock_acq()</code> returns to release<br>                                            the lock</li><br><br>                                    </ul> |

Table : perf_lock_rel API returns and result

| Returns | Result |
| --- | --- |
| A non-zero integer | Success |
| -1 | Failure |

### Resource opcodes

Source: [https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html](https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html)

Perflock uses a combination of opcodes and their corresponding values to perform
        specific operations on a perflock resource.

The following table lists the supported opcodes:

Note: The opcodes 0x44008200 and 0x4400C200, as well as the
                commands containing `policy7` are not supported on QCS9075.

Table : Supported opcodes

| Opcode | Purpose | Sysnode on device |
| --- | --- | --- |
| 0x44000000 | Sets the minimum acceptable performance level for individual<br>                                tasks and task groups. | /proc/sys/kernel/sched\_util\_clamp\_min |
| 0x44004000 | Sets the maximum acceptable performance level for individual<br>                                tasks and task groups. | /proc/sys/kernel/sched\_util\_clamp\_max |
| 0x44008100 | Sets the minimum frequency of the Silver cluster. | /sys/devices/system/cpu/cpufreq/policy0/scaling\_min\_freq |
| 0x44008000 | Sets the minimum frequency of the Gold cluster. | /sys/devices/system/cpu/cpufreq/policy4/scaling\_min\_freq |
| 0x44008200 | Sets the minimum frequency of the Prime cluster. | /sys/devices/system/cpu/cpufreq/policy7/scaling\_min\_freq |
| 0x4400C100 | Sets the maximum frequency of the Silver cluster. | /sys/devices/system/cpu/cpufreq/policy0/scaling\_max\_freq |
| 0x4400C000 | Sets the maximum frequency of the Gold cluster. | /sys/devices/system/cpu/cpufreq/policy4/scaling\_max\_freq |
| 0x4400C200 | Sets the maximum frequency of the Prime cluster. | /sys/devices/system/cpu/cpufreq/policy7/scaling\_max\_freq |

The following are some examples of the resource opcodes:

- 0x44004100, 1958400: This pair of opcode and value indicates that the minimum
                frequency of the Silver cluster must be set to 1958400 KHz.
- 0x44004100, 1958400, 0x44008100, 2100000: This pair of opcode and value indicates
                that the minimum frequency of the Silver cluster must be set to 1958400 KHz. The
                maximum frequency of the Silver cluster must be set to 2100000 KHz.

For more information on how to use and debug perflock, see [Customize perflock](https://docs.qualcomm.com/doc/80-70015-10/topic/18-customize.html#customize-perlocks).

## Memory

Source: [https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html](https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html)

RAM is used for all memory allocations made by the Qualcomm Linux software. Effective
        management of RAM is crucial to meet performance requirements and ensure the smooth
        functioning of applications.

Figure : Memory partitioning
            
            ![](data:image/png;base64,UklGRq4XAABXRUJQVlA4TKEXAAAv44JaAL/CKJIkRVWLx4LOv537840Nh5EkOc0M3ntIiPyjIAfkdY4bSVKkymVmNGL9d2p/x1jzH6AAEZT//xdh29ABiKCULKAYihJAZWhiihQJgAjKOuUUfBKBgM1tbehEUaM2TQGF79LcVGr/pkjvRk5D82qKXqZSEihZRFHeE8VYFlQACEUvUigAkamuoIgA6E+K+/0WYefzKcKez0eEHddXYM/nA+z9foHt50FR7p0KYDguFEtXUSgUU1NQbENDAf/b/v9JHP/fbfogaQ2pMd1BN8EgYZ7gPkUdtnbRzQ7u08E+UZmIdgT+/3/l8bjf74+gqJD9QkT/adG2FbS11rnNG/ii3VAOIJwYviuluG3u5J9ltkmgvLb/E/nyvZy2L0rme6Wctu8b/9n4z3/mMVFgFrQmAgOFI84+EDicQ6DulLLUidUA3Fr8SQIPnJ3SFuYr0114MyZB1Wq4Fek4vLcpceEehXs+EupcqYbDaSBgfEKj7KUiUMWtdrQ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qbyF/+8s/S2ir/dcUqAA==)

Certain sections of RAM are managed independent of the Linux system. For example,
            firmware such as modem, video, and audio run from these specific RAM partitions. The
            Linux kernel manages all other RAM partitions.

The Linux kernel features its own memory management subsystem, which includes:

- Implementation of virtual memory and demand paging
- Allocation of memory to both kernel internal structures and user space
                    programs
- Mapping of files into the address space of the processes
- Other memory management operations

### RAM memory partitioning

The following table describes various types of memory allocations.
Note: The commands specified in the following table should be
                    run on the device.

| RAM classification | Memory segment | Allocation types | Description |
| --- | --- | --- | --- |
| Non-Linux | – | – | <ul class="ul" id="memory__ul_p5v_h2m_41c"><br>                                        <li class="li">Memory is reserved in the form of carveouts by various<br>                                            subsystems other than Linux.</li><br><br>                                        <li class="li">These carveouts are specified in the respective DTSI<br>                                            files.</li><br><br>                                    </ul> |
| Linux (system RAM) | Kernel static | Vmlinux + kernel page structures | <ul class="ul" id="memory__ul_gzq_52m_41c"><br>                                        <li class="li">The kernel reserves this memory at boot time for its own<br>                                            usage.</li><br><br>                                        <li class="li">Vmlinux is the memory used to store the vmlinux<br>                                            image.</li><br><br>                                        <li class="li"> The size and breakdown of the vmlinux image can be<br>                                            obtained from the <code class="ph codeph">dmesg</code>logs at<br>                                                bootup:<ul class="ul" id="memory__ul_e2b_bfx_3bc_sshewale_05-10-24-1237-20-424"><br>                                                <li class="li"><br>                                                  <pre class="pre screen" id="memory__screen_vx1_t1x_pcc">Memory: 3061872K/4134912K available (28800K kernel code, 2090K rwdata, 10688K rodata, 3072K init, 969K bss, 679824K reserved, 393216K cma-reserved)<span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre><br><br>                                                </li><br><br>                                                <li class="li"><br>                                                  <pre class="pre screen" id="memory__screen_b14_51x_pcc">Kernel code + rwdata + rodata+init +bss indicates vmlinux kernel image size (28800k+2090k+10688k+3072k+969k)<span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre><br><br>                                                </li><br><br>                                            </ul><br></li><br><br>                                        <li class="li">The kernel page structure is the memory used by the<br>                                            kernel to maintain page structures for every page of<br>                                            RAM. This is calculated as 16&nbsp;MB per GB of RAM<br>                                            size.</li><br><br>                                    </ul> |
| Linux (system RAM) | Kernel dynamic | Slab | <ul class="ul" id="memory__ul_mlr_t1r_51c_caharris_03-20-24-1456-13-798"><br>                                        <li class="li">The slab is used by the kernel for faster and more<br>                                            efficient memory usage of frequently used data<br>                                            structures.</li><br><br>                                        <li class="li">To check the memory usage of the slab, run the following<br>                                            command:<pre class="pre codeblock" id="memory__codeblock_xng_v1r_51c_caharris_03-20-24-1456-41-577"><code>cat /proc/meminfo | grep -i slab</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                        <li class="li">To understand the breakup of various slabs and their<br>                                            usage, enable <code class="ph codeph">CONFIG_SLUB_DEBUG</code> in the<br>                                            kernel configuration, and then run the following<br>                                            command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_jfy_bbr_51c_caharris_03-20-24-1458-38-979"><code>cat /proc/slabinfo</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | Kernel dynamic | Kernel stack | <ul class="ul" id="memory__ul_dpy_vbx_t1c_caharris_03-17-24-2104-3-233"><br>                                        <li class="li">The kernel stack stores the call stack of every<br>                                            process.</li><br><br>                                        <li class="li">To check the memory usage of the kernel stack, run the<br>                                            following command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_ypc_hbr_51c_caharris_03-20-24-1500-9-838"><code>cat /proc/meminfo | grep -i kernelstack</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | Kernel dynamic | PageTables | <ul class="ul" id="memory__ul_omh_jbr_51c_caharris_03-20-24-1500-48-282"><br>                                        <li class="li">The kernel uses memory to store PageTables that map<br>                                            virtual addresses to physical addresses.</li><br><br>                                        <li class="li">To check the memory usage of PageTables, run the<br>                                            following command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_cjx_4br_51c_caharris_03-20-24-1502-26-888"><code>cat /proc/meminfo | grep -i PageTables</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | Kernel dynamic | Modules | <ul class="ul" id="memory__ul_lk4_qbr_51c_caharris_03-20-24-1502-55-991"><br>                                        <li class="li">Represents the kernel entities that are dynamically<br>                                            loaded into the kernel in the form of kernel<br>                                            modules.</li><br><br>                                        <li class="li">To display the list of loaded kernel modules and their<br>                                            memory usage, run the following command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_cch_tbr_51c_caharris_03-20-24-1503-43-770"><code>cat /proc/modules</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | Kernel dynamic | Vmalloc | <ul class="ul" id="memory__ul_t4t_vbr_51c_caharris_03-20-24-1504-27-363"><br>                                        <li class="li">Used to allocate contiguous memory.</li><br><br>                                        <li class="li">To check the vmalloc memory breakup, run the following<br>                                            command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_lnx_xbr_51c_caharris_03-20-24-1505-5-185"><code>cat /proc/vmallocinfo</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | Kernel dynamic | Cached (kernel + user space) | <ul class="ul" id="memory__ul_gys_zbr_51c_caharris_03-20-24-1505-37-238"><br>                                        <li class="li">The amount of file-backed memory that resides in RAM. </li><br><br>                                        <li class="li">To check the cached memory usage, run the following<br>                                            command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_jd3_dcr_51c_caharris_03-20-24-1506-40-239"><code>cat /proc/meminfo | grep -i cached</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | Kernel dynamic | Buffers | <ul class="ul" id="memory__ul_g3t_vv2_4bc_sshewale_05-29-24-1054-24-346"><br>                                        <li class="li">Buffers are of fixed size and contain blocks of<br>                                            information either read from disk or written to<br>                                            disk.</li><br><br>                                        <li class="li">To check the buffer memory usage, run the following<br>                                            command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_p22_3cr_51c_caharris_03-20-24-1508-5-447"><code>cat /proc/meminfo | grep -i Buffers</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | Kernel dynamic | Shmem | <ul class="ul" id="memory__ul_lkb_1w2_4bc_sshewale_05-29-24-1055-40-115"><br>                                        <li class="li">Shared memory is a common block of memory that is mapped<br>                                            into the address spaces of two or more processes.</li><br><br>                                        <li class="li">To check the shared memory usage, run the following<br>                                            command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_rtk_ncr_51c_caharris_03-20-24-1509-37-775"><code>cat /proc/meminfo | grep -i shmem</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | User space | ZUSED (ZRAM) | An anonymous memory post compression by ZRAM. |
| Linux (system RAM) | User space | CMA | <ul class="ul" id="memory__ul_khp_pcr_51c_caharris_03-20-24-1510-15-988"><br>                                        <li class="li">A physically continuous memory is typically mapped to<br>                                            other IPs, such as video and display, however it is<br>                                            allocated to the runtime.</li><br><br>                                        <li class="li">The free memory that the system can use is reduced with<br>                                            the usage of more CMA reservations. Only the movable<br>                                            allocations, such as user space process allocations can<br>                                            use the CMA reserved free memory. However, it cannot be<br>                                            used for the kernel allocations.</li><br><br>                                    </ul> |
| Linux (system RAM) | User space | ANON | <ul class="ul" id="memory__ul_mss_bw2_4bc_sshewale_05-29-24-1056-9-392"><br>                                        <li class="li">Memory that user space applications allocate using<br>                                                <span class="keyword apiname">malloc()</span> or<br>                                                <span class="keyword apiname">new()</span> function calls. </li><br><br>                                        <li class="li">To get the ANON memory breakup for a process, run the<br>                                            following<br>                                            command:<pre class="pre codeblock" id="memory__codeblock_jr1_zcr_51c_caharris_03-20-24-1513-1-867"><code>cat /proc/&lt;pid&gt;/smaps</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | User space | ION | <ul class="ul" id="memory__ul_km4_1dr_51c_caharris_03-20-24-1513-28-778"><br>                                        <li class="li">ION memory allows sharing buffers between hardware IPs<br>                                            such as video, camera, and Qualcomm Linux software.</li><br><br>                                        <li class="li">ION manages one or more memory pools, which can be set<br>                                            aside at boot time to combat fragmentation.</li><br><br>                                        <li class="li">To check the ION memory usage, run the following<br>                                            commands:<pre class="pre codeblock" id="memory__codeblock_zmc_vlg_v1c_caharris_03-22-24-1750-46-225"><code>mount -t debugfs none /sys/kernel/debug</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre><pre class="pre codeblock" id="memory__codeblock_rcx_ddr_51c_caharris_03-20-24-1514-27-337"><code>cat /sys/kernel/debug/dma_buf/bufinfo | grep bytes</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre><br>                                        </li><br><br>                                    </ul> |
| Linux (system RAM) | User space | KGSL | <ul class="ul" id="memory__ul_onb_3dr_51c_caharris_03-20-24-1515-40-628"><br>                                        <li class="li">Memory allocated by the graphics driver. </li><br><br>                                        <li class="li">To check the overall kernel graphics support layer<br>                                            (KGSL) memory usage, run the following command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_pnf_kdr_51c_caharris_03-20-24-1516-18-485"><code>cat /sys/class/kgsl/kgsl/page_alloc</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                        <li class="li">To check the process level breakup, run the following<br>                                            command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_g4k_mdr_51c_caharris_03-20-24-1516-57-34"><code>cat /sys/class/kgsl/kgsl/proc/&lt;pid&gt;/kernel</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
| Linux (system RAM) | Free memory | – | <ul class="ul" id="memory__ul_vrz_d2s_51c_caharris_03-20-24-1840-7-435"><br>                                        <li class="li">Free memory is the memory that is not yet used and is<br>                                            available for any allocation.</li><br><br>                                        <li class="li">To check the free memory, run the following command:<br>                                            <pre class="pre codeblock" id="memory__codeblock_u1g_qdr_51c_caharris_03-20-24-1518-4-285"><code>cat /proc/meminfo | grep -i MemFree</code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></li><br><br>                                    </ul> |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |
|  |  |  |  |

## Real-time kernel

Source: [https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html](https://docs.qualcomm.com/doc/80-70015-10/topic/2-performance-features.html)

Real-time (RT) Linux is an optional feature that is not enabled by default on
        Qualcomm Linux. It can be enabled based on the product requirements.

RT Linux is designed to offer deterministic and predictable behavior for applications
            that are time‑sensitive.

### Set up workspace

In Qualcomm Linux, the RT Linux kernel recipes are referred to as
                    `linux-qcom-base-rt` for base BSP and
                    `linux-qcom-custom-rt` for custom BSP.

The Qualcomm Linux kernel supports long-term support (LTS) RT kernel v6.6, which is
                maintained through the Yocto recipe in the `meta-qcom-realtime` layer
                at the following paths in the source code:

- Base BSP:
                    recipes-kernel/linux/linux-kernel-base-rt\_6.6.bb
- Custom BSP:
                    `recipes-kernel/linux/linux-kernel-custom-rt_6.6.bb`.

For more information on how to clone the workspace and acquire all the meta layers to
                use Qualcomm RT Linux kernel, see [Sync and build with real-time Linux](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#sync-and-build-with-real-time-linux).

### Enable RT kernel

The RT kernel is enabled using the Linux RT kernel recipe. This recipe fetches the
                kernel, downloads pre-empt RT patches, and applies them to the kernel. It also
                enables a fully pre-emptible kernel with:

`CONFIG_PREEMPT_RT=y`

For more information, see [Qualcomm Linux Kernel Guide](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-3/overview.html).

### Verify kernel type

After boot up, verify the kernel type by running the following command on the
                device:

    uname -vCopy to clipboard

The following is an output of the command:

    SMP PREMPT_RTCopy to clipboard

Last Published: Oct 14, 2024

[Previous Topic
Getting started](https://docs.qualcomm.com/bundle/publicresource/80-70015-10/topics/get-started.md) [Next Topic
Analysis tools](https://docs.qualcomm.com/bundle/publicresource/80-70015-10/topics/13-performance_tools.md)