lkml.org 
[lkml]   [2012]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH mm] limit the mm->map_count not greater than sysctl_max_map_count
From
Date
On Wed, 2012-04-18 at 21:28 +0800, Cong Wang wrote:
> On 04/18/2012 05:27 PM, Li Zhong wrote:
> > When reading the mmap codes, I found the checking of mm->map_count
> > against sysctl_max_map_count is not consistent. At some places, ">" is
> > used; at some other places, ">=" is used.
> >
> > This patch changes ">" to">=", so they are consistent, and makes sure
> > the value is not greater (one more) than sysctl_max_map_count.
> >
>
> Well, according to Documentation/sysctl/vm.txt,
>
> max_map_count:
>
> This file contains the maximum number of memory map areas a process
> may have. [...]
>
> I think ->map_count == sysctl_max_map_count should be allowed, so using
> '>' is correct.
>
Yes, I agree that ->map_count == sysctl_max_map_count should be allowed.
However, with '>' used. The ->map_count could be sysctl_max_map_count+1.
It could be seen with a simple program doing continuously mmaping of a
file.

( Still it is possible, as stated in the comments of do_munmap code, if
the VMA is going to be divided into two, the map_count could temporarily
be sysctl_max_map_count+1, after the original vma split into two, and
before one of the two vmas removed. )




\
 
 \ /
  Last update: 2012-04-19 03:45    [W:0.058 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site