Re: [PATCH v4 00/10] hugetlbfs: add fallocate support

2015-07-23 Thread Mike Kravetz
On 07/23/2015 08:17 AM, Eric B Munson wrote: On Wed, 22 Jul 2015, Mike Kravetz wrote: On 07/22/2015 03:30 PM, Andrew Morton wrote: On Wed, 22 Jul 2015 15:19:54 -0700 Davidlohr Bueso d...@stgolabs.net wrote: I didn't know that libhugetlbfs has tests. I wonder if that makes tools/testing

Re: [PATCH v4 00/10] hugetlbfs: add fallocate support

2015-07-22 Thread Mike Kravetz
people to libhugetlbfs is the way to go. From a very quick scan of the selftests, I would guess libhugetlbfs covers everything in those tests. I'm willing to verify the testing provided by selftests is included in libhugetlbfs, and remove selftests if that is the direction we want to take. -- Mike

Re: [patch] mmap.2: document the munmap exception for underlying page size

2015-07-22 Thread Mike Kravetz
beieve the offset must be a multiple of the hugetlb page size. A similar comment/exception about using the underlying page size would apply here as well. -- Mike Kravetz -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org

Re: [PATCH v3 01/10] mm/hugetlb: add cache of descriptors to resv_map for region_add

2015-07-20 Thread Mike Kravetz
On 07/17/2015 02:02 AM, Naoya Horiguchi wrote: On Sun, Jul 12, 2015 at 09:20:59PM -0700, Mike Kravetz wrote: fallocate hole punch will want to remove a specific range of pages. When pages are removed, their associated entries in the region/reserve map will also be removed. This will break

[PATCH] mm/hugetlb: Unmap pages if page fault raced with hole punch

2015-10-29 Thread Mike Kravetz
with the hugetlb_fault_mutex held so that no other faults can occur until the page is removed. The (unmodified) routine hugetlb_vmdelete_list was moved ahead of remove_inode_hugepages to satisfy the new reference. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- fs/hugetlbfs/inode.c

Re: [PATCH v2 0/4] hugetlbfs fallocate hole punch race with page faults

2015-10-28 Thread Mike Kravetz
On 10/27/2015 08:34 PM, Hugh Dickins wrote: > On Tue, 20 Oct 2015, Mike Kravetz wrote: > >> The hugetlbfs fallocate hole punch code can race with page faults. The >> result is that after a hole punch operation, pages may remain within the >> hole. No other side e

Re: [PATCH v2 0/4] hugetlbfs fallocate hole punch race with page faults

2015-10-28 Thread Mike Kravetz
On 10/28/2015 02:00 PM, Hugh Dickins wrote: > On Wed, 28 Oct 2015, Mike Kravetz wrote: >> On 10/27/2015 08:34 PM, Hugh Dickins wrote: >> >> Thanks for the detailed response Hugh. I will try to address your questions >> and provide more reasoning behind the use

[PATCH] mm/hugetlb: i_mmap_lock_write before unmapping in remove_inode_hugepages

2015-10-21 Thread Mike Kravetz
Code was added to remove_inode_hugepages that will unmap a page if it is mapped. i_mmap_lock_write() must be taken during the call to hugetlb_vmdelete_list(). This is to prevent mappings(vmas) from being added or deleted while the list of vmas is being examined. Signed-off-by: Mike Kravetz

Re: [PATCH v2 0/4] hugetlbfs fallocate hole punch race with page faults

2015-10-28 Thread Mike Kravetz
On 10/28/2015 02:13 PM, Mike Kravetz wrote: > On 10/28/2015 02:00 PM, Hugh Dickins wrote: >> On Wed, 28 Oct 2015, Mike Kravetz wrote: >>> On 10/27/2015 08:34 PM, Hugh Dickins wrote: >>> >>> Thanks for the detailed response Hugh. I will try to address your ques

[PATCH -next] sparc: Hook up userfaultfd system call

2015-11-12 Thread Mike Kravetz
After hooking up system call, userfaultfd selftest was successful for both 32 and 64 bit version of test. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- arch/sparc/include/uapi/asm/unistd.h | 3 ++- arch/sparc/kernel/systbls_32.S | 2 +- arch/sparc/kernel/systbls_64.S

[PATCH v2] mm/hugetlbfs Fix bugs in fallocate hole punch of areas with holes

2015-11-10 Thread Mike Kravetz
: Make remove_inode_hugepages simpler after verifying truncate can not race with page faults here. Fixes: b5cec28d36f5 ("hugetlbfs: truncate_hugepages() takes a range of pages") Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- fs/hugetl

Re: [PATCH] mm/hugetlb: Unmap pages if page fault raced with hole punch

2015-11-10 Thread Mike Kravetz
On 11/09/2015 02:55 PM, Mike Kravetz wrote: > On 11/08/2015 11:42 PM, Hugh Dickins wrote: >> On Fri, 30 Oct 2015, Mike Kravetz wrote: >>> >>> The 'next = start' code is actually from the original truncate_hugepages >>> routine. This functionality was comb

Re: [PATCH v2] mm/hugetlbfs Fix bugs in fallocate hole punch of areas with holes

2015-11-10 Thread Mike Kravetz
On 11/10/2015 06:58 PM, Naoya Horiguchi wrote: > Hello Mike, > > On Tue, Nov 10, 2015 at 05:38:01PM -0800, Mike Kravetz wrote: >> This is against linux-stable 4.3. Will send to sta...@vger.kernel.org >> when Ack'ed here. > > This is not what stable stuff works,

Re: [PATCH] mm/hugetlb: Unmap pages if page fault raced with hole punch

2015-11-09 Thread Mike Kravetz
On 11/08/2015 11:42 PM, Hugh Dickins wrote: > On Fri, 30 Oct 2015, Mike Kravetz wrote: >> >> The 'next = start' code is actually from the original truncate_hugepages >> routine. This functionality was combined with that needed for hole punch >> to cr

Re: [PATCH] mm/hugetlbfs Fix bugs in fallocate hole punch of areas with holes

2015-11-09 Thread Mike Kravetz
On 11/08/2015 11:09 PM, Hugh Dickins wrote: > Sorry for the delay, I needed some time set aside to look through. No problem. I really appreciate your comments. > On Fri, 30 Oct 2015, Mike Kravetz wrote: > >> Hugh Dickins pointed out problems with the new hugetlbfs fallocate >

Re: [PATCH] mm/hugetlbfs Fix bugs in fallocate hole punch of areas with holes

2015-11-02 Thread Mike Kravetz
d out by Hugh Dickins. These are addresses in the patch which started this thread: "[PATCH] mm/hugetlbfs Fix bugs in fallocate hole punch of areas with holes" If there is a way to do this that makes your work easier let me know. It would be good if someone could take a look at this pat

[PATCH] mm/hugetlbfs Fix bugs in fallocate hole punch of areas with holes

2015-10-30 Thread Mike Kravetz
were added to explain the different actions in each case. A cond_resched() was added after removing up to PAGEVEC_SIZE pages. Some totally unnecessary code in hugetlbfs_fallocate() that remained from early development was also removed. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> -

Re: [PATCH] mm/hugetlb: Unmap pages if page fault raced with hole punch

2015-10-30 Thread Mike Kravetz
On 10/30/2015 09:45 AM, Mike Kravetz wrote: > On 10/29/2015 08:32 PM, Hugh Dickins wrote: >> On Thu, 29 Oct 2015, Mike Kravetz wrote: >> >>> This patch is a combination of: >>> [PATCH v2 4/4] mm/hugetlb: Unmap pages to remove if page fault raced >>> wi

Re: [PATCH] mm/hugetlbfs Fix bugs in fallocate hole punch of areas with holes

2015-10-31 Thread Mike Kravetz
gt;> Some totally unnecessary code in hugetlbfs_fallocate() that remained from >> early development was also removed. >> >> Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> >> --- >> fs/hugetlbfs/inode.c | 44 +--- >>

Re: [PATCH] mm/hugetlb: Unmap pages if page fault raced with hole punch

2015-10-30 Thread Mike Kravetz
On 10/29/2015 08:32 PM, Hugh Dickins wrote: > On Thu, 29 Oct 2015, Mike Kravetz wrote: > >> This patch is a combination of: >> [PATCH v2 4/4] mm/hugetlb: Unmap pages to remove if page fault raced >> with hole punch and, >> [PATCH] mm/hugetlb: i_mm

[PATCH 2/3] mm/hugetlb: Setup hugetlb_falloc during fallocate hole punch

2015-10-16 Thread Mike Kravetz
When performing a fallocate hole punch, set up a hugetlb_falloc struct and make i_private point to it. i_private will point to this struct for the duration of the operation. At the end of the operation, wake up anyone who faulted on the hole and is on the waitq. Signed-off-by: Mike Kravetz

[PATCH 0/3] hugetlbfs fallocate hole punch race with page faults

2015-10-16 Thread Mike Kravetz
, the hugetlb_fault_mutex_table could be used for races with small hole punch operations. However, we need something that will work for large holes as well. Mike Kravetz (3): mm/hugetlb: Define hugetlb_falloc structure for hole punch race mm/hugetlb: Setup hugetlb_falloc during fallocate hole punch mm/hugetlb: page

Re: [PATCH 0/3] hugetlbfs fallocate hole punch race with page faults

2015-10-19 Thread Mike Kravetz
On 10/19/2015 04:18 PM, Andrew Morton wrote: > On Fri, 16 Oct 2015 15:08:27 -0700 Mike Kravetz <mike.krav...@oracle.com> > wrote: > >> The hugetlbfs fallocate hole punch code can race with page faults. The >> result is that after a hole punch operation, pages ma

Re: [PATCH 2/3] mm/hugetlb: Setup hugetlb_falloc during fallocate hole punch

2015-10-19 Thread Mike Kravetz
On 10/19/2015 04:16 PM, Andrew Morton wrote: > On Fri, 16 Oct 2015 15:08:29 -0700 Mike Kravetz <mike.krav...@oracle.com> > wrote: > >> When performing a fallocate hole punch, set up a hugetlb_falloc struct >> and make i_private point to it. i_privat

Re: [PATCH 2/3] mm/hugetlb: Setup hugetlb_falloc during fallocate hole punch

2015-10-19 Thread Mike Kravetz
On 10/19/2015 07:22 PM, Hugh Dickins wrote: > On Mon, 19 Oct 2015, Mike Kravetz wrote: >> On 10/19/2015 04:16 PM, Andrew Morton wrote: >>> On Fri, 16 Oct 2015 15:08:29 -0700 Mike Kravetz <mike.krav...@oracle.com> >>> wrote: >> >>>>mut

Re: [PATCH v2 2/4] mm/hugetlb: Setup hugetlb_falloc during fallocate hole punch

2015-10-20 Thread Mike Kravetz
On 10/20/2015 05:11 PM, Dave Hansen wrote: > On 10/20/2015 04:52 PM, Mike Kravetz wrote: >> if (hole_end > hole_start) { >> struct address_space *mapping = inode->i_mapping; >> +DECLARE_WAIT_QUEUE_HEAD_O

[PATCH v2 4/4] mm/hugetlb: Unmap pages to remove if page fault raced with hole punch

2015-10-20 Thread Mike Kravetz
removing. The unmap within remove_inode_hugepages occurs with the hugetlb_fault_mutex held so that no other faults can occur until the page is removed. The (unmodified) routine hugetlb_vmdelete_list was moved ahead of remove_inode_hugepages to satisfy the new reference. Signed-off-by: Mike Kravetz

[PATCH v2 3/4] mm/hugetlb: page faults check for fallocate hole punch in progress and wait

2015-10-20 Thread Mike Kravetz
At page fault time, check i_private which indicates a fallocate hole punch is in progress. If the fault falls within the hole, wait for the hole punch operation to complete before proceeding with the fault. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- mm/hugetlb.

[PATCH v2 0/4] hugetlbfs fallocate hole punch race with page faults

2015-10-20 Thread Mike Kravetz
4/4 to unmap single pages in remove_inode_hugepages Mike Kravetz (4): mm/hugetlb: Define hugetlb_falloc structure for hole punch race mm/hugetlb: Setup hugetlb_falloc during fallocate hole punch mm/hugetlb: page faults check for fallocate hole punch in progress and wait mm/hugetlb

[PATCH v2 2/4] mm/hugetlb: Setup hugetlb_falloc during fallocate hole punch

2015-10-20 Thread Mike Kravetz
When performing a fallocate hole punch, set up a hugetlb_falloc struct and make i_private point to it. i_private will point to this struct for the duration of the operation. At the end of the operation, wake up anyone who faulted on the hole and is on the waitq. Signed-off-by: Mike Kravetz

[PATCH v2 1/4] mm/hugetlb: Define hugetlb_falloc structure for hole punch race

2015-10-20 Thread Mike Kravetz
A hugetlb_falloc structure is pointed to by i_private during fallocate hole punch operations. Page faults check this structure and if they are in the hole, wait for the operation to finish. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- include/linux/hugetlb.h | 10 ++

[PATCH 1/3] mm/hugetlb: Define hugetlb_falloc structure for hole punch race

2015-10-16 Thread Mike Kravetz
A hugetlb_falloc structure is pointed to by i_private during fallocate hole punch operations. Page faults check this structure and if they are in the hole, wait for the operation to finish. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- include/linux/hugetlb.h | 10 ++

[PATCH 3/3] mm/hugetlb: page faults check for fallocate hole punch in progress and wait

2015-10-16 Thread Mike Kravetz
At page fault time, check i_private which indicates a fallocate hole punch is in progress. If the fault falls within the hole, wait for the hole punch operation to complete before proceeding with the fault. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- mm/hugetlb.

[PATCH v2 05/10] hugetlbfs: truncate_hugepages() takes a range of pages

2015-07-08 Thread Mike Kravetz
modified to take a range of pages. hugetlb_unreserve_pages is modified to detect an error from region_del and pass it back to the caller. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- fs/hugetlbfs/inode.c| 98 - include/linux/hugetlb.h

[PATCH v2 09/10] hugetlbfs: add hugetlbfs_fallocate()

2015-07-08 Thread Mike Kravetz
operates on whole huge pages. Based-on code-by: Dave Hansen dave.han...@linux.intel.com Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- fs/hugetlbfs/inode.c| 158 +++- include/linux/hugetlb.h | 3 + mm/hugetlb.c| 2 +- 3

[PATCH v2 08/10] hugetlbfs: New huge_add_to_page_cache helper routine

2015-07-08 Thread Mike Kravetz
Currently, there is only a single place where hugetlbfs pages are added to the page cache. The new fallocate code be adding a second one, so break the functionality out into its own helper. Signed-off-by: Dave Hansen dave.han...@linux.intel.com Signed-off-by: Mike Kravetz mike.krav

[PATCH v2 02/10] mm/hugetlb: add region_del() to delete a specific range of entries

2015-07-08 Thread Mike Kravetz
this error and do not need to deal with error handling. Future callers of region_del() (such as fallocate hole punch) will need to handle this error. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- mm/hugetlb.c | 99 1 file

[PATCH v2 07/10] mm/hugetlb: alloc_huge_page handle areas hole punched by fallocate

2015-07-08 Thread Mike Kravetz
Areas hole punched by fallocate will not have entries in the region/reserve map. However, shared mappings with min_size subpool reservations may still have reserved pages. alloc_huge_page needs to handle this special case and do the proper accounting. Signed-off-by: Mike Kravetz mike.krav

[PATCH v2 00/10] hugetlbfs: add fallocate support

2015-07-08 Thread Mike Kravetz
in region_del() when kmalloc() fails stills needs to be addressed madvise remove support remains Mike Kravetz (10): mm/hugetlb: add cache of descriptors to resv_map for region_add mm/hugetlb: add region_del() to delete a specific range of entries mm/hugetlb: expose hugetlb fault mutex for use

[PATCH v2 01/10] mm/hugetlb: add cache of descriptors to resv_map for region_add

2015-07-08 Thread Mike Kravetz
creating reservations with vma_needs_reservation/vma_commit_reservation. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- include/linux/hugetlb.h | 3 + mm/hugetlb.c| 168 ++-- 2 files changed, 152 insertions(+), 19 deletions(-) diff

[PATCH v2 04/10] hugetlbfs: hugetlb_vmtruncate_list() needs to take a range to delete

2015-07-08 Thread Mike Kravetz
callers to add 0 as end of range. Since the routine will be used in hole punch as well as truncate operations, it is more appropriately renamed to hugetlb_vmdelete_list(). Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- fs/hugetlbfs/inode.c | 25 ++--- 1 file changed, 18

[PATCH v2 06/10] mm/hugetlb: vma_has_reserves() needs to handle fallocate hole punch

2015-07-08 Thread Mike Kravetz
). vma_has_reserves is passed chg which indicates whether or not a region/reserve map is present. Use this to determine if reserves are actually present or were removed via hole punch. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- mm/hugetlb.c | 16 +--- 1 file changed, 13 insertions

[PATCH v2 03/10] mm/hugetlb: expose hugetlb fault mutex for use by fallocate

2015-07-08 Thread Mike Kravetz
changes to be more consistent with other global hugetlb symbols. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- include/linux/hugetlb.h | 5 + mm/hugetlb.c| 20 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/include/linux/hugetlb.h b

[PATCH v2 10/10] mm: madvise allow remove operation for hugetlbfs

2015-07-08 Thread Mike Kravetz
Now that we have hole punching support for hugetlbfs, we can also support the MADV_REMOVE interface to it. Signed-off-by: Dave Hansen dave.han...@linux.intel.com Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- mm/madvise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH v2 01/10] mm/hugetlb: add cache of descriptors to resv_map for region_add

2015-07-08 Thread Mike Kravetz
On 07/08/2015 05:21 PM, Mike Kravetz wrote: fallocate hole punch will want to remove a specific range of pages. When pages are removed, their associated entries in the region/reserve map will also be removed. This will break an assumption in the region_chg/region_add calling sequence. If a new

[PATCH v3 07/10] mm/hugetlb: alloc_huge_page handle areas hole punched by fallocate

2015-07-12 Thread Mike Kravetz
Areas hole punched by fallocate will not have entries in the region/reserve map. However, shared mappings with min_size subpool reservations may still have reserved pages. alloc_huge_page needs to handle this special case and do the proper accounting. Signed-off-by: Mike Kravetz mike.krav

[PATCH v3 03/10] mm/hugetlb: expose hugetlb fault mutex for use by fallocate

2015-07-12 Thread Mike Kravetz
changes to be more consistent with other global hugetlb symbols. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- include/linux/hugetlb.h | 5 + mm/hugetlb.c| 20 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/include/linux/hugetlb.h b

[PATCH v3 10/10] mm: madvise allow remove operation for hugetlbfs

2015-07-12 Thread Mike Kravetz
Now that we have hole punching support for hugetlbfs, we can also support the MADV_REMOVE interface to it. Signed-off-by: Dave Hansen dave.han...@linux.intel.com Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- mm/madvise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v3 04/10] hugetlbfs: hugetlb_vmtruncate_list() needs to take a range to delete

2015-07-12 Thread Mike Kravetz
callers to add 0 as end of range. Since the routine will be used in hole punch as well as truncate operations, it is more appropriately renamed to hugetlb_vmdelete_list(). Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- fs/hugetlbfs/inode.c | 25 ++--- 1 file changed, 18

[PATCH v3 06/10] mm/hugetlb: vma_has_reserves() needs to handle fallocate hole punch

2015-07-12 Thread Mike Kravetz
). vma_has_reserves is passed chg which indicates whether or not a region/reserve map is present. Use this to determine if reserves are actually present or were removed via hole punch. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- mm/hugetlb.c | 16 +--- 1 file changed, 13 insertions

[PATCH v3 09/10] hugetlbfs: add hugetlbfs_fallocate()

2015-07-12 Thread Mike Kravetz
operates on whole huge pages. Based-on code-by: Dave Hansen dave.han...@linux.intel.com Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- fs/hugetlbfs/inode.c| 158 +++- include/linux/hugetlb.h | 3 + mm/hugetlb.c| 2 +- 3

[PATCH v3 08/10] hugetlbfs: New huge_add_to_page_cache helper routine

2015-07-12 Thread Mike Kravetz
Currently, there is only a single place where hugetlbfs pages are added to the page cache. The new fallocate code be adding a second one, so break the functionality out into its own helper. Signed-off-by: Dave Hansen dave.han...@linux.intel.com Signed-off-by: Mike Kravetz mike.krav

[PATCH v3 05/10] hugetlbfs: truncate_hugepages() takes a range of pages

2015-07-12 Thread Mike Kravetz
hugetlb_unreserve_pages() is also modified to take a range of pages. hugetlb_unreserve_pages is modified to detect an error from region_del and pass it back to the caller. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- fs/hugetlbfs/inode.c| 98

[PATCH v3 02/10] mm/hugetlb: add region_del() to delete a specific range of entries

2015-07-12 Thread Mike Kravetz
this error and do not need to deal with error handling. Future callers of region_del() (such as fallocate hole punch) will need to handle this error. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- mm/hugetlb.c | 99 1 file

[PATCH v3 01/10] mm/hugetlb: add cache of descriptors to resv_map for region_add

2015-07-12 Thread Mike Kravetz
creating reservations with vma_needs_reservation/vma_commit_reservation. Signed-off-by: Mike Kravetz mike.krav...@oracle.com --- include/linux/hugetlb.h | 3 + mm/hugetlb.c| 169 ++-- 2 files changed, 153 insertions(+), 19 deletions(-) diff

[PATCH v3 00/10] hugetlbfs: add fallocate support

2015-07-12 Thread Mike Kravetz
and error handling issues noticed by Hillf Danton New region_del() routine for region tracking/resv_map of ranges Fixed several issues found during more extensive testing Error handling in region_del() when kmalloc() fails stills needs to be addressed madvise remove support remains Mike

Re: [PATCH 03/10] mm: make hugetlb.c explicitly non-modular

2015-08-26 Thread Mike Kravetz
Cc: Mike Kravetz mike.krav...@oracle.com Cc: David Rientjes rient...@google.com Cc: Hillf Danton hillf...@alibaba-inc.com Cc: Davidlohr Bueso d...@stgolabs.net Cc: linux...@kvack.org Signed-off-by: Paul Gortmaker paul.gortma...@windriver.com --- mm/hugetlb.c | 39

Re: [PATCH] mm/hugetlb resv map memory leak for placeholder entries

2015-12-02 Thread Mike Kravetz
On 12/02/2015 01:26 AM, Dmitry Vyukov wrote: > FWIW, I see this leak also with mlock, mmap, get_mempolicy and page > faults. So it is not specific only to the new fancy mlock2. I assume/hope the patch addresses leaks with those other calls as well? -- Mike Kravetz > > > >

Re: memory leak in alloc_huge_page

2015-12-01 Thread Mike Kravetz
On 12/01/2015 11:45 AM, Dmitry Vyukov wrote: > On Tue, Dec 1, 2015 at 7:52 PM, Mike Kravetz <mike.krav...@oracle.com> wrote: >> On 12/01/2015 06:04 AM, Dmitry Vyukov wrote: >>> There seems to be another leak if nrg is not NULL on this path, but >>> it's

Re: memory leak in alloc_huge_page

2015-12-01 Thread Mike Kravetz
t; + WARN_ON(nrg != NULL); > return -ENOMEM; > + } > > spin_lock(>lock); > list_add(>link, >region_cache); > > Thanks Dmitry, If nrg is not NULL, then it was added to the resv

Re: [PATCH 1/8] hugetlb: make mm and fs code explicitly non-modular

2015-12-17 Thread Mike Kravetz
> Cc: Nadia Yvette Chambers <n...@holomorphy.com> > Cc: Alexander Viro <v...@zeniv.linux.org.uk> > Cc: Andrew Morton <a...@linux-foundation.org> > Cc: Naoya Horiguchi <n-horigu...@ah.jp.nec.com> > Cc: Mike Kravetz <mike.krav...@oracle.com> > Cc: David Rie

[PATCH] mm/hugetlbfs: Unmap pages if page fault raced with hole punch

2016-01-06 Thread Mike Kravetz
. The unmap within remove_inode_hugepages occurs with the hugetlb_fault_mutex held so that no other faults will be processed until the page is removed. The (unmodified) routine hugetlb_vmdelete_list was moved ahead of remove_inode_hugepages to satisfy the new reference. Signed-off-by: Mike Kravetz

Re: [PATCH] mm/hugetlbfs: Unmap pages if page fault raced with hole punch

2016-01-07 Thread Mike Kravetz
removed. >> >> The (unmodified) routine hugetlb_vmdelete_list was moved ahead of >> remove_inode_hugepages to satisfy the new reference. >> >> Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> >> --- >> fs/hugetlbfs/inode.c | 139 >> +

Re: [PATCH v1] mm: hugetlb: fix hugepage memory leak caused by wrong reserve count

2015-11-24 Thread Mike Kravetz
On 11/23/2015 09:32 PM, Naoya Horiguchi wrote: > On Fri, Nov 20, 2015 at 01:56:18PM -0800, Mike Kravetz wrote: >> On 11/19/2015 11:57 PM, Hillf Danton wrote: >>>> >>>> When dequeue_huge_page_vma() in alloc_huge_page() fails, we fall back to >>>&g

Re: [PATCH v1] mm: hugetlb: call huge_pte_alloc() only if ptep is null

2015-11-30 Thread Mike Kravetz
ould not address this situation. -- Mike Kravetz > > We don't have to call huge_pte_alloc() when the huge_pte_offset() returns > non-NULL, so let's fix this bug with moving the code into else block. > > Note that the *ptep could turn into a migration/hwpoison entry after > thi

Re: [PATCH v1] mm: hugetlb: fix hugepage memory leak caused by wrong reserve count

2015-11-20 Thread Mike Kravetz
lls set_mempolicy(MPOL_BIND) to bind itself to >> node 1, tries to allocate a hugepage, I am curious about this scenario. When this second program attempts to allocate the page, I assume it creates a reservation first. Is this reservation before or after setting mempolicy? If the mempolic

[PATCH -next RESEND] sparc: Hook up userfaultfd system call

2015-11-20 Thread Mike Kravetz
After hooking up system call, userfaultfd selftest was successful for both 32 and 64 bit version of test. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- arch/sparc/include/uapi/asm/unistd.h | 3 ++- arch/sparc/kernel/systbls_32.S | 2 +- arch/sparc/kernel/systbls_64.S

[RFC PATCH 5/6] fs/userfaultfd: allow registration of ranges containing huge pages

2016-06-06 Thread Mike Kravetz
-off-by: Mike Kravetz <mike.krav...@oracle.com> --- fs/userfaultfd.c | 69 +--- include/uapi/linux/userfaultfd.h | 3 ++ 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 2d97952..7

[RFC PATCH 6/6] selftests/userfaultfd: add userfaultfd_hugetlb test

2016-06-06 Thread Mike Kravetz
pages. Use the same file, but create wrappers for allocating ranges and releasing pages. Compile userfaultfd.c with HUGETLB_TEST defined to produce an executable to test userfaultfd hugetlb functionality. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- tools/testing/selfte

[RFC PATCH 4/6] mm/hugetlb: add userfaultfd hugetlb hook

2016-06-06 Thread Mike Kravetz
When processing a hugetlb fault for no page present, check the vma to determine if faults are to be handled via userfaultfd. If so, drop the hugetlb_fault_mutex and call handle_userfault(). Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- mm/hugetlb.c | 22 +++

[RFC PATCH 0/6] hugetlb support for userfaultfd

2016-06-06 Thread Mike Kravetz
support for huge pages (except THP case). - Should there be another config option? Support is now provided if both userfaultfd and hugetlb are configured. - This has only been tested on x86, but the code should be arch independent. Mike Kravetz (6): mm/memory: add copy_huge_page_from_user

[RFC PATCH 3/6] mm/userfaultfd: add __mcopy_atomic_hugetlb for huge page UFFDIO_COPY

2016-06-06 Thread Mike Kravetz
__mcopy_atomic_hugetlb performs the UFFDIO_COPY operation for huge pages. It is based on the existing __mcopy_atomic routine for normal pages. Unlike normal pages, there is no huge page support for the UFFDIO_ZEROPAGE operation. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> -

[RFC PATCH 1/6] mm/memory: add copy_huge_page_from_user for hugetlb userfaultfd support

2016-06-06 Thread Mike Kravetz
userfaultfd UFFDIO_COPY allows user level code to copy data to a page at fault time. The data is copied from user space to a newly allocated huge page. The new routine copy_huge_page_from_user performs this copy. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- include/linux/mm.

[RFC PATCH 2/6] mm/hugetlb: add hugetlb_mcopy_atomic_pte for userfaultfd support

2016-06-06 Thread Mike Kravetz
hugetlb_mcopy_atomic_pte is the low level routine that implements the userfaultfd UFFDIO_COPY command. It is based on the existing mcopy_atomic_pte routine with modifications for huge pages. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- include/linux/hugetlb.h | 8 +++

Re: [RFC PATCH 3/6] mm/userfaultfd: add __mcopy_atomic_hugetlb for huge page UFFDIO_COPY

2016-06-07 Thread Mike Kravetz
LB) > > Use is_vm_hugetlb_page()? > And in cases in subsequent patches? > > Hillf Yes, that would be better. Thanks. -- Mike Kravetz

[PATCH] selftests/vm/compaction_test: fix write to restore nr_hugepages

2016-06-07 Thread Mike Kravetz
The write at the end of the test to restore nr_hugepages to its previous value is failing. This is because it is trying to write the number of bytes in the char array as opposed to the number of bytes in the string. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- tools/t

[PATCH] mm/hugetlb: fix huge page reserve accounting for private mappings

2016-05-31 Thread Mike Kravetz
mappings. However, the reserve map semantics for private and shared mappings are very different. This results in subtly different code that is explained in the comments. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- mm/hugetlb.c | 42 --

Re: [PATCH] mm: fix account pmd page to the process

2016-06-16 Thread Mike Kravetz
pte = huge_pmd_share(mm, addr, pud); else pte = (pte_t *)pmd_alloc(mm, pud, addr); Therefore, we do not call huge_pmd_share unless pud_none(*pud). The code in question is only executed when !pud_none(*pud). I think that entire if/else statement can be removed. We know pud_none(*pud), so just do pud_populate(). -- Mike Kravetz >> >>> + >>> spin_unlock(ptl); >>> out: >>> pte = (pte_t *)pmd_alloc(mm, pud, addr); >>> -- >>> 1.8.3.1 >> >> -- >> Michal Hocko >> SUSE Labs >

Re: [PATCH] mm: fix account pmd page to the process

2016-06-16 Thread Mike Kravetz
On 06/16/2016 09:31 AM, Michal Hocko wrote: > On Thu 16-06-16 09:05:23, Mike Kravetz wrote: >> On 06/16/2016 08:43 AM, Michal Hocko wrote: >>> [It seems that this patch has been sent several times and this >>> particular copy didn't add Kirill who has added this code CC

Re: [PATCH] mm: fix account pmd page to the process

2016-06-17 Thread Mike Kravetz
rocess. > > By mistake, I increase nr_pmds again in this case. :-/ > It will lead to "BUG: non-zero nr_pmds on freeing mm: 2" on process' > exit. > > Let's fix this by increasing nr_pmds only when we're sure that the page > table will be used. > > Signed-off-by:

Re: [PATCH] mm/hugetlb: clear compound_mapcount when freeing gigantic pages

2016-06-23 Thread Mike Kravetz
ld also be fixed with this patch. > > Signed-off-by: Gerald Schaefer <gerald.schae...@de.ibm.com> Thanks Gerald, I agree with your fix. Reviewed-by: Mike Kravetz <mike.krav...@oracle.com> However, like you I was wondering if this had any other implications. I've been examining co

Re: Regression: 4.5-rc1 (bisect: hugetlb: make mm and fs code explicitly non-modular vs CONFIG_TIMER_STATS)

2016-01-28 Thread Mike Kravetz
On 01/28/2016 07:05 AM, Mike Kravetz wrote: > On 01/28/2016 06:37 AM, Paul Gortmaker wrote: >> [Re: Regression: 4.5-rc1 (bisect: hugetlb: make mm and fs code explicitly >> non-modular vs CONFIG_TIMER_STATS)] On 28/01/2016 (Thu 10:48) Christian >> Borntraeger wrote: >>

Re: Regression: 4.5-rc1 (bisect: hugetlb: make mm and fs code explicitly non-modular vs CONFIG_TIMER_STATS)

2016-01-28 Thread Mike Kravetz
On 01/28/2016 02:59 PM, Paul Gortmaker wrote: > [Re: Regression: 4.5-rc1 (bisect: hugetlb: make mm and fs code explicitly > non-modular vs CONFIG_TIMER_STATS)] On 28/01/2016 (Thu 14:18) Mike Kravetz > wrote: > >> On 01/28/2016 07:05 AM, Mike Kravetz wrote: >>> O

kernel BUG at mm/hugetlb.c:1218!

2016-02-01 Thread Mike Kravetz
ted to kill init! exitcode=0x000b [0.520782] -- Mike Kravetz

Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation

2016-02-02 Thread Mike Kravetz
On 02/02/2016 02:59 PM, David Rientjes wrote: > On Tue, 2 Feb 2016, Mike Kravetz wrote: > >> Attempting to preallocate 1G gigantic huge pages at boot time with >> "hugepagesz=1G hugepages=1" on the kernel command line will prevent >> booting with the following

[PATCH] mm/hugetlb: fix gigantic page initialization/allocation

2016-02-02 Thread Mike Kravetz
ping of THPs") Suggested-by: Naoya Horiguchi <n-horigu...@ah.jp.nec.com> Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- mm/hugetlb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 12908dc..d7a8024 100644 ---

Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation

2016-02-02 Thread Mike Kravetz
On 02/02/2016 07:01 PM, Naoya Horiguchi wrote: > On Tue, Feb 02, 2016 at 03:17:10PM -0800, Mike Kravetz wrote: >> I agree. Naoya did debug and provide fix via e-mail exchange. He did not >> sign-off and I could not tell if he was going to pursue. My only intention >> was to

Re: Regression: 4.5-rc1 (bisect: hugetlb: make mm and fs code explicitly non-modular vs CONFIG_TIMER_STATS)

2016-01-28 Thread Mike Kravetz
signed int order) >>>> >>>> makes the problem go away. >>> >>> Helps more if a patch is delivered. >> >> The problem is that the original change was intentional. So I do not not >> what the right fix is. > > Thanks for the re

Re: [RFC PATCH 1/2] mm/hugetlbfs: Attempt PUD_SIZE mapping alignment if PMD sharing enabled

2016-03-29 Thread Mike Kravetz
PUD_SIZE in length >> If a PUD_SIZE aligned mapping can not be created, then fall back to a >> huge page size mapping. >> >> Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> >> --- >> fs/hugetlbfs/inode.c | 29 +++-- >&g

Re: [RFC PATCH 2/2] x86/hugetlb: Attempt PUD_SIZE mapping alignment if PMD sharing enabled

2016-03-29 Thread Mike Kravetz
On 03/29/2016 01:35 AM, Ingo Molnar wrote: > > * Mike Kravetz <mike.krav...@oracle.com> wrote: > >> When creating a hugetlb mapping, attempt PUD_SIZE alignment if the >> following conditions are met: >> - Address passed to mmap or shmat is NULL >

[RFC PATCH 1/2] mm/hugetlbfs: Attempt PUD_SIZE mapping alignment if PMD sharing enabled

2016-03-28 Thread Mike Kravetz
size mapping. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- fs/hugetlbfs/inode.c | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 540ddc9..22b2e38 100644 --- a/fs/hugetlbfs/inode.c

[RFC PATCH 0/2] hugetlb: If PMD sharing is possible, align to PUD_SIZE

2016-03-28 Thread Mike Kravetz
HAVE_ARCH_HUGETLB_UNMAPPED_AREA (where code changes are made). arm64 uses the architecture independent code. Mike Kravetz (2): mm/hugetlbfs: Attempt PUD_SIZE mapping alignment if PMD sharing enabled x86/hugetlb: Attempt PUD_SIZE mapping alignment if PMD sharing enabled arch/x86/mm/hugetlbpage.c | 64

[RFC PATCH 2/2] x86/hugetlb: Attempt PUD_SIZE mapping alignment if PMD sharing enabled

2016-03-28 Thread Mike Kravetz
size mapping. Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- arch/x86/mm/hugetlbpage.c | 64 --- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c index 42982b2..4f53af5

[PATCH] mm/hugetlb: optimize minimum size (min_size) accounting

2016-03-25 Thread Mike Kravetz
if all reservations have already been taken (subpool reserved count == 0). Signed-off-by: Mike Kravetz <mike.krav...@oracle.com> --- mm/hugetlb.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 06058ea..b9bfcf1 100644 --- a/mm/hug

Re: [PATCH 1/2] mm/hugetlb: Introduce hugetlb_bad_size

2016-03-22 Thread Mike Kravetz
re specific code. > > Signed-off-by: Vaishali Thakkar <vaishali.thak...@oracle.com> > Cc: Mike Kravetz <mike.krav...@oracle.com> > Cc: Naoya Horiguchi <n-horigu...@ah.jp.nec.com> > Cc: Hillf Danton <hillf...@alibaba-inc.com> > Cc: Michal Hocko <mho...@suse.co

Re: [PATCH 2/2] arch:mm: Use hugetlb_bad_size

2016-03-22 Thread Mike Kravetz
On 03/22/2016 03:05 AM, Vaishali Thakkar wrote: > Update the setup_hugepagesz function to call the routine > hugetlb_bad_size when unsupported hugepage size is found. > > Misc: > - Silent 80 characters warning > > Signed-off-by: Vaishali Thakkar <vaishali.thak...@oracle

Re: [PATCH] tmpfs: shmem_fallocate must return ERESTARTSYS

2016-03-03 Thread Mike Kravetz
if (signal_pending(current)) { error = -EINTR; break; } I don't know much about the advantages of changing to ERESTARTSYS. But, if it is changed for shmem it should be changed for hugetlbfs as well. -- Mike Kravetz

Re: [RFC PATCH 1/2] mm/hugetlbfs: Attempt PUD_SIZE mapping alignment if PMD sharing enabled

2016-03-31 Thread Mike Kravetz
On 03/30/2016 07:18 PM, Naoya Horiguchi wrote: > On Mon, Mar 28, 2016 at 06:12:49PM -0700, Mike Kravetz wrote: >> When creating a hugetlb mapping, attempt PUD_SIZE alignment if the >> following conditions are met: >> - Address passed to mmap or shmat is NULL >> - The

Re: [RFC PATCH 2/2] x86/hugetlb: Attempt PUD_SIZE mapping alignment if PMD sharing enabled

2016-03-31 Thread Mike Kravetz
On 03/30/2016 07:26 PM, Naoya Horiguchi wrote: > On Tue, Mar 29, 2016 at 10:05:31AM -0700, Mike Kravetz wrote: >> On 03/29/2016 01:35 AM, Ingo Molnar wrote: >>> >>> * Mike Kravetz <mike.krav...@oracle.com> wrote: >>> >>>> When

Re: [PATCH v3 0/2] Align mmap address for DAX pmd mappings

2016-04-21 Thread Mike Kravetz
ENT_HUGEPAGE is unset? > > Great idea. Perhaps it should look something like this? > > unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr, > unsigned long len, unsigned long pgoff, unsigned long flags) > { Might want to keep the future possib

<    1   2   3   4   5   6   7   8   9   10   >