Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-25 Thread Florian Weimer
On 09/25/2017 04:52 PM, Michal Hocko wrote: On Mon 25-09-17 15:16:09, Florian Weimer wrote: On 09/25/2017 02:52 PM, Michal Hocko wrote: So, how are you going to deal with the CoW and the implementation which basically means that the newm mmap content is not the same as the original one? I don

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-25 Thread Michal Hocko
On Mon 25-09-17 15:16:09, Florian Weimer wrote: > On 09/25/2017 02:52 PM, Michal Hocko wrote: > > So, how are you going to deal with the CoW and the implementation which > > basically means that the newm mmap content is not the same as the > > original one? > > I don't understand why CoW would kic

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-25 Thread Florian Weimer
On 09/25/2017 02:52 PM, Michal Hocko wrote: So, how are you going to deal with the CoW and the implementation which basically means that the newm mmap content is not the same as the original one? I don't understand why CoW would kick in. The approach I outlined is desirable because it avoids

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-25 Thread Michal Hocko
On Mon 25-09-17 14:40:42, Florian Weimer wrote: > On 09/25/2017 02:35 PM, Michal Hocko wrote: > > What would be the usecase. I mean why don't you simply create a new > > mapping by a plain mmap when you have no guarantee about the same > > content? > > I plan to use it for creating an unbounded nu

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-25 Thread Florian Weimer
On 09/25/2017 02:35 PM, Michal Hocko wrote: What would be the usecase. I mean why don't you simply create a new mapping by a plain mmap when you have no guarantee about the same content? I plan to use it for creating an unbounded number of callback thunks at run time, from a single set of page

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-25 Thread Michal Hocko
On Tue 19-09-17 14:11:19, Florian Weimer wrote: > On 09/18/2017 07:11 PM, Mike Kravetz wrote: [...] > > I can drop this wording, but would still like to suggest memfd_create as > > the preferred method of creating duplicate mappings. It would be good if > > others on Cc: could comment as well. >

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-19 Thread Florian Weimer
On 09/18/2017 07:11 PM, Mike Kravetz wrote: On 09/18/2017 06:45 AM, Florian Weimer wrote: On 09/15/2017 11:53 PM, Mike Kravetz wrote: +If the value of \fIold_size\fP is zero, and \fIold_address\fP refers to +a private anonymous mapping, then +.BR mremap () +will create a new mapping of the same

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-18 Thread Mike Kravetz
On 09/17/2017 06:52 PM, Jann Horn wrote: > On Fri, Sep 15, 2017 at 2:37 PM, Mike Kravetz wrote: > [...] >> A recent change was made to mremap so that an attempt to create a >> duplicate a private mapping will fail. >> >> commit dba58d3b8c5045ad89c1c95d33d01451e3964db7 >> Author: Mike Kravetz >> D

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-18 Thread Mike Kravetz
On 09/18/2017 06:45 AM, Florian Weimer wrote: > On 09/15/2017 11:53 PM, Mike Kravetz wrote: >> +If the value of \fIold_size\fP is zero, and \fIold_address\fP refers to >> +a private anonymous mapping, then >> +.BR mremap () >> +will create a new mapping of the same pages. \fInew_size\fP >> +will be

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-18 Thread Florian Weimer
On 09/15/2017 11:53 PM, Mike Kravetz wrote: +If the value of \fIold_size\fP is zero, and \fIold_address\fP refers to +a private anonymous mapping, then +.BR mremap () +will create a new mapping of the same pages. \fInew_size\fP +will be the size of the new mapping and the location of the new mapp

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-17 Thread Jann Horn
On Fri, Sep 15, 2017 at 2:37 PM, Mike Kravetz wrote: [...] > A recent change was made to mremap so that an attempt to create a > duplicate a private mapping will fail. > > commit dba58d3b8c5045ad89c1c95d33d01451e3964db7 > Author: Mike Kravetz > Date: Wed Sep 6 16:20:55 2017 -0700 > > mm/mre

Re: [patch] mremap.2: Add description of old_size == 0 functionality

2017-09-15 Thread Mike Kravetz
CC: linux-mm On 09/15/2017 02:37 PM, Mike Kravetz wrote: > Since at least the 2.6 time frame, mremap would create a new mapping > of the same pages if 'old_size == 0'. It would also leave the original > mapping. This was used to create a 'duplicate mapping'. > > Document the behavior and return

[patch] mremap.2: Add description of old_size == 0 functionality

2017-09-15 Thread Mike Kravetz
Since at least the 2.6 time frame, mremap would create a new mapping of the same pages if 'old_size == 0'. It would also leave the original mapping. This was used to create a 'duplicate mapping'. Document the behavior and return codes. But, also mention that the functionality is deprecated and