Backup process flushes disk cache

I've got a backup process which reads quite a lot of data from disk, and therefore uses up all memory for disk cache, swapping off apps and other cached data in the process. There is no benefit to keep backuped data in disk cache after the backup is finished, so I'd like to limit the amount of data which could be cached by kernel for that process. Is it possible?

Thanks,


Fix the backup process so that it opens files with O_DIRECT, or so that it regularly calls posix_fadvise(..., POSIX_FADV_DONTNEED) when it's done with a block of data.

Or complain to whoever is responsible for the backup program to fix it per the above.

Alternatively, you can make a filter library which does the above and LD_PRELOAD that library when running the backup process.