Message ID | 20241008184634.245607-5-adhemerval.zanella@linaro.org |
---|---|
State | Accepted |
Commit | f6e849fd7ce2a8954022bd23b94703975b3db0d1 |
Headers | show |
Series | Updates for Linux 6.11 | expand |
On Wed, Oct 9, 2024 at 2:47 AM Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > > This request the page to be never written out to swap, it will be zeroed > under memory pressure (so kernel can just drop the page), it is inherited > by fork, it is not counted against @code{mlock} budget, and if there is > no enough memory to service a page faults there is no fatal error (so not > signal is sent). > > Tested with build-many-glibcs.py. > --- > manual/llio.texi | 9 +++++++++ > sysdeps/unix/sysv/linux/bits/mman-linux.h | 1 + > sysdeps/unix/sysv/linux/tst-mman-consts.py | 2 +- > 3 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/manual/llio.texi b/manual/llio.texi > index a035c3e20f..05ab44c6e7 100644 > --- a/manual/llio.texi > +++ b/manual/llio.texi > @@ -1762,6 +1762,15 @@ write dirty metadata out whenever dirty data is written out. Unlike > most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE} > is also given. > > +@item MAP_DROPPABLE > +Request the page to be never written out to swap, it will be zeroed > +under memory pressure (so kernel can just drop the page), it is inherited > +by fork, it is not counted against @code{mlock} budget, and if there is > +not enough memory to service a page fault there is no fatal error (so no > +signal is sent). > + > +The @code{MAP_DROPPABLE} flag is specific to Linux. > + > @end vtable > > @code{mmap} returns the address of the new mapping, or > diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h > index 522333c50a..161a885096 100644 > --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h > +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h > @@ -43,6 +43,7 @@ > #define MAP_PRIVATE 0x02 /* Changes are private. */ > #define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate > extension flags. */ > +#define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */ > #define MAP_TYPE 0x0f /* Mask for type of mapping. */ > > /* Other flags. */ > diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py > index a1137eb1d5..2191bea36f 100644 > --- a/sysdeps/unix/sysv/linux/tst-mman-consts.py > +++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py > @@ -33,7 +33,7 @@ def main(): > help='C compiler (including options) to use') > args = parser.parse_args() > linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) > - linux_version_glibc = (6, 10) > + linux_version_glibc = (6, 11) > sys.exit(glibcextract.compare_macro_consts( > '#define _GNU_SOURCE 1\n' > '#include <sys/mman.h>\n', > -- > 2.43.0 > We should add a test for it.
On 08/10/24 17:28, H.J. Lu wrote: > On Wed, Oct 9, 2024 at 2:47 AM Adhemerval Zanella > <adhemerval.zanella@linaro.org> wrote: >> >> This request the page to be never written out to swap, it will be zeroed >> under memory pressure (so kernel can just drop the page), it is inherited >> by fork, it is not counted against @code{mlock} budget, and if there is >> no enough memory to service a page faults there is no fatal error (so not >> signal is sent). >> >> Tested with build-many-glibcs.py. >> --- >> manual/llio.texi | 9 +++++++++ >> sysdeps/unix/sysv/linux/bits/mman-linux.h | 1 + >> sysdeps/unix/sysv/linux/tst-mman-consts.py | 2 +- >> 3 files changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/manual/llio.texi b/manual/llio.texi >> index a035c3e20f..05ab44c6e7 100644 >> --- a/manual/llio.texi >> +++ b/manual/llio.texi >> @@ -1762,6 +1762,15 @@ write dirty metadata out whenever dirty data is written out. Unlike >> most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE} >> is also given. >> >> +@item MAP_DROPPABLE >> +Request the page to be never written out to swap, it will be zeroed >> +under memory pressure (so kernel can just drop the page), it is inherited >> +by fork, it is not counted against @code{mlock} budget, and if there is >> +not enough memory to service a page fault there is no fatal error (so no >> +signal is sent). >> + >> +The @code{MAP_DROPPABLE} flag is specific to Linux. >> + >> @end vtable >> >> @code{mmap} returns the address of the new mapping, or >> diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h >> index 522333c50a..161a885096 100644 >> --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h >> +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h >> @@ -43,6 +43,7 @@ >> #define MAP_PRIVATE 0x02 /* Changes are private. */ >> #define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate >> extension flags. */ >> +#define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */ >> #define MAP_TYPE 0x0f /* Mask for type of mapping. */ >> >> /* Other flags. */ >> diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py >> index a1137eb1d5..2191bea36f 100644 >> --- a/sysdeps/unix/sysv/linux/tst-mman-consts.py >> +++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py >> @@ -33,7 +33,7 @@ def main(): >> help='C compiler (including options) to use') >> args = parser.parse_args() >> linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) >> - linux_version_glibc = (6, 10) >> + linux_version_glibc = (6, 11) >> sys.exit(glibcextract.compare_macro_consts( >> '#define _GNU_SOURCE 1\n' >> '#include <sys/mman.h>\n', >> -- >> 2.43.0 >> > > We should add a test for it. > I think it would make sense when glibc itself would use this new flag, this patch is just the usual sync one that just update glibc when a kernel release. In any case, we do have a test for [1] where vgetrandom uses it implicitly. [1] https://patchwork.sourceware.org/project/glibc/patch/20240927192310.2504686-1-adhemerval.zanella@linaro.org/
On Wed, Oct 9, 2024, 7:45 PM Adhemerval Zanella Netto < adhemerval.zanella@linaro.org> wrote: > > > On 08/10/24 17:28, H.J. Lu wrote: > > On Wed, Oct 9, 2024 at 2:47 AM Adhemerval Zanella > > <adhemerval.zanella@linaro.org> wrote: > >> > >> This request the page to be never written out to swap, it will be zeroed > >> under memory pressure (so kernel can just drop the page), it is > inherited > >> by fork, it is not counted against @code{mlock} budget, and if there is > >> no enough memory to service a page faults there is no fatal error (so > not > >> signal is sent). > >> > >> Tested with build-many-glibcs.py. > >> --- > >> manual/llio.texi | 9 +++++++++ > >> sysdeps/unix/sysv/linux/bits/mman-linux.h | 1 + > >> sysdeps/unix/sysv/linux/tst-mman-consts.py | 2 +- > >> 3 files changed, 11 insertions(+), 1 deletion(-) > >> > >> diff --git a/manual/llio.texi b/manual/llio.texi > >> index a035c3e20f..05ab44c6e7 100644 > >> --- a/manual/llio.texi > >> +++ b/manual/llio.texi > >> @@ -1762,6 +1762,15 @@ write dirty metadata out whenever dirty data is > written out. Unlike > >> most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE} > >> is also given. > >> > >> +@item MAP_DROPPABLE > >> +Request the page to be never written out to swap, it will be zeroed > >> +under memory pressure (so kernel can just drop the page), it is > inherited > >> +by fork, it is not counted against @code{mlock} budget, and if there is > >> +not enough memory to service a page fault there is no fatal error (so > no > >> +signal is sent). > >> + > >> +The @code{MAP_DROPPABLE} flag is specific to Linux. > >> + > >> @end vtable > >> > >> @code{mmap} returns the address of the new mapping, or > >> diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h > b/sysdeps/unix/sysv/linux/bits/mman-linux.h > >> index 522333c50a..161a885096 100644 > >> --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h > >> +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h > >> @@ -43,6 +43,7 @@ > >> #define MAP_PRIVATE 0x02 /* Changes are private. */ > >> #define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate > >> extension flags. */ > >> +#define MAP_DROPPABLE 0x08 /* Zero memory under memory > pressure. */ > >> #define MAP_TYPE 0x0f /* Mask for type of mapping. */ > >> > >> /* Other flags. */ > >> diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py > b/sysdeps/unix/sysv/linux/tst-mman-consts.py > >> index a1137eb1d5..2191bea36f 100644 > >> --- a/sysdeps/unix/sysv/linux/tst-mman-consts.py > >> +++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py > >> @@ -33,7 +33,7 @@ def main(): > >> help='C compiler (including options) to use') > >> args = parser.parse_args() > >> linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) > >> - linux_version_glibc = (6, 10) > >> + linux_version_glibc = (6, 11) > >> sys.exit(glibcextract.compare_macro_consts( > >> '#define _GNU_SOURCE 1\n' > >> '#include <sys/mman.h>\n', > >> -- > >> 2.43.0 > >> > > > > We should add a test for it. > > > > I think it would make sense when glibc itself would use this new flag, > this patch > is just the usual sync one that just update glibc when a kernel release. mmap is a special case. A test is desirable. > > In any case, we do have a test for [1] where vgetrandom uses it > implicitly. > > [1] > https://patchwork.sourceware.org/project/glibc/patch/20240927192310.2504686-1-adhemerval.zanella@linaro.org/ > > >
On 09/10/24 08:48, H.J. Lu wrote: > > On Wed, Oct 9, 2024, 7:45 PM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote: > > > > On 08/10/24 17:28, H.J. Lu wrote: > > On Wed, Oct 9, 2024 at 2:47 AM Adhemerval Zanella > > <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote: > >> > >> This request the page to be never written out to swap, it will be zeroed > >> under memory pressure (so kernel can just drop the page), it is inherited > >> by fork, it is not counted against @code{mlock} budget, and if there is > >> no enough memory to service a page faults there is no fatal error (so not > >> signal is sent). > >> > >> Tested with build-many-glibcs.py. > >> --- > >> manual/llio.texi | 9 +++++++++ > >> sysdeps/unix/sysv/linux/bits/mman-linux.h | 1 + > >> sysdeps/unix/sysv/linux/tst-mman-consts.py | 2 +- > >> 3 files changed, 11 insertions(+), 1 deletion(-) > >> > >> diff --git a/manual/llio.texi b/manual/llio.texi > >> index a035c3e20f..05ab44c6e7 100644 > >> --- a/manual/llio.texi > >> +++ b/manual/llio.texi > >> @@ -1762,6 +1762,15 @@ write dirty metadata out whenever dirty data is written out. Unlike > >> most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE} > >> is also given. > >> > >> +@item MAP_DROPPABLE > >> +Request the page to be never written out to swap, it will be zeroed > >> +under memory pressure (so kernel can just drop the page), it is inherited > >> +by fork, it is not counted against @code{mlock} budget, and if there is > >> +not enough memory to service a page fault there is no fatal error (so no > >> +signal is sent). > >> + > >> +The @code{MAP_DROPPABLE} flag is specific to Linux. > >> + > >> @end vtable > >> > >> @code{mmap} returns the address of the new mapping, or > >> diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h > >> index 522333c50a..161a885096 100644 > >> --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h > >> +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h > >> @@ -43,6 +43,7 @@ > >> #define MAP_PRIVATE 0x02 /* Changes are private. */ > >> #define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate > >> extension flags. */ > >> +#define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */ > >> #define MAP_TYPE 0x0f /* Mask for type of mapping. */ > >> > >> /* Other flags. */ > >> diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py > >> index a1137eb1d5..2191bea36f 100644 > >> --- a/sysdeps/unix/sysv/linux/tst-mman-consts.py > >> +++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py > >> @@ -33,7 +33,7 @@ def main(): > >> help='C compiler (including options) to use') > >> args = parser.parse_args() > >> linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) > >> - linux_version_glibc = (6, 10) > >> + linux_version_glibc = (6, 11) > >> sys.exit(glibcextract.compare_macro_consts( > >> '#define _GNU_SOURCE 1\n' > >> '#include <sys/mman.h>\n', > >> -- > >> 2.43.0 > >> > > > > We should add a test for it. > > > > I think it would make sense when glibc itself would use this new flag, this patch > is just the usual sync one that just update glibc when a kernel release. > > > mmap is a special case. A test is desirable. I am not sure if we should do functional kernel testing in this case, and the VM_DROPPABLE test in also tricky because to fully tests requires to apply some system memory pressure (so the page is dropped).
On Wed, Oct 9, 2024 at 9:37 PM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> wrote: > > > > On 09/10/24 08:48, H.J. Lu wrote: > > > > On Wed, Oct 9, 2024, 7:45 PM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote: > > > > > > > > On 08/10/24 17:28, H.J. Lu wrote: > > > On Wed, Oct 9, 2024 at 2:47 AM Adhemerval Zanella > > > <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote: > > >> > > >> This request the page to be never written out to swap, it will be zeroed > > >> under memory pressure (so kernel can just drop the page), it is inherited > > >> by fork, it is not counted against @code{mlock} budget, and if there is > > >> no enough memory to service a page faults there is no fatal error (so not > > >> signal is sent). > > >> > > >> Tested with build-many-glibcs.py. > > >> --- > > >> manual/llio.texi | 9 +++++++++ > > >> sysdeps/unix/sysv/linux/bits/mman-linux.h | 1 + > > >> sysdeps/unix/sysv/linux/tst-mman-consts.py | 2 +- > > >> 3 files changed, 11 insertions(+), 1 deletion(-) > > >> > > >> diff --git a/manual/llio.texi b/manual/llio.texi > > >> index a035c3e20f..05ab44c6e7 100644 > > >> --- a/manual/llio.texi > > >> +++ b/manual/llio.texi > > >> @@ -1762,6 +1762,15 @@ write dirty metadata out whenever dirty data is written out. Unlike > > >> most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE} > > >> is also given. > > >> > > >> +@item MAP_DROPPABLE > > >> +Request the page to be never written out to swap, it will be zeroed > > >> +under memory pressure (so kernel can just drop the page), it is inherited > > >> +by fork, it is not counted against @code{mlock} budget, and if there is > > >> +not enough memory to service a page fault there is no fatal error (so no > > >> +signal is sent). > > >> + > > >> +The @code{MAP_DROPPABLE} flag is specific to Linux. > > >> + > > >> @end vtable > > >> > > >> @code{mmap} returns the address of the new mapping, or > > >> diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h > > >> index 522333c50a..161a885096 100644 > > >> --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h > > >> +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h > > >> @@ -43,6 +43,7 @@ > > >> #define MAP_PRIVATE 0x02 /* Changes are private. */ > > >> #define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate > > >> extension flags. */ > > >> +#define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */ > > >> #define MAP_TYPE 0x0f /* Mask for type of mapping. */ > > >> > > >> /* Other flags. */ > > >> diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py > > >> index a1137eb1d5..2191bea36f 100644 > > >> --- a/sysdeps/unix/sysv/linux/tst-mman-consts.py > > >> +++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py > > >> @@ -33,7 +33,7 @@ def main(): > > >> help='C compiler (including options) to use') > > >> args = parser.parse_args() > > >> linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) > > >> - linux_version_glibc = (6, 10) > > >> + linux_version_glibc = (6, 11) > > >> sys.exit(glibcextract.compare_macro_consts( > > >> '#define _GNU_SOURCE 1\n' > > >> '#include <sys/mman.h>\n', > > >> -- > > >> 2.43.0 > > >> > > > > > > We should add a test for it. > > > > > > > I think it would make sense when glibc itself would use this new flag, this patch > > is just the usual sync one that just update glibc when a kernel release. > > > > > > mmap is a special case. A test is desirable. > > I am not sure if we should do functional kernel testing in this case, and the VM_DROPPABLE > test in also tricky because to fully tests requires to apply some system memory pressure > (so the page is dropped). > We have run into the MAP_XXX problem before. We should add a test for each new MAP_XXX. Ther kernel test, tools/testing/selftests/mm/droppable.c, looks reasonable for glibc.
On Thu, Oct 10, 2024 at 5:12 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Wed, Oct 9, 2024 at 9:37 PM Adhemerval Zanella Netto > <adhemerval.zanella@linaro.org> wrote: > > > > > > > > On 09/10/24 08:48, H.J. Lu wrote: > > > > > > On Wed, Oct 9, 2024, 7:45 PM Adhemerval Zanella Netto <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote: > > > > > > > > > > > > On 08/10/24 17:28, H.J. Lu wrote: > > > > On Wed, Oct 9, 2024 at 2:47 AM Adhemerval Zanella > > > > <adhemerval.zanella@linaro.org <mailto:adhemerval.zanella@linaro.org>> wrote: > > > >> > > > >> This request the page to be never written out to swap, it will be zeroed > > > >> under memory pressure (so kernel can just drop the page), it is inherited > > > >> by fork, it is not counted against @code{mlock} budget, and if there is > > > >> no enough memory to service a page faults there is no fatal error (so not > > > >> signal is sent). > > > >> > > > >> Tested with build-many-glibcs.py. > > > >> --- > > > >> manual/llio.texi | 9 +++++++++ > > > >> sysdeps/unix/sysv/linux/bits/mman-linux.h | 1 + > > > >> sysdeps/unix/sysv/linux/tst-mman-consts.py | 2 +- > > > >> 3 files changed, 11 insertions(+), 1 deletion(-) > > > >> > > > >> diff --git a/manual/llio.texi b/manual/llio.texi > > > >> index a035c3e20f..05ab44c6e7 100644 > > > >> --- a/manual/llio.texi > > > >> +++ b/manual/llio.texi > > > >> @@ -1762,6 +1762,15 @@ write dirty metadata out whenever dirty data is written out. Unlike > > > >> most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE} > > > >> is also given. > > > >> > > > >> +@item MAP_DROPPABLE > > > >> +Request the page to be never written out to swap, it will be zeroed > > > >> +under memory pressure (so kernel can just drop the page), it is inherited > > > >> +by fork, it is not counted against @code{mlock} budget, and if there is > > > >> +not enough memory to service a page fault there is no fatal error (so no > > > >> +signal is sent). > > > >> + > > > >> +The @code{MAP_DROPPABLE} flag is specific to Linux. > > > >> + > > > >> @end vtable > > > >> > > > >> @code{mmap} returns the address of the new mapping, or > > > >> diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h > > > >> index 522333c50a..161a885096 100644 > > > >> --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h > > > >> +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h > > > >> @@ -43,6 +43,7 @@ > > > >> #define MAP_PRIVATE 0x02 /* Changes are private. */ > > > >> #define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate > > > >> extension flags. */ > > > >> +#define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */ > > > >> #define MAP_TYPE 0x0f /* Mask for type of mapping. */ > > > >> > > > >> /* Other flags. */ > > > >> diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py > > > >> index a1137eb1d5..2191bea36f 100644 > > > >> --- a/sysdeps/unix/sysv/linux/tst-mman-consts.py > > > >> +++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py > > > >> @@ -33,7 +33,7 @@ def main(): > > > >> help='C compiler (including options) to use') > > > >> args = parser.parse_args() > > > >> linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) > > > >> - linux_version_glibc = (6, 10) > > > >> + linux_version_glibc = (6, 11) > > > >> sys.exit(glibcextract.compare_macro_consts( > > > >> '#define _GNU_SOURCE 1\n' > > > >> '#include <sys/mman.h>\n', > > > >> -- > > > >> 2.43.0 > > > >> > > > > > > > > We should add a test for it. > > > > > > > > > > I think it would make sense when glibc itself would use this new flag, this patch > > > is just the usual sync one that just update glibc when a kernel release. > > > > > > > > > mmap is a special case. A test is desirable. > > > > I am not sure if we should do functional kernel testing in this case, and the VM_DROPPABLE > > test in also tricky because to fully tests requires to apply some system memory pressure > > (so the page is dropped). > > > > We have run into the MAP_XXX problem before. We should add a test > for each new MAP_XXX. Ther kernel test, tools/testing/selftests/mm/droppable.c, > looks reasonable for glibc. > Never mind. It was mremap, not mmap.
On Wed, Oct 9, 2024 at 2:47 AM Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > > This request the page to be never written out to swap, it will be zeroed > under memory pressure (so kernel can just drop the page), it is inherited > by fork, it is not counted against @code{mlock} budget, and if there is > no enough memory to service a page faults there is no fatal error (so not > signal is sent). > > Tested with build-many-glibcs.py. > --- > manual/llio.texi | 9 +++++++++ > sysdeps/unix/sysv/linux/bits/mman-linux.h | 1 + > sysdeps/unix/sysv/linux/tst-mman-consts.py | 2 +- > 3 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/manual/llio.texi b/manual/llio.texi > index a035c3e20f..05ab44c6e7 100644 > --- a/manual/llio.texi > +++ b/manual/llio.texi > @@ -1762,6 +1762,15 @@ write dirty metadata out whenever dirty data is written out. Unlike > most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE} > is also given. > > +@item MAP_DROPPABLE > +Request the page to be never written out to swap, it will be zeroed > +under memory pressure (so kernel can just drop the page), it is inherited > +by fork, it is not counted against @code{mlock} budget, and if there is > +not enough memory to service a page fault there is no fatal error (so no > +signal is sent). > + > +The @code{MAP_DROPPABLE} flag is specific to Linux. > + > @end vtable > > @code{mmap} returns the address of the new mapping, or > diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h > index 522333c50a..161a885096 100644 > --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h > +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h > @@ -43,6 +43,7 @@ > #define MAP_PRIVATE 0x02 /* Changes are private. */ > #define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate > extension flags. */ > +#define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */ > #define MAP_TYPE 0x0f /* Mask for type of mapping. */ > > /* Other flags. */ > diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py > index a1137eb1d5..2191bea36f 100644 > --- a/sysdeps/unix/sysv/linux/tst-mman-consts.py > +++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py > @@ -33,7 +33,7 @@ def main(): > help='C compiler (including options) to use') > args = parser.parse_args() > linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) > - linux_version_glibc = (6, 10) > + linux_version_glibc = (6, 11) > sys.exit(glibcextract.compare_macro_consts( > '#define _GNU_SOURCE 1\n' > '#include <sys/mman.h>\n', > -- > 2.43.0 > LGTM. Reviewed-by: H.J. Lu <hjl.tools@gmail.com> Thanks.
diff --git a/manual/llio.texi b/manual/llio.texi index a035c3e20f..05ab44c6e7 100644 --- a/manual/llio.texi +++ b/manual/llio.texi @@ -1762,6 +1762,15 @@ write dirty metadata out whenever dirty data is written out. Unlike most other flags, this one will fail unless @code{MAP_SHARED_VALIDATE} is also given. +@item MAP_DROPPABLE +Request the page to be never written out to swap, it will be zeroed +under memory pressure (so kernel can just drop the page), it is inherited +by fork, it is not counted against @code{mlock} budget, and if there is +not enough memory to service a page fault there is no fatal error (so no +signal is sent). + +The @code{MAP_DROPPABLE} flag is specific to Linux. + @end vtable @code{mmap} returns the address of the new mapping, or diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h index 522333c50a..161a885096 100644 --- a/sysdeps/unix/sysv/linux/bits/mman-linux.h +++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h @@ -43,6 +43,7 @@ #define MAP_PRIVATE 0x02 /* Changes are private. */ #define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate extension flags. */ +#define MAP_DROPPABLE 0x08 /* Zero memory under memory pressure. */ #define MAP_TYPE 0x0f /* Mask for type of mapping. */ /* Other flags. */ diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py index a1137eb1d5..2191bea36f 100644 --- a/sysdeps/unix/sysv/linux/tst-mman-consts.py +++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py @@ -33,7 +33,7 @@ def main(): help='C compiler (including options) to use') args = parser.parse_args() linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc) - linux_version_glibc = (6, 10) + linux_version_glibc = (6, 11) sys.exit(glibcextract.compare_macro_consts( '#define _GNU_SOURCE 1\n' '#include <sys/mman.h>\n',