Use software in Linux to reduce CPU usage

Source: Internet
Author: User
In Linux, use software to reduce the CPU usage-Linux Enterprise Application-Linux server application information. The following is a detailed description. Some time ago, the pre-developed lab board was configured as a PXA270 with a CPU of more than 500 mb and a memory of 64 MB. To test the performance of software in different hardware configurations, we need to reduce the CPU frequency and memory size.

It is easy to adjust the memory size. Just add parameters such as mem = 32 m to the start parameter of linux. For example, the following parameter: root =/dev/mtdblock2 rootfstype = jffs2 console = ttyS0, 115200 mem = 32 M

The DataSheet of PXA270 is described in the Power Management chapter. You can adjust the CPU frequency by modifying the values of the CCCR and CLKCFG registers.

But where can I modify it? In bootloader or linux kernel? There are still few materials in this regard. I wonder if the kernel power management already has support in this aspect? I read some code and found that there are two ways to change the CPU frequency.

One is arch/arm/mach-pxa/ipmc. c provides an interface for you to use ioctl to control the/dev/ipmc file, use the command IPMC_IOCTL_GET_DPM_CONFIG to obtain the CPU frequency, and use the command IPMC_IOCTL_SET_DPM_CONFIG to set the CPU frequency. After trying it out, there is no problem with obtaining it, but after setting it, the kernel will die.

The other one is drivers/cpufreq. c, which also provides an interface for users to obtain and set the CPU frequency through read/write/proc/cpufreq. After trying it out, there is no problem with obtaining it, but it has no effect after setting it.

We had to start with bootloader. bootloader uses blob. It took some time to study and finally found that the xlli_setClocks function in the blob-xscale/src/blob/xlli/xlli_LowLev_Init.s file can be modified to set the CPU frequency. The specific settings can be described in datasheet.

I finally succeeded, but I still have some doubts. Can't I dynamically modify the CPU frequency at runtime? Reducing the CPU frequency during idle time can save a lot of power. This is very important for mobile devices. Why is it abnormal?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.