Archive

Posts Tagged ‘memory’

What is DMA ? How to enable/disable it ?

October 18th, 2008 No comments

What is DMA?

DMA stands for Direct Memory Access, a mechanism in modern computers which allow peripheral devices (like HDD, USB etc..) to sent data directly to motherboard’s memory without passing through the CPU. Many hardware systems use DMA including disk drive controllers, graphics cards, network cards, and sound cards.

DMA technology is implemented in modern computer bus architectures to speed up computer operations and allow multitasking. Normally, the CPU will be fully occupied in any read/write operation; enabling DMA allows reading/writing data in the internal memory, external memory and peripherals without CPU involvement, thus making the processor available for other tasks. This ensures streamlined operations, as movement of data to/from memory is one of the most common computer operations and freeing the CPU of this overhead can lead to a significant improvement in performance.

You will have to make sure whether the HD controller supports DMA (likely), and your drives support it (newer than 1997), enable it.

You can use the following command to check and turn on/off DMA

  1. Check whether HDD is SATA or IDEIf you do df -lh you can tell which drives are IDE and which are SATA.
    /dev/hd? << that is IDE
    /dev/sd? << that is SATA

    SATA drives do not use DMA because it is already so fast :D
  2. Check whether DMA is on/off
    root@server [~]# hdparm –d 1 /dev/hdd
    /dev/hdd:
    using_dma = 0 (off)
    root@server [~]#
  3. If it is Off then you can turn On using command command
    root@server [~]# hdparm -d 1 /dev/hdd
    /dev/hdd:
    setting using_dma to 1 (on)
    using_dma = 0 (on)
  4. You can test HDD performance using following command
    #hdparm -tT /dev/hdd

If you are getting following error while trying to enable (hdparm –d 1 /dev/hdd) DMA there might be following possibility

Error ::

root@server [~]# hdparm -d 1 /dev/hdd
/dev/hdd:
setting using_dma to 1 (on)
HDIO_SET_DMA failed: Operation not permitted
using_dma = 0 (off)
root@server [~]#

  • Check whether the HD controller supports DMA ?
  • Check whether kernel is compile with DMA module ?

If not please recompile the latest kernel with DMA module , The steps which are particularly relevant to DMA support are as follows:

  • Download a recent kernel from http://www.kernel.org/pub/linux/kernel/v2.6/ URL
  • untar it and run make menuconfig make sure following feature are enable
    General setup —>Device Drivers —>

    <*> ATA/ATAPI/MFM/RLL support —>

    <*> generic/default IDE chipset support

    <*> Generic PCI IDE Chipset Support

    <*> Intel PIIX/ICH chipsets support

  • and then :
    1. #make –> compile kernel, it says “bzimage is ready.”
    2. #make modules
    3. #make modules_install
    4. #make install >> sh /usr/src/linux-2.6.26.5/arch/x86/boot/install.sh 2.6.26.5-VISION arch/x86/boot/bzImage System.map “/boot”
    5. # edit the /etc/grub.conf file and make new complied kernel entry as default
    6. #reboot