How to use DMA to transfer data under Linux

How to use DMA to transfer data under Linux
We all know that using DMA to transfer data can occupy less CPU resources, so like other operating systems, Linux supports hard disk to transfer data by DMA, but when installing Red Hat 7.0 The default option for DMA is Disable, of course you can enable it during installation. If DMA is disabled during installation, how can I activate DMA? DMA support can be activated by recompiling the kernel, but compiling the kernel is obviously too complicated for beginners. The following method enables DMA support without compiling the kernel.
1. Check whether the DMA option in the system has been activated
Before proceeding , confirm whether the hard disk is already using DMA to transfer data. Method: Check the /proc/ide/hda/settings file, there is a line of content: using_dma, if the value behind it is set to 1, it means that the system already supports DMA, then the following operations can be avoided, of course, if If you want to turn off the DMA function, have a look below :).
The hdparm command in Linux is used to perform operations related to the hard disk. Use hdparm -i /dev/hda to list the DMA modes that the IDE may support, such as:
DMA modes: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 *udma4

Second, activate DMA support
Method 1: Add: idex=dma in lilo.conf, where x represents the serial number of the hard disk, and its value ranges from 0 to 3, representing the four IDE hard disk devices in the system respectively.
Method 2: Use the hdparm command, hdparm d1 /dev/hda where d1 means enable DMA, you can add it to rc.locl so that the hard disk can use DMA to transfer data every time it is started.

3. Turn off DMA support
Command format: hdparm d0 /dev/hda Turn off the DMA transfer mode, I really can't think of any reason to do this.
For the hard disk that supports UDMA transmission, you can also refer to the above method to set up, but make sure that the hard disk controller and hard disk support UDMA, and finally you must have a hard disk connection that supports UDMA transmission, otherwise even if you activate UDMA support, it will also strike.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326436924&siteId=291194637