Is it possible to selectively clear content from a particular filesystem, or file/directory within a filesystem, under Linux.
This can be done globally with sync; echo 3 > /proc/sys/vm/drop_caches
and for a whole filesystem by temporarily umounting and remounting it, but I've not come across a more fine grained option.
Why would I want this? If there had been a bunch of block cached due to I/O from a process that is going to repeat later, and then a one-off (or regular but not frequent) task is run that results in a chunk of data getting cached (but not enough to push the first lot out), I might like to tell the kernel that I no longer care about the second lot of blocks so that if a third chunk of I/O occurs it gets nixed not the first lot that was loaded from disc - so the soon-to-repeat task isn't slowed down on next run due to the one-off task.
Alternately, is there a way to start a process in such a way as to tell the kernel "this is a one off, don't go out of your way to cache what it touches after it finishes".
This could of course be me wanting to waste time micromanaging something that I should leave well along and let the kernel get on with without interference...