Gentoo Archives: gentoo-user

From: Wols Lists <antlists@××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Limiting amount of memory a program can use.
Date: Sun, 28 Aug 2022 15:32:08
Message-Id: 2895bfbc-5795-5729-69c5-1fd15874d35d@youngman.org.uk
In Reply to: Re: [gentoo-user] Limiting amount of memory a program can use. by Rich Freeman
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

Replies

Subject Author
Re: [gentoo-user] Limiting amount of memory a program can use. Rich Freeman <rich0@g.o>