Say, I have a huge file which I want to load into memory. Is it possible to use the DMA to quickly load the data from the file into the memory in Linux? If so, how?
What makes you think that all file reads aren't done via DMA? Do you mean you want to access HW directly rather than calling mmap or something along those lines?
Hard drive controllers, such as the built in SATA interface on a motherboard use a bus mastering controller which supports scatter / gather in order to work with virtual paged memory. The virtual memory is "locked", and the physical pages and lengths are programmed into an array of "descriptors". For large I/O with a single command, the "descriptors" may get reprogrammed during the I/O.
Your code interacts with the kernel using syscalls(2). Use strace to find out which. So your question about fread using DMA does not have much sense: fread uses read(2) which is done by the kernel which might do DMA (inside the kernel).
If DMA is available then the driver is probably already using it. If you want high-speed direct access to a file then use mmap(2) instead of second-guessing the OS.
mmapor something along those lines?straceto find out which. So your question aboutfreadusingDMAdoes not have much sense:freadusesread(2)which is done by the kernel which might do DMA (inside the kernel).