Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-13 Thread Andrea Arcangeli
On Thu, Jul 13, 2017 at 11:11:37AM -0700, Mike Kravetz wrote: > Here is my understanding of how things work for old_len == 0 of anon > mappings: > - shared mappings > - New vma is created at new virtual address > - vma refers to the same underlying object/pages as old vma > - afte

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-13 Thread Mike Kravetz
On 07/13/2017 09:30 AM, Andrea Arcangeli wrote: > On Thu, Jul 13, 2017 at 09:01:54AM -0700, Mike Kravetz wrote: >> Sent a patch (in separate e-mail thread) to return EINVAL for private >> mappings. > > The way old_len == 0 behaves for MAP_PRIVATE seems more sane to me > than the alternative of cop

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-13 Thread Andrea Arcangeli
On Thu, Jul 13, 2017 at 09:01:54AM -0700, Mike Kravetz wrote: > Sent a patch (in separate e-mail thread) to return EINVAL for private > mappings. The way old_len == 0 behaves for MAP_PRIVATE seems more sane to me than the alternative of copying pagetables for anon pages (as behaving the way that w

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-13 Thread Mike Kravetz
On 07/12/2017 11:16 PM, Michal Hocko wrote: > On Wed 12-07-17 09:55:48, Mike Kravetz wrote: >> On 07/12/2017 04:46 AM, Michal Hocko wrote: >>> On Tue 11-07-17 11:23:19, Mike Kravetz wrote: On 07/11/2017 05:36 AM, Michal Hocko wrote: >>> [...] > Anyway the patch should fail with -EINVAL on

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-12 Thread Michal Hocko
On Wed 12-07-17 09:55:48, Mike Kravetz wrote: > On 07/12/2017 04:46 AM, Michal Hocko wrote: > > On Tue 11-07-17 11:23:19, Mike Kravetz wrote: > >> On 07/11/2017 05:36 AM, Michal Hocko wrote: > > [...] > >>> Anyway the patch should fail with -EINVAL on private mappings as Kirill > >>> already pointe

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-12 Thread Mike Kravetz
On 07/12/2017 04:46 AM, Michal Hocko wrote: > On Tue 11-07-17 11:23:19, Mike Kravetz wrote: >> On 07/11/2017 05:36 AM, Michal Hocko wrote: > [...] >>> Anyway the patch should fail with -EINVAL on private mappings as Kirill >>> already pointed out >> >> Yes. I think this should be a separate patch.

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-12 Thread Michal Hocko
On Tue 11-07-17 11:23:19, Mike Kravetz wrote: > On 07/11/2017 05:36 AM, Michal Hocko wrote: [...] > > Anyway the patch should fail with -EINVAL on private mappings as Kirill > > already pointed out > > Yes. I think this should be a separate patch. As mentioned earlier, > mremap today creates a n

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-11 Thread Andrea Arcangeli
On Tue, Jul 11, 2017 at 02:57:38PM -0700, Mike Kravetz wrote: > Well, the JVM has had a config option for the use of hugetlbfs for quite > some time. I assume they have already had to deal with these issues. Yes, the config tweak exists well before THP existed but in production I know nobody who

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-11 Thread Mike Kravetz
On 07/11/2017 02:02 PM, Andrea Arcangeli wrote: > On Tue, Jul 11, 2017 at 11:23:19AM -0700, Mike Kravetz wrote: >> I was surprised as well when a JVM developer pointed this out. >> >> From the old e-mail thread, here is original use case: >> shmget(IPC_PRIVATE, 31498240, 0x1c0|0600) = 11337732 >> s

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-11 Thread Andrea Arcangeli
On Tue, Jul 11, 2017 at 11:23:19AM -0700, Mike Kravetz wrote: > I was surprised as well when a JVM developer pointed this out. > > From the old e-mail thread, here is original use case: > shmget(IPC_PRIVATE, 31498240, 0x1c0|0600) = 11337732 > shmat(11337732, 0, 0) = 0x40299000 >

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-11 Thread Mike Kravetz
On 07/11/2017 05:36 AM, Michal Hocko wrote: > On Thu 06-07-17 09:17:26, Mike Kravetz wrote: >> The mremap system call has the ability to 'mirror' parts of an existing >> mapping. To do so, it creates a new mapping that maps the same pages as >> the original mapping, just at a different virtual add

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-11 Thread Michal Hocko
On Thu 06-07-17 09:17:26, Mike Kravetz wrote: > The mremap system call has the ability to 'mirror' parts of an existing > mapping. To do so, it creates a new mapping that maps the same pages as > the original mapping, just at a different virtual address. This > functionality has existed since at

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-10 Thread Mike Kravetz
On 07/10/2017 09:22 AM, Vlastimil Babka wrote: > On 07/09/2017 09:32 AM, Anshuman Khandual wrote: >> On 07/07/2017 11:39 PM, Mike Kravetz wrote: >>> On 07/07/2017 10:45 AM, Kirill A. Shutemov wrote: On Fri, Jul 07, 2017 at 10:29:52AM -0700, Mike Kravetz wrote: > On 07/07/2017 03:23 AM, Kir

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-10 Thread Vlastimil Babka
On 07/09/2017 09:32 AM, Anshuman Khandual wrote: > On 07/07/2017 11:39 PM, Mike Kravetz wrote: >> On 07/07/2017 10:45 AM, Kirill A. Shutemov wrote: >>> On Fri, Jul 07, 2017 at 10:29:52AM -0700, Mike Kravetz wrote: On 07/07/2017 03:23 AM, Kirill A. Shutemov wrote: > What is going to happen

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-09 Thread Anshuman Khandual
On 07/07/2017 11:39 PM, Mike Kravetz wrote: > On 07/07/2017 10:45 AM, Kirill A. Shutemov wrote: >> On Fri, Jul 07, 2017 at 10:29:52AM -0700, Mike Kravetz wrote: >>> On 07/07/2017 03:23 AM, Kirill A. Shutemov wrote: On Thu, Jul 06, 2017 at 09:17:26AM -0700, Mike Kravetz wrote: > The mremap

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-09 Thread Anshuman Khandual
On 07/07/2017 10:44 PM, Mike Kravetz wrote: > On 07/07/2017 01:45 AM, Anshuman Khandual wrote: >> On 07/06/2017 09:47 PM, Mike Kravetz wrote: >>> The mremap system call has the ability to 'mirror' parts of an existing >>> mapping. To do so, it creates a new mapping that maps the same pages as >>>

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-07 Thread Mike Kravetz
On 07/07/2017 10:45 AM, Kirill A. Shutemov wrote: > On Fri, Jul 07, 2017 at 10:29:52AM -0700, Mike Kravetz wrote: >> On 07/07/2017 03:23 AM, Kirill A. Shutemov wrote: >>> On Thu, Jul 06, 2017 at 09:17:26AM -0700, Mike Kravetz wrote: The mremap system call has the ability to 'mirror' parts of a

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-07 Thread Kirill A. Shutemov
On Fri, Jul 07, 2017 at 10:29:52AM -0700, Mike Kravetz wrote: > On 07/07/2017 03:23 AM, Kirill A. Shutemov wrote: > > On Thu, Jul 06, 2017 at 09:17:26AM -0700, Mike Kravetz wrote: > >> The mremap system call has the ability to 'mirror' parts of an existing > >> mapping. To do so, it creates a new

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-07 Thread Mike Kravetz
On 07/07/2017 03:23 AM, Kirill A. Shutemov wrote: > On Thu, Jul 06, 2017 at 09:17:26AM -0700, Mike Kravetz wrote: >> The mremap system call has the ability to 'mirror' parts of an existing >> mapping. To do so, it creates a new mapping that maps the same pages as >> the original mapping, just at a

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-07 Thread Mike Kravetz
On 07/07/2017 01:45 AM, Anshuman Khandual wrote: > On 07/06/2017 09:47 PM, Mike Kravetz wrote: >> The mremap system call has the ability to 'mirror' parts of an existing >> mapping. To do so, it creates a new mapping that maps the same pages as >> the original mapping, just at a different virtual

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-07 Thread Kirill A. Shutemov
On Thu, Jul 06, 2017 at 09:17:26AM -0700, Mike Kravetz wrote: > The mremap system call has the ability to 'mirror' parts of an existing > mapping. To do so, it creates a new mapping that maps the same pages as > the original mapping, just at a different virtual address. This > functionality has e

Re: [RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-07 Thread Anshuman Khandual
On 07/06/2017 09:47 PM, Mike Kravetz wrote: > The mremap system call has the ability to 'mirror' parts of an existing > mapping. To do so, it creates a new mapping that maps the same pages as > the original mapping, just at a different virtual address. This > functionality has existed since at le

[RFC PATCH 1/1] mm/mremap: add MREMAP_MIRROR flag for existing mirroring functionality

2017-07-06 Thread Mike Kravetz
The mremap system call has the ability to 'mirror' parts of an existing mapping. To do so, it creates a new mapping that maps the same pages as the original mapping, just at a different virtual address. This functionality has existed since at least the 2.6 kernel. This patch simply adds a new fl