Re: [PATCH v1 8/9] util/mmap-alloc: support RAM_NORESERVE via MAP_NORESERVE

2021-03-04 Thread David Hildenbrand
I want to warn the user right away that the configuration is messed up and that "reserved=off" is not effective. For anonymous memory, "reserved=off" will start really being useful when having a way to dynamically reserve swap space. I think it's fine to have that early failure, it just seems

Re: [PATCH v1 8/9] util/mmap-alloc: support RAM_NORESERVE via MAP_NORESERVE

2021-03-03 Thread Peter Xu
On Wed, Mar 03, 2021 at 11:14:10AM +0100, David Hildenbrand wrote: > On 02.03.21 22:44, Peter Xu wrote: > > On Tue, Mar 02, 2021 at 08:01:11PM +0100, David Hildenbrand wrote: > > > On 02.03.21 18:51, Peter Xu wrote: > > > > On Tue, Feb 09, 2021 at 02:49:38PM +0100, David Hildenbrand wrote: > > > >

Re: [PATCH v1 8/9] util/mmap-alloc: support RAM_NORESERVE via MAP_NORESERVE

2021-03-03 Thread David Hildenbrand
On 02.03.21 22:44, Peter Xu wrote: On Tue, Mar 02, 2021 at 08:01:11PM +0100, David Hildenbrand wrote: On 02.03.21 18:51, Peter Xu wrote: On Tue, Feb 09, 2021 at 02:49:38PM +0100, David Hildenbrand wrote: +#define OVERCOMMIT_MEMORY_PATH "/proc/sys/vm/overcommit_memory" +static bool map_noreserv

Re: [PATCH v1 8/9] util/mmap-alloc: support RAM_NORESERVE via MAP_NORESERVE

2021-03-02 Thread Peter Xu
On Tue, Mar 02, 2021 at 08:01:11PM +0100, David Hildenbrand wrote: > On 02.03.21 18:51, Peter Xu wrote: > > On Tue, Feb 09, 2021 at 02:49:38PM +0100, David Hildenbrand wrote: > > > +#define OVERCOMMIT_MEMORY_PATH "/proc/sys/vm/overcommit_memory" > > > +static bool map_noreserve_effective(int fd, bo

Re: [PATCH v1 8/9] util/mmap-alloc: support RAM_NORESERVE via MAP_NORESERVE

2021-03-02 Thread David Hildenbrand
On 02.03.21 18:51, Peter Xu wrote: On Tue, Feb 09, 2021 at 02:49:38PM +0100, David Hildenbrand wrote: +#define OVERCOMMIT_MEMORY_PATH "/proc/sys/vm/overcommit_memory" +static bool map_noreserve_effective(int fd, bool shared) +{ +#if defined(__linux__) +gchar *content = NULL; +const char

Re: [PATCH v1 8/9] util/mmap-alloc: support RAM_NORESERVE via MAP_NORESERVE

2021-03-02 Thread Peter Xu
On Tue, Feb 09, 2021 at 02:49:38PM +0100, David Hildenbrand wrote: > +#define OVERCOMMIT_MEMORY_PATH "/proc/sys/vm/overcommit_memory" > +static bool map_noreserve_effective(int fd, bool shared) > +{ > +#if defined(__linux__) > +gchar *content = NULL; > +const char *endptr; > +unsigned i

[PATCH v1 8/9] util/mmap-alloc: support RAM_NORESERVE via MAP_NORESERVE

2021-02-09 Thread David Hildenbrand
Let's support RAM_NORESERVE via MAP_NORESERVE. At least on Linux, the flag has no effect on shared mappings - except for anonymous memory and hugetlbfs. Linux man page: "MAP_NORESERVE: Do not reserve swap space for this mapping. When swap space is reserved, one has the guarantee that it is pos