Re: [PATCH v4 1/5] mm: Document lenient map_count checks

From: David Hildenbrand (Red Hat)
Date: Mon Nov 03 2025 - 12:16:09 EST


On 28.10.25 22:24, Kalesh Singh wrote:
Add comments to the map_count limit checks in do_mmap() and
do_brk_flags() to clarify their intended behavior.

The use of a strict inequality ('>') in these checks is intentional but
non-obvious. It allows these functions to succeed when the VMA count is
exactly at the sysctl_max_map_count limit. This historical behavior
accounts for cases where the operation might not create a new VMA, but
instead merge with or expand an existing one, in which case the VMA
count does not increase.

These comments clarify the long-standing behavior and will help prevent
future misinterpretation as an off-by-one error.

Signed-off-by: Kalesh Singh <kaleshsingh@xxxxxxxxxx>
---


Acked-by: David Hildenbrand (Red Hat) <david@xxxxxxxxxx>

--
Cheers

David