On 28/08/2022 15:21, Rich Freeman wrote:
Something I wish linux supported was discardable memory, for
caches/etc.  A program should be able to allocate memory while passing
a hint to the kernel saying that the memory is discardable.

Linux DOES have that ...

I'm not sure how to use it, but you can pass a flag to open(), which says "do not cache this file". The obvious use case is something like cp, but there's plenty of others. Or there are applications which cache stuff in the app, so don't want to waste OS cache as well - databases are a prime example.

Apparently not only does memory use crash when this is actively used, but because the OS does not have to manage cache, speed is actually noticeably impacted. Given the obsession kernel devs have with not wasting memory and time, this is likely to be actively maintained and supported. We just need to find out how to access this from user space.

Cheers,
Wol

Reply via email to