1 |
On 28/08/2022 15:21, Rich Freeman wrote: |
2 |
> Something I wish linux supported was discardable memory, for |
3 |
> caches/etc. A program should be able to allocate memory while passing |
4 |
> a hint to the kernel saying that the memory is discardable. |
5 |
|
6 |
Linux DOES have that ... |
7 |
|
8 |
I'm not sure how to use it, but you can pass a flag to open(), which |
9 |
says "do not cache this file". The obvious use case is something like |
10 |
cp, but there's plenty of others. Or there are applications which cache |
11 |
stuff in the app, so don't want to waste OS cache as well - databases |
12 |
are a prime example. |
13 |
|
14 |
Apparently not only does memory use crash when this is actively used, |
15 |
but because the OS does not have to manage cache, speed is actually |
16 |
noticeably impacted. Given the obsession kernel devs have with not |
17 |
wasting memory and time, this is likely to be actively maintained and |
18 |
supported. We just need to find out how to access this from user space. |
19 |
|
20 |
Cheers, |
21 |
Wol |