Introduce DMA_BUF_IOCTL_RW_FILE ioctl for direct file I/O on dma-buf objects.

CURRENT WORKFLOW:
1. Allocate dma-buf:
   dmabuf_fd = dmabuf_alloc(len, heap_fd)
2. Map memory:
   vaddr = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, dmabuf_fd, 0)
3. File operations:
   file_fd = open(file_path, O_RDONLY)
   lseek(file_fd, pos)
   // 70% time spent on page cache management and memory copies
   read(file_fd, vaddr, len)

KEY OPTIMIZATIONS:
- Convert sg_table to bio_vec
- Enable IOCB_DIRECT flag
- Execute I/O via vfs_iocb_iter_read()

OPTIMIZED WORKFLOW:
   dmabuf_fd = dmabuf_alloc(len, heap_fd)
   file_fd = open(file_path, O_RDONLY)
   if (direct_io) arg.flags |= DMA_BUF_RW_FLAGS_DIRECT
   ioctl(dmabuf_fd, DMA_BUF_IOCTL_RW_FILE, &arg)

PERFORMANCE RESULTS:
- Throughput: 3776 MB/s (UFS 4.0 4GB/s limit)
- Page cache overhead eliminated
- Direct data path reduces memory copies

APPLICABLE SCENARIOS:
- AI model loading
- Real-time data acquisition
- Task snapshot persistence

Reply via email to