Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1212323
| From | Eric B Munson <emunson@akamai.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT |
| Date | 2015-08-24 18:00 +0200 |
| Message-ID | <q12ka-3LI-1@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <q108G-Hc-23@gated-at.bofh.it> <q10s2-14H-13@gated-at.bofh.it> <q10V4-1Sr-23@gated-at.bofh.it> <q11xM-2Ri-3@gated-at.bofh.it> <q12av-3Av-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Mon, 24 Aug 2015, Konstantin Khlebnikov wrote: > On Mon, Aug 24, 2015 at 6:09 PM, Eric B Munson <emunson@akamai.com> wrote: > > On Mon, 24 Aug 2015, Vlastimil Babka wrote: > > > >> On 08/24/2015 03:50 PM, Konstantin Khlebnikov wrote: > >> >On Mon, Aug 24, 2015 at 4:30 PM, Vlastimil Babka <vbabka@suse.cz> wrote: > >> >>On 08/24/2015 12:17 PM, Konstantin Khlebnikov wrote: > >> >>>> > >> >>>> > >> >>>>I am in the middle of implementing lock on fault this way, but I cannot > >> >>>>see how we will hanlde mremap of a lock on fault region. Say we have > >> >>>>the following: > >> >>>> > >> >>>> addr = mmap(len, MAP_ANONYMOUS, ...); > >> >>>> mlock(addr, len, MLOCK_ONFAULT); > >> >>>> ... > >> >>>> mremap(addr, len, 2 * len, ...) > >> >>>> > >> >>>>There is no way for mremap to know that the area being remapped was lock > >> >>>>on fault so it will be locked and prefaulted by remap. How can we avoid > >> >>>>this without tracking per vma if it was locked with lock or lock on > >> >>>>fault? > >> >>> > >> >>> > >> >>>remap can count filled ptes and prefault only completely populated areas. > >> >> > >> >> > >> >>Does (and should) mremap really prefault non-present pages? Shouldn't it > >> >>just prepare the page tables and that's it? > >> > > >> >As I see mremap prefaults pages when it extends mlocked area. > >> > > >> >Also quote from manpage > >> >: If the memory segment specified by old_address and old_size is locked > >> >: (using mlock(2) or similar), then this lock is maintained when the segment is > >> >: resized and/or relocated. As a consequence, the amount of memory locked > >> >: by the process may change. > >> > >> Oh, right... Well that looks like a convincing argument for having a > >> sticky VM_LOCKONFAULT after all. Having mremap guess by scanning > >> existing pte's would slow it down, and be unreliable (was the area > >> completely populated because MLOCK_ONFAULT was not used or because > >> the process aulted it already? Was it not populated because > >> MLOCK_ONFAULT was used, or because mmap(MAP_LOCKED) failed to > >> populate it all?). > > > > Given this, I am going to stop working in v8 and leave the vma flag in > > place. > > > >> > >> The only sane alternative is to populate always for mremap() of > >> VM_LOCKED areas, and document this loss of MLOCK_ONFAULT information > >> as a limitation of mlock2(MLOCK_ONFAULT). Which might or might not > >> be enough for Eric's usecase, but it's somewhat ugly. > >> > > > > I don't think that this is the right solution, I would be really > > surprised as a user if an area I locked with MLOCK_ONFAULT was then > > fully locked and prepopulated after mremap(). > > If mremap is the only problem then we can add opposite flag for it: > > "MREMAP_NOPOPULATE" > - do not populate new segment of locked areas > - do not copy normal areas if possible (anonymous/special must be copied) > > addr = mmap(len, MAP_ANONYMOUS, ...); > mlock(addr, len, MLOCK_ONFAULT); > ... > addr2 = mremap(addr, len, 2 * len, MREMAP_NOPOPULATE); > ... > But with this, the user must remember what areas are locked with MLOCK_LOCKONFAULT and which are locked the with prepopulate so the correct mremap flags can be used.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Eric B Munson <emunson@akamai.com> - 2015-08-19 23:40 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Michal Hocko <mhocko@kernel.org> - 2015-08-20 10:00 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Eric B Munson <emunson@akamai.com> - 2015-08-20 19:10 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Michal Hocko <mhocko@kernel.org> - 2015-08-21 09:30 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Eric B Munson <emunson@akamai.com> - 2015-08-21 20:40 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Konstantin Khlebnikov <koct9i@gmail.com> - 2015-08-24 12:20 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Vlastimil Babka <vbabka@suse.cz> - 2015-08-24 15:40 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Konstantin Khlebnikov <koct9i@gmail.com> - 2015-08-24 16:00 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Vlastimil Babka <vbabka@suse.cz> - 2015-08-24 16:30 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Eric B Munson <emunson@akamai.com> - 2015-08-24 17:10 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Konstantin Khlebnikov <koct9i@gmail.com> - 2015-08-24 17:50 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Eric B Munson <emunson@akamai.com> - 2015-08-24 18:00 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Konstantin Khlebnikov <koct9i@gmail.com> - 2015-08-24 18:30 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Eric B Munson <emunson@akamai.com> - 2015-08-24 19:10 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Konstantin Khlebnikov <koct9i@gmail.com> - 2015-08-24 21:00 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Eric B Munson <emunson@akamai.com> - 2015-08-24 22:30 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Michal Hocko <mhocko@kernel.org> - 2015-08-25 15:50 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Vlastimil Babka <vbabka@suse.cz> - 2015-08-25 16:00 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Michal Hocko <mhocko@kernel.org> - 2015-08-25 16:30 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Konstantin Khlebnikov <koct9i@gmail.com> - 2015-08-25 16:00 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Eric B Munson <emunson@akamai.com> - 2015-08-25 16:30 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Michal Hocko <mhocko@kernel.org> - 2015-08-25 21:00 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Eric B Munson <emunson@akamai.com> - 2015-08-25 21:10 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Michal Hocko <mhocko@kernel.org> - 2015-08-26 09:30 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Vlastimil Babka <vbabka@suse.cz> - 2015-08-26 17:40 +0200
Re: [PATCH v7 3/6] mm: Introduce VM_LOCKONFAULT Vlastimil Babka <vbabka@suse.cz> - 2015-08-20 10:00 +0200
csiph-web