diff mbox series

mmap_24-1: update code comments

Message ID 20250509123410.22406-1-liwang@redhat.com
State Accepted
Headers show
Series mmap_24-1: update code comments | expand

Checks

Context Check Description
ltpci/debian_stable_s390x-linux-gnu-gcc_s390x success success
ltpci/debian_stable_aarch64-linux-gnu-gcc_arm64 success success
ltpci/debian_stable_powerpc64le-linux-gnu-gcc_ppc64el success success
ltpci/debian_stable_gcc success success
ltpci/debian_stable_gcc success success
ltpci/ubuntu_jammy_gcc success success
ltpci/quay-io-centos-centos_stream9_gcc success success
ltpci/opensuse-archive_42-2_gcc success success
ltpci/opensuse-leap_latest_gcc success success
ltpci/debian_testing_gcc success success
ltpci/alpine_latest_gcc success success
ltpci/fedora_latest_clang success success
ltpci/ubuntu_bionic_gcc success success
ltpci/debian_testing_clang success success
ltpci/debian_oldstable_clang success success
ltpci/debian_oldstable_gcc success success

Commit Message

Li Wang May 9, 2025, 12:34 p.m. UTC
Follow-up: mmap_24-1: Change vm.max_map_count if needed
Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Martin Doucha <mdoucha@suse.cz>
---

Notes:
    This patch is based on Martin's vm.max_map_count change, to make
    everything is clear enough from the code to comments.

 .../conformance/interfaces/mmap/24-1.c        | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

Martin Doucha May 9, 2025, 1:28 p.m. UTC | #1
Hi,
thank you.

Reviewed-by: Martin Doucha <mdoucha@suse.cz>

On 09. 05. 25 14:34, Li Wang wrote:
> Follow-up: mmap_24-1: Change vm.max_map_count if needed
> Signed-off-by: Li Wang <liwang@redhat.com>
> Cc: Martin Doucha <mdoucha@suse.cz>
> ---
> 
> Notes:
>      This patch is based on Martin's vm.max_map_count change, to make
>      everything is clear enough from the code to comments.
> 
>   .../conformance/interfaces/mmap/24-1.c        | 20 +++++++++++++------
>   1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
> index 49673d603..8aebdba61 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
> @@ -7,15 +7,23 @@
>    * source tree.
>    *
>    * The mmap() function shall fail if:
> - * [ENOMEM] MAP_FIXED was specified, and the range [addr,addr+len)
> + * [ENOMEM] MAP_FIXED was specified, and the range [addr, addr+len)
>    * exceeds that allowed for the address space of a process;
> - * or, if MAP_FIXED was not specified and
> - * there is insufficient room in the address space to effect the mapping.
> + * or, if MAP_FIXED was not specified and there is insufficient room
> + * in the address space to effect the mapping;
> + * or, if the process exceeds the maximum number of allowed memory mappings
> + * (as defined by /proc/sys/vm/max_map_count).
>    *
>    * Test Steps:
> - * 1. In a very long loop, keep mapping a shared memory object,
> - *    until there this insufficient room in the address space;
> - * 3. Should get ENOMEM.
> + * 1. In a very long loop, continuously map a shared memory object without
> + *    unmapping previous ones.
> + * 2. The loop continues until mmap() fails with ENOMEM.
> + *
> + * Note:
> + * This failure may occur due to either exhausting the process's
> + * virtual address space, or hitting the system-wide limit on
> + * the number of memory mappings (especially on systems with large RAM).
> + *
>    */
>   
>   #include <stdio.h>
Petr Vorel May 12, 2025, 1:26 p.m. UTC | #2
Hi Li,

> Follow-up: mmap_24-1: Change vm.max_map_count if needed

Thanks!
...
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
> @@ -7,15 +7,23 @@
>   * source tree.
>   *
>   * The mmap() function shall fail if:
> - * [ENOMEM] MAP_FIXED was specified, and the range [addr,addr+len)
> + * [ENOMEM] MAP_FIXED was specified, and the range [addr, addr+len)
>   * exceeds that allowed for the address space of a process;
> - * or, if MAP_FIXED was not specified and
> - * there is insufficient room in the address space to effect the mapping.
> + * or, if MAP_FIXED was not specified and there is insufficient room
> + * in the address space to effect the mapping;
> + * or, if the process exceeds the maximum number of allowed memory mappings
> + * (as defined by /proc/sys/vm/max_map_count).
>   *
>   * Test Steps:
> - * 1. In a very long loop, keep mapping a shared memory object,
> - *    until there this insufficient room in the address space;
> - * 3. Should get ENOMEM.
> + * 1. In a very long loop, continuously map a shared memory object without
> + *    unmapping previous ones.
> + * 2. The loop continues until mmap() fails with ENOMEM.
> + *
> + * Note:
> + * This failure may occur due to either exhausting the process's
> + * virtual address space, or hitting the system-wide limit on
> + * the number of memory mappings (especially on systems with large RAM).
> + *
nit: please remove before commit this blank line.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

>   */
Li Wang May 12, 2025, 2:35 p.m. UTC | #3
On Mon, May 12, 2025 at 9:26 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Li,
>
> > Follow-up: mmap_24-1: Change vm.max_map_count if needed
>
> Thanks!
> ...
> > +++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
> > @@ -7,15 +7,23 @@
> >   * source tree.
> >   *
> >   * The mmap() function shall fail if:
> > - * [ENOMEM] MAP_FIXED was specified, and the range [addr,addr+len)
> > + * [ENOMEM] MAP_FIXED was specified, and the range [addr, addr+len)
> >   * exceeds that allowed for the address space of a process;
> > - * or, if MAP_FIXED was not specified and
> > - * there is insufficient room in the address space to effect the
> mapping.
> > + * or, if MAP_FIXED was not specified and there is insufficient room
> > + * in the address space to effect the mapping;
> > + * or, if the process exceeds the maximum number of allowed memory
> mappings
> > + * (as defined by /proc/sys/vm/max_map_count).
> >   *
> >   * Test Steps:
> > - * 1. In a very long loop, keep mapping a shared memory object,
> > - *    until there this insufficient room in the address space;
> > - * 3. Should get ENOMEM.
> > + * 1. In a very long loop, continuously map a shared memory object
> without
> > + *    unmapping previous ones.
> > + * 2. The loop continues until mmap() fails with ENOMEM.
> > + *
> > + * Note:
> > + * This failure may occur due to either exhausting the process's
> > + * virtual address space, or hitting the system-wide limit on
> > + * the number of memory mappings (especially on systems with large RAM).
> > + *
> nit: please remove before commit this blank line.
>

Ah sure, merged as you suggested.
Thanks!
diff mbox series

Patch

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
index 49673d603..8aebdba61 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-1.c
@@ -7,15 +7,23 @@ 
  * source tree.
  *
  * The mmap() function shall fail if:
- * [ENOMEM] MAP_FIXED was specified, and the range [addr,addr+len)
+ * [ENOMEM] MAP_FIXED was specified, and the range [addr, addr+len)
  * exceeds that allowed for the address space of a process;
- * or, if MAP_FIXED was not specified and
- * there is insufficient room in the address space to effect the mapping.
+ * or, if MAP_FIXED was not specified and there is insufficient room
+ * in the address space to effect the mapping;
+ * or, if the process exceeds the maximum number of allowed memory mappings
+ * (as defined by /proc/sys/vm/max_map_count).
  *
  * Test Steps:
- * 1. In a very long loop, keep mapping a shared memory object,
- *    until there this insufficient room in the address space;
- * 3. Should get ENOMEM.
+ * 1. In a very long loop, continuously map a shared memory object without
+ *    unmapping previous ones.
+ * 2. The loop continues until mmap() fails with ENOMEM.
+ *
+ * Note:
+ * This failure may occur due to either exhausting the process's
+ * virtual address space, or hitting the system-wide limit on
+ * the number of memory mappings (especially on systems with large RAM).
+ *
  */
 
 #include <stdio.h>