Re: [LKP] Re: [hugetlbfs] c0d0381ade: vm-scalability.throughput -33.4% regression

2020-10-12 Thread Mike Kravetz
rent code. The performance issues discovered here will be taken into account with the new code. However, as previously mentioned additional synchronization is required for functional correctness. As a result, there will be some regression in this code. -

Re: [PATCH v3 7/8] mm/mempolicy: use a standard migration target allocation callback

2020-10-09 Thread Mike Kravetz
On 10/9/20 3:23 PM, Hugh Dickins wrote: > On Fri, 9 Oct 2020, Mike Kravetz wrote: >> On 10/8/20 10:50 PM, Hugh Dickins wrote: >>> >>> It's a problem I've faced before in tmpfs, keeping a hold on the >>> mapping while page lock is dropped. Quite a

Re: [PATCH v3 7/8] mm/mempolicy: use a standard migration target allocation callback

2020-10-09 Thread Mike Kravetz
On 10/8/20 10:50 PM, Hugh Dickins wrote: > On Thu, 8 Oct 2020, Mike Kravetz wrote: >> On 10/7/20 8:21 PM, Hugh Dickins wrote: >>> >>> Mike, j'accuse... your 5.7 commit c0d0381ade79 ("hugetlbfs: >>> use i_mmap_rwsem for more pmd sharing synchronization&

Re: [PATCH v3 7/8] mm/mempolicy: use a standard migration target allocation callback

2020-10-08 Thread Mike Kravetz
t was possible to find a PageAnon there.) > > But my belief (best confirmed by you running your tests with a > suitably placed BUG_ON or WARN_ON) is that you'll never find a > PageAnon in a vma_shareable() area, so will never need try_to_unmap() > to unshare a pagetable in

Re: [RFC PATCH 00/24] mm/hugetlb: Free some vmemmap pages of hugetlb page

2020-10-07 Thread Mike Kravetz
On 9/29/20 2:58 PM, Mike Kravetz wrote: > On 9/15/20 5:59 AM, Muchun Song wrote: >> Hi all, >> >> This patch series will free some vmemmap pages(struct page structures) >> associated with each hugetlbpage when preallocated to save memory. > ... >> The mappin

Re: [v5] mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged

2020-10-02 Thread Mike Kravetz
On 10/2/20 4:25 AM, Michal Hocko wrote: > On Wed 30-09-20 15:03:11, Mike Kravetz wrote: >> On 9/30/20 1:47 PM, Vijay Balakrishna wrote: >>> On 9/30/2020 11:20 AM, Mike Kravetz wrote: >>>> On 9/29/20 9:49 AM, Vijay Balakrishna wrote: >>>> >>>> S

Re: [RFC V2] mm/vmstat: Add events for HugeTLB migration

2020-10-01 Thread Mike Kravetz
migration statistics. While here, this updates current trace event > 'mm_migrate_pages' to accommodate now available HugeTLB based statistics. > > Cc: Daniel Jordan > Cc: Zi Yan > Cc: John Hubbard > Cc: Mike Kravetz > Cc: Oscar Salvador > Cc: Andrew Morton >

Re: [RFC PATCH 05/24] mm/hugetlb: Introduce nr_free_vmemmap_pages in the struct hstate

2020-09-30 Thread Mike Kravetz
at, but hopefully avoids some confusion. -- Mike Kravetz > So we introduce a new nr_free_vmemmap_pages field in the hstate to > indicate how many vmemmap pages associated with a hugetlb page that we > can free to buddy system. > > Signed-off-by: Muchun Song > --- > inc

Re: [v5] mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged

2020-09-30 Thread Mike Kravetz
On 9/30/20 1:47 PM, Vijay Balakrishna wrote: > On 9/30/2020 11:20 AM, Mike Kravetz wrote: >> On 9/29/20 9:49 AM, Vijay Balakrishna wrote: >> >> Sorry for jumping in so late. Should we use this as an opportunity to >> also fix up the messages logged when (re)calculating

Re: [v5] mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged

2020-09-30 Thread Mike Kravetz
ree_kbytes is not updated to 11334 because user defined value 9 is preferred # cat /proc/sys/vm/min_free_kbytes 90112 -- Mike Kravetz

Re: [RFC PATCH 03/24] mm/hugetlb: Introduce a new config HUGETLB_PAGE_FREE_VMEMMAP

2020-09-29 Thread Mike Kravetz
support it, say Y here. > + > + If unsure, say N. > + I could be wrong, but I believe the convention is introduce the config option at the same time code which depends on the option is introduced. Therefore, it might be better to combine with the next patch. Also, it looks like most of your development was done on x86. Should this option be limited to x86 only for now? -- Mike Kravetz

Re: [RFC PATCH 02/24] mm/memory_hotplug: Move {get,put}_page_bootmem() to bootmem_info.c

2020-09-29 Thread Mike Kravetz
On 9/15/20 5:59 AM, Muchun Song wrote: > In the later patch, we will use {get,put}_page_bootmem() to initialize > the page for vmemmap or free vmemmap page to buddy. So move them out of > CONFIG_MEMORY_HOTPLUG_SPARSE. > > Signed-off-by: Muchun Song More code movement. Acked-b

Re: [RFC PATCH 01/24] mm/memory_hotplug: Move bootmem info registration API to bootmem_info.c

2020-09-29 Thread Mike Kravetz
On 9/15/20 5:59 AM, Muchun Song wrote: > Move bootmem info registration common API to individual bootmem_info.c > for later patch use. > > Signed-off-by: Muchun Song This is just code movement. Acked-by: Mike Kravetz -- Mike Kravetz > --- > arch/x86/mm/init_64.c

Re: [RFC PATCH 00/24] mm/hugetlb: Free some vmemmap pages of hugetlb page

2020-09-29 Thread Mike Kravetz
rt of double mapping hugetlb pages. https://lists.gnu.org/archive/html/qemu-devel/2017-03/msg02407.html More care/coordination would be needed to support double mapping with this new option. However, this series provides a boot option to disable freeing of unneeded page structs. -- Mike Kravetz

Re: [RFC] mm/vmstat: Add events for HugeTLB migration

2020-09-28 Thread Mike Kravetz
is_hugetlb = true; else is_thp = true; Although, the compiler may be able to optimize. I did not check. > + > nr_subpages = thp_nr_pages(page); > + if (is_hugetlb) > + nr_subpages = > pages_per_huge_page(page_hstate(page)); Can we just use compound_order() here for all cases? -- Mike Kravetz

Re: [PATCH V3 6/8] mm: and drivers core: Convert hugetlb_report_node_meminfo to sysfs_emit

2020-09-18 Thread Mike Kravetz
On 9/16/20 1:40 PM, Joe Perches wrote: > Convert the unbound sprintf in hugetlb_report_node_meminfo to use > sysfs_emit_at so that no possible overrun of a PAGE_SIZE buf can occur. > > Signed-off-by: Joe Perches Acked-by: Mike Kravetz -- Mike Kravetz

Re: KASAN: null-ptr-deref Read in PageHuge

2020-09-18 Thread Mike Kravetz
4002c8 RCX: 00440329 > RDX: RSI: 4000 RDI: 20001000 > RBP: 006ca018 R08: R09: > R10: 0003 R11: 0246 R12: 00401b30 > R13: 00401bc0 R14: R15:

Re: [PATCH] cma: make number of CMA areas dynamic, remove CONFIG_CMA_AREAS

2020-09-16 Thread Mike Kravetz
On 9/16/20 2:14 AM, Song Bao Hua (Barry Song) wrote: >>> -Original Message- >>> From: Mike Kravetz [mailto:mike.krav...@oracle.com] >>> Sent: Wednesday, September 16, 2020 8:57 AM >>> To: linux...@kvack.org; linux-kernel@vger.kernel.org; >>>

Re: [RFC PATCH] cma: make number of CMA areas dynamic, remove CONFIG_CMA_AREAS

2020-09-16 Thread Mike Kravetz
On 9/15/20 9:32 PM, Christoph Hellwig wrote: > On Wed, Sep 02, 2020 at 08:02:04PM -0700, Mike Kravetz wrote: >> --- a/arch/arm/mm/dma-mapping.c >> +++ b/arch/arm/mm/dma-mapping.c >> @@ -383,25 +383,34 @@ postcore_initcall(atomic_pool_init); >> struct dma_contig_early_re

[PATCH] cma: make number of CMA areas dynamic, remove CONFIG_CMA_AREAS

2020-09-15 Thread Mike Kravetz
before normal memory allocators, so use the memblock allocator. Acked-by: Roman Gushchin Signed-off-by: Mike Kravetz --- rfc->v1 - Made minor changes suggested by Song Bao Hua (Barry Song) - Removed check for late calls to cma_init_reserved_mem that was part of RFC. - Added ACK f

[PATCH] hugetlb: add lockdep check for i_mmap_rwsem held in huge_pmd_share

2020-09-11 Thread Mike Kravetz
his should have been included with commit 34ae204f1851 ("hugetlbfs: remove call to huge_pte_alloc without i_mmap_rwsem"). Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.

Re: [RFC PATCH] cma: make number of CMA areas dynamic, remove CONFIG_CMA_AREAS

2020-09-08 Thread Mike Kravetz
On 9/3/20 6:58 PM, Song Bao Hua (Barry Song) wrote: > >> -Original Message- >> From: Mike Kravetz [mailto:mike.krav...@oracle.com] >> Sent: Thursday, September 3, 2020 3:02 PM >> To: linux...@kvack.org; linux-kernel@vger.kernel.org; >> linux-arm-ke

Re: [RFC PATCH 00/16] 1GB THP support on x86_64

2020-09-03 Thread Mike Kravetz
adding 1G hugetlb pages to the hugetlb pool and then using them within applications? Or, are you dynamically allocating them at fault time (hugetlb overcommit/surplus)? Latency time for use of such pages includes: - Putting together 1G contiguous - Clearing 1G memory In the 'allocation at fault time' mode you incur both costs at fault time. If using pages from the pool, your only cost at fault time is clearing the page. -- Mike Kravetz

[RFC PATCH] cma: make number of CMA areas dynamic, remove CONFIG_CMA_AREAS

2020-09-02 Thread Mike Kravetz
before normal memory allocators, so use the memblock allocator. Signed-off-by: Mike Kravetz --- arch/arm/mm/dma-mapping.c | 29 --- arch/mips/configs/cu1000-neo_defconfig | 1 - arch/mips/configs/cu1830-neo_defconfig | 1 - include/linux/cma.h

Re: [Patch v4 5/7] mm/hugetlb: a page from buddy is not on any list

2020-09-02 Thread Mike Kravetz
On 9/2/20 3:49 AM, Vlastimil Babka wrote: > On 9/1/20 3:46 AM, Wei Yang wrote: >> The page allocated from buddy is not on any list, so just use list_add() >> is enough. >> >> Signed-off-by: Wei Yang >> Reviewed-by: Baoquan He >> Reviewed-by: Mike Kravet

Re: [Patch v4 7/7] mm/hugetlb: take the free hpage during the iteration directly

2020-09-01 Thread Mike Kravetz
t; Signed-off-by: Wei Yang Thank you! Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [Patch v3 7/7] mm/hugetlb: take the free hpage during the iteration directly

2020-08-31 Thread Mike Kravetz
break; Previously, when encountering a PageHWPoison(page) the loop would continue and check the next page in the list. It now breaks the loop and returns NULL. Is not this a change in behavior? Perhaps you want to change that break to a continue. Or, restructure in s

Re: [PATCH v2] mm/hugetlb: Fix a race between hugetlb sysctl handlers

2020-08-28 Thread Mike Kravetz
o threads running in parallel can modify table->data in the global data structure without any synchronization. Worse yet, is that that value is local to their stacks. That was the root cause of the issue addressed by Muchun's patch. Does that analysis make sense? Or, are we missing something. -- Mike Kravetz

Re: [Patch v2 6/7] mm/hugetlb: return non-isolated page in the loop instead of break and check

2020-08-28 Thread Mike Kravetz
t; Signed-off-by: Wei Yang > Reviewed-by: Mike Kravetz Commit bbe88753bd42 (mm/hugetlb: make hugetlb migration callback CMA aware) in v5.9-rc2 modified dequeue_huge_page_node_exact. This patch will need to be updated to take those changes into account. -- Mike Kravetz

Re: [Patch v2 2/7] mm/hugetlb: remove VM_BUG_ON(!nrg) in get_file_region_entry_from_cache()

2020-08-28 Thread Mike Kravetz
On 8/27/20 8:32 PM, Wei Yang wrote: > We are sure to get a valid file_region, otherwise the > VM_BUG_ON(resv->region_cache_count <= 0) at the very beginning would be > triggered. > > Let's remove the redundant one. > > Signed-off-by: Wei Yang Thank you. Revi

Re: [PATCH v2] mm/hugetlb: Fix a race between hugetlb sysctl handlers

2020-08-28 Thread Mike Kravetz
_SYSCALL_64_after_hwframe+0x44/0xa9 > > Fixes: e5ff215941d5 ("hugetlb: multiple hstates for multiple page sizes") > Signed-off-by: Muchun Song Thank you! Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [External] Re: [PATCH] mm/hugetlb: Fix a race between hugetlb sysctl handlers

2020-08-27 Thread Mike Kravetz
s set when the hugetlb ctl_table entries are defined and initialized. This is not something you introduced. The unnecessary assignments are in the existing code. However, there is no need to carry them forward. -- Mike Kravetz

Re: [drm/mgag200] 913ec479bb: vm-scalability.throughput 26.2% improvement

2020-08-27 Thread Mike Kravetz
n Xing and improved performance by 20 something percent. That seems in line with this report/improvement. Perhaps the tooling is not always accurate in determining the commit which causes the performance changes? Perhaps I am misreading information in the reports? -- Mike Kravetz

Re: [External] Re: [PATCH] mm/hugetlb: Fix a race between hugetlb sysctl handlers

2020-08-25 Thread Mike Kravetz
On 8/24/20 8:01 PM, Muchun Song wrote: > On Tue, Aug 25, 2020 at 5:21 AM Mike Kravetz wrote: >> >> I too am looking at this now and do not completely understand the race. >> It could be that: >> >> hugetlb_sysctl_handler_common >> ... &

Re: [PATCH v2 0/4] mm/hugetlb: Small cleanup and improvement

2020-08-24 Thread Mike Kravetz
Hello Andrew, Unless someone objects, can you add patches 1-3 of this series to your tree. They have been reviewed and are fairly simple cleanups. -- Mike Kravetz On 7/22/20 8:22 PM, Baoquan He wrote: > v1 is here: > https://lore.kernel.org/linux-mm/20200720062623.13135-1-...@redh

Re: [PATCH] mm/hugetlb: Fix a race between hugetlb sysctl handlers

2020-08-24 Thread Mike Kravetz
Instead of changing the code to 'handle the race', I think it might be acceptable to just put a big semaphore around it. -- Mike Kravetz

Re: [LKP] Re: [hugetlbfs] c0d0381ade: vm-scalability.throughput -33.4% regression

2020-08-21 Thread Mike Kravetz
On 8/21/20 2:02 PM, Mike Kravetz wrote: > Would you be willing to test this series on top of 34ae204f1851? I will need > to rebase the series to take the changes made by 34ae204f1851 into account. Actually, the series in this thread will apply/run cleanly on top of 34ae204f1851. No n

Re: [PATCH v7 0/3] make dma_alloc_coherent NUMA-aware by per-NUMA CMA

2020-08-21 Thread Mike Kravetz
On 8/21/20 1:47 PM, Song Bao Hua (Barry Song) wrote: > > >> -Original Message- >> From: Song Bao Hua (Barry Song) >> Sent: Saturday, August 22, 2020 7:27 AM >> To: 'Mike Kravetz' ; h...@lst.de; >> m.szyprow...@samsung.com; robin.mur...

Re: [LKP] Re: [hugetlbfs] c0d0381ade: vm-scalability.throughput -33.4% regression

2020-08-21 Thread Mike Kravetz
On 8/21/20 1:39 AM, Xing Zhengjun wrote: > > > On 6/26/2020 5:33 AM, Mike Kravetz wrote: >> On 6/22/20 3:01 PM, Mike Kravetz wrote: >>> On 6/21/20 5:55 PM, kernel test robot wrote: >>>> Greeting, >>>> >>>> FYI, we noticed a -33.4%

Re: [PATCH v7 0/3] make dma_alloc_coherent NUMA-aware by per-NUMA CMA

2020-08-21 Thread Mike Kravetz
asn't too worried because of the limited hugetlb use case. However, this series is adding another user of per-node CMA areas. With more users, should try to sync up number of CMA areas and number of nodes? Or, perhaps I am worrying about nothing? -- Mike Kravetz

Re: [PATCH 10/10] mm/hugetlb: not necessary to abuse temporary page to workaround the nasty free_huge_page

2020-08-11 Thread Mike Kravetz
On 8/11/20 4:19 PM, Wei Yang wrote: > On Tue, Aug 11, 2020 at 02:43:28PM -0700, Mike Kravetz wrote: >> Subject: [PATCH] hugetlb: optimize race error return in >> alloc_surplus_huge_page >> >> The routine alloc_surplus_huge_page() could race with with a pool >> s

Re: [PATCH v2 4/4] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved

2020-08-11 Thread Mike Kravetz
this, let's just leave things as they are and not add the message. It is pretty clear that a user needs to read the value after writing to determine if all pages were allocated. The log message would add little benefit to the end user. -- Mike Kravetz

Re: [PATCH 10/10] mm/hugetlb: not necessary to abuse temporary page to workaround the nasty free_huge_page

2020-08-11 Thread Mike Kravetz
I 'tested' it by allocating an 'extra' page and freeing it via this method in alloc_surplus_huge_page. >From 864c5f8ef4900c95ca3f6f2363a85f3cb25e793e Mon Sep 17 00:00:00 2001 From: Mike Kravetz Date: Tue, 11 Aug 2020 12:45:41 -0700 Subject: [PATCH] hugetlb: optimize race

Re: [PATCH v2 4/4] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved

2020-08-10 Thread Mike Kravetz
Cc: Michal On 8/10/20 7:11 PM, Baoquan He wrote: > Hi Mike, > > On 07/23/20 at 11:21am, Mike Kravetz wrote: >> On 7/23/20 2:11 AM, Baoquan He wrote: > ... >>>> But is kernel expected to warn for all such situations where the user >>>> requested r

Re: [PATCH 10/10] mm/hugetlb: not necessary to abuse temporary page to workaround the nasty free_huge_page

2020-08-10 Thread Mike Kravetz
o race with a pool resize which itself could cause surplus to exceed overcommit. IMO both approaches are valid. - Advantage of temporary page is that it can not cause surplus to exceed overcommit. Disadvantage is as mentioned in the comment 'abuse of temporary page'. - Advantage of this patch is that it uses existing counters. Disadvantage is that it can momentarily cause surplus to exceed overcommit. Unless someone has a strong opinion, I prefer the changes in this patch. -- Mike Kravetz

Re: [PATCH 09/10] mm/hugetlb: narrow the hugetlb_lock protection area during preparing huge page

2020-08-10 Thread Mike Kravetz
On 8/7/20 2:12 AM, Wei Yang wrote: > set_hugetlb_cgroup_[rsvd] just manipulate page local data, which is not > necessary to be protected by hugetlb_lock. > > Let's take this out. > > Signed-off-by: Wei Yang Thanks! Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH 08/10] mm/hugetlb: return non-isolated page in the loop instead of break and check

2020-08-10 Thread Mike Kravetz
t; Signed-off-by: Wei Yang I agree with Baoquan He in that this is more of a style change. Certainly there is the potential to avoid an extra check and that is always good. The real value in this patch (IMO) is removal of the stale comment. Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH 07/10] mm/hugetlb: a page from buddy is not on any list

2020-08-10 Thread Mike Kravetz
On 8/7/20 2:12 AM, Wei Yang wrote: > The page allocated from buddy is not on any list, so just use list_add() > is enough. > > Signed-off-by: Wei Yang Thanks! Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH 06/10] mm/hugetlb: remove redundant huge_pte_alloc() in hugetlb_fault()

2020-08-10 Thread Mike Kravetz
https://lore.kernel.org/linux-mm/e670f327-5cf9-1959-96e4-6dc7cc30d...@oracle.com/ -- Mike Kravetz

Re: [PATCH 04/10] mm/hugetlb: count file_region to be added when regions_needed != NULL

2020-08-10 Thread Mike Kravetz
stand. I might have: - Removed the function parameter. - Added local variable bool count_only = regions_needed != NULL; - Left remaining code as it. I'm OK with the proposed change. Any change to readability is VERY minimal. Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH 03/10] mm/hugetlb: use list_splice to merge two list at once

2020-08-10 Thread Mike Kravetz
s! Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH 02/10] mm/hugetlb: make sure to get NULL when list is empty

2020-08-10 Thread Mike Kravetz
gt; + nrg = list_first_entry_or_null(&resv->region_cache, >>> + struct file_region, link); >>> VM_BUG_ON(!nrg); > > Or we can remove this VM_BUG_ON()? > I would prefer that we just remove the 'VM_BUG_ON(!nrg)'. Code elsewhere is responsible for making sure there is ALWAYS an entry in the cache. That is why the 'VM_BUG_ON(resv->region_cache_count <= 0)' is at the beginning of the routine. -- Mike Kravetz

Re: [PATCH 01/10] mm/hugetlb: not necessary to coalesce regions recursively

2020-08-10 Thread Mike Kravetz
It is unfortunate that the region management code is difficult to understand. Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH 00/10] mm/hugetlb: code refine and simplification

2020-08-07 Thread Mike Kravetz
> nasty free_huge_page > > mm/hugetlb.c | 101 ++- > 1 file changed, 44 insertions(+), 57 deletions(-) Thanks Wei Yang! I'll take a look at these next week. -- Mike Kravetz

Re: [PATCH] hugetlbfs: remove call to huge_pte_alloc without i_mmap_rwsem

2020-08-03 Thread Mike Kravetz
On 8/3/20 4:00 PM, Mike Kravetz wrote: > On 8/3/20 3:52 PM, Matthew Wilcox wrote: >> On Mon, Aug 03, 2020 at 03:43:35PM -0700, Mike Kravetz wrote: >>> Commit c0d0381ade79 ("hugetlbfs: use i_mmap_rwsem for more pmd sharing >>> synchronization") requi

Re: [PATCH] hugetlbfs: remove call to huge_pte_alloc without i_mmap_rwsem

2020-08-03 Thread Mike Kravetz
On 8/3/20 3:52 PM, Matthew Wilcox wrote: > On Mon, Aug 03, 2020 at 03:43:35PM -0700, Mike Kravetz wrote: >> Commit c0d0381ade79 ("hugetlbfs: use i_mmap_rwsem for more pmd sharing >> synchronization") requires callers of huge_pte_alloc to hold i_mmap_rwsem >> in at le

[PATCH] hugetlbfs: remove call to huge_pte_alloc without i_mmap_rwsem

2020-08-03 Thread Mike Kravetz
ppropriate locking. Fixes: c0d0381ade79 ("hugetlbfs: use i_mmap_rwsem for more pmd sharing synchronization") Cc: Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 4 1 file changed, 4 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 590111ea6975..0f6716422a53 100644 --- a/m

Re: [PATCH v2] mm/hugetlb: Fix calculation of adjust_range_if_pmd_sharing_possible

2020-07-30 Thread Mike Kravetz
On 7/30/20 4:26 PM, Peter Xu wrote: > Hi, Mike, > > On Thu, Jul 30, 2020 at 02:49:18PM -0700, Mike Kravetz wrote: >> On 7/30/20 1:16 PM, Peter Xu wrote: >>> This is found by code observation only. >>> >>> Firstly, the worst case scenario should assume t

Re: [PATCH v2] mm/hugetlb: Fix calculation of adjust_range_if_pmd_sharing_possible

2020-07-30 Thread Mike Kravetz
is an actual problem in the existing code that needs to be fixed in stable. I think the existing code is correct, just inefficient. -- Mike Kravetz

[PATCH] cma: don't quit at first error when activating reserved areas

2020-07-30 Thread Mike Kravetz
x4d/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: c64be2bb1c6e ("drivers: add Contiguous Memory Allocator") Signed-off-by: Mike Kravetz Cc: --- mm/cma.c | 23 +-- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/mm/cma.c b/mm/cma.c index

Re: [PATCH v1 2/6] mm/page_isolation: don't dump_page(NULL) in set_migratetype_isolate()

2020-07-29 Thread Mike Kravetz
7;Return -EBUSY' removed from the comment and assumed the code would not return an error code. The code now more explicitly does return -EBUSY. My concern was when I incorrectly thought you were removing the error return code. Sorry for the noise. Acked-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH v1 2/6] mm/page_isolation: don't dump_page(NULL) in set_migratetype_isolate()

2020-07-29 Thread Mike Kravetz
d unusable. Admittedly, these races are rare and I had to work really hard to produce them. I'll try to find my testing mechanism. My concern is reintroducing this abandoning of pageblocks. I have not looked further in your series to see if this potentially addressed later. If no

Re: [PATCH v4] mm/hugetlb: add mempolicy check in the reservation routine

2020-07-28 Thread Mike Kravetz
patch summarizes the issues. IMO, at this time it makes little sense to perform checks for more than MPOL_BIND at reservation time. If we ever take on the monumental task of supporting mempolicy directed per-node reservations throughout the life of a process, support for other policies will need to be taken into account. -- Mike Kravetz

Re: [PATCH v3] mm/hugetlb: add mempolicy check in the reservation routine

2020-07-27 Thread Mike Kravetz
callq 0x81060f80 <__fentry__> 0x8126a3a5 <+5>: xor%eax,%eax 0x8126a3a7 <+7>: mov%gs:0x17bc0,%rdx 0x8126a3b0 <+16>: testb $0x1,0x778(%rdx) 0x8126a3b7 <+23>:jne0x8126a3ba 0x8126a3b9 <+25>:retq 0x8126a3ba <+26>:mov0x6c(%rdi),%eax 0x8126a3bd <+29>:retq End of assembler dump. -- Mike Kravetz

Re: [PATCH v3] mm/hugetlb: add mempolicy check in the reservation routine

2020-07-27 Thread Mike Kravetz
olicy. This new code will help produce a quick failure as described in the commit message, and it does not make existing interactions any worse. Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH v3] mm/hugetlb: split hugetlb_cma in nodes with memory

2020-07-27 Thread Mike Kravetz
you have multiple gigantic page sizes supported at one time (one system instance) on powerpc? -- Mike Kravetz

Re: [PATCH v2] mm/hugetlb: add mempolicy check in the reservation routine

2020-07-24 Thread Mike Kravetz
goto out; > } There is a big comment before this code in hugetlb_acct_memory. The comment only talks about cpusets. We should probably update that to include mempolicy as well. It could be as simple as s/cpuset/cpuset or mempolicy/. -- Mike Kravetz

Re: [PATCH v2 4/4] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved

2020-07-23 Thread Mike Kravetz
h hugetlb usage. I do not feel strongly one way or another about adding the warning. Since it is fairly trivial and could help diagnose issues I am in favor of adding it. If people feel strongly that it should not be added, I am open to those arguments. -- Mike Kravetz

Re: [PATCH 5/5] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved

2020-07-22 Thread Mike Kravetz
On 7/22/20 1:49 AM, Baoquan He wrote: > On 07/20/20 at 05:38pm, Mike Kravetz wrote: >>> + if (count != h->max_huge_pages) { >>> + char buf[32]; >>> + >>> + string_get_size(huge_page_size(h), 1, STRING_UNITS_2, buf, 32); >>> +

Re: linux-next: build failure after merge of the akpm-current tree

2020-07-21 Thread Mike Kravetz
20:44:57 +1000 > Subject: [PATCH] mm/hugetlb: better checks before using hugetlb_cma > > Signed-off-by: Stephen Rothwell Thanks Stephen, sorry for missing that in review. Acked-by: Mike Kravetz -- Mike Kravetz > --- > mm/hugetlb.c | 9 ++--- > 1 file changed, 6 insertions(

Re: [PATCH 5/5] mm/hugetl.c: warn out if expected count of huge pages adjustment is not achieved

2020-07-20 Thread Mike Kravetz
gt; old_max ? "increased" : "decreased", > + abs(old_max - h->max_huge_pages)); > + } > spin_unlock(&hugetlb_lock); I would prefer if we drop the lock before logging the message. That would involve grabbing the value of h->max_huge_pages before dropping the lock. -- Mike Kravetz > > NODEMASK_FREE(node_alloc_noretry); >

Re: [PATCH 4/5] doc/vm: fix typo in in the hugetlb admin documentation

2020-07-20 Thread Mike Kravetz
can > optionally be followed by the hugepages parameter to preallocate a > specific number of huge pages of default size. The number of default > Unfortunately, this review comment was missed when the typo was introduced. https://lore.kernel.org/lkml/5ca27419-7496-8799

Re: [PATCH 3/5] mm/hugetlb.c: Remove the unnecessary non_swap_entry()

2020-07-20 Thread Mike Kravetz
entry_migration() > and is_hugetlb_entry_hwpoisoned() to simplify code. > > Signed-off-by: Baoquan He Agreed, we can remove the checks for non_swap_entry. Reviewed-by: Mike Kravetz -- Mike Kravetz > --- > mm/hugetlb.c | 4 ++-- > 1 file changed, 2 insertions(+), 2

Re: [PATCH 2/5] mm/hugetlb.c: make is_hugetlb_entry_hwpoisoned return bool

2020-07-20 Thread Mike Kravetz
On 7/19/20 11:26 PM, Baoquan He wrote: > Just like his neighbour is_hugetlb_entry_migration() has done. > > Signed-off-by: Baoquan He Thanks, Reviewed-by: Mike Kravetz -- Mike Kravetz > --- > mm/hugetlb.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) &g

Re: [PATCH 1/5] mm/hugetlb.c: Fix typo of glb_reserve

2020-07-20 Thread Mike Kravetz
ma(vma); > unsigned long reserve, start, end; > - long gbl_reserve; > + long glb_reserve; I see both 'gbl' and 'glb' being used for global in variable names. grep will actually return more hits for gbl than glb. Unless there is consensus that 'gl

Re: [PATCH v3] mm/hugetlb: split hugetlb_cma in nodes with memory

2020-07-20 Thread Mike Kravetz
On 7/19/20 11:22 PM, Anshuman Khandual wrote: > > > On 07/17/2020 10:32 PM, Mike Kravetz wrote: >> On 7/16/20 10:02 PM, Anshuman Khandual wrote: >>> >>> >>> On 07/16/2020 11:55 PM, Mike Kravetz wrote: >>>> >From 17c8f37afbf42fe7412e6eeb

Re: [PATCH v3] mm/hugetlb: split hugetlb_cma in nodes with memory

2020-07-17 Thread Mike Kravetz
On 7/17/20 2:51 AM, Anshuman Khandual wrote: > > > On 07/17/2020 02:06 PM, Will Deacon wrote: >> On Fri, Jul 17, 2020 at 10:32:53AM +0530, Anshuman Khandual wrote: >>> >>> >>> On 07/16/2020 11:55 PM, Mike Kravetz wrote: >>>> >From 17c8f37a

Re: [PATCH v3] mm/hugetlb: split hugetlb_cma in nodes with memory

2020-07-17 Thread Mike Kravetz
On 7/16/20 10:02 PM, Anshuman Khandual wrote: > > > On 07/16/2020 11:55 PM, Mike Kravetz wrote: >> >From 17c8f37afbf42fe7412e6eebb3619c6e0b7e1c3c Mon Sep 17 00:00:00 2001 >> From: Mike Kravetz >> Date: Tue, 14 Jul 2020 15:54:46 -0700 >> Subject: [PATCH] h

Re: [PATCH v4 03/15] mm,madvise: call soft_offline_page() without MF_COUNT_INCREASED

2020-07-16 Thread Mike Kravetz
> Signed-off-by: Naoya Horiguchi > Signed-off-by: Oscar Salvador Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH v3] mm/hugetlb: split hugetlb_cma in nodes with memory

2020-07-16 Thread Mike Kravetz
On 7/16/20 1:12 AM, Will Deacon wrote: > On Wed, Jul 15, 2020 at 09:59:24AM -0700, Mike Kravetz wrote: >> >> So, everything in the existing code really depends on the hugetlb definition >> of gigantic page (order >= MAX_ORDER). The code to check for >> 'order &g

Re: [PATCH v3] mm/hugetlb: split hugetlb_cma in nodes with memory

2020-07-15 Thread Mike Kravetz
there are more use cases, or this seems too simple we can revisit that decision. >> + >> parsed_hstate = h; >> } >> >> @@ -5647,7 +5650,10 @@ void __init hugetlb_cma_reserve(int order) >> unsigned long size, reserved, per_node; >> int nid; >> >> -cma_reserve_called = true; >> +if (cma_reserve_called) >> +return; >> +else >> +cma_reserve_called = true; > > (nit: don't need the 'else' here) Yes, duh! -- Mike Kravetz

Re: [PATCH v3] mm/hugetlb: split hugetlb_cma in nodes with memory

2020-07-15 Thread Mike Kravetz
On 7/15/20 4:14 AM, Song Bao Hua (Barry Song) wrote: >> From: Mike Kravetz [mailto:mike.krav...@oracle.com] >> huge_page_size(h)/1024); >> >> +if (order >= MAX_ORDER && hugetlb_cma_size) >> +hugetlb_cma

Re: [PATCH v3] mm/hugetlb: split hugetlb_cma in nodes with memory

2020-07-14 Thread Mike Kravetz
Gushchin > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: H. Peter Anvin > Cc: Mike Kravetz > Cc: Mike Rapoport > Cc: Andrew Morton > Cc: Anshuman Khandual > Cc: Jonathan Cameron > Signed-o

Re: [PATCH] mm/hugetlb: hide nr_nodes in the internal of for_each_node_mask_to_[alloc|free]

2020-07-14 Thread Mike Kravetz
and code >>> [-Wdeclaration-after-statement] >>> >>> Instead we should switch to C99 and declare it as "for (int __nr_nodes" :P >> >> Hmm... I tried what you suggested, but compiler complains. >> >> 'for' loop initial declarations are only allowed in C99 or C11 mode > > Yes, by "we should switch to C99" I meant that the kernel kbuild system would > need to switch. Not a trivial change... > Without that, I don't see how your patch is possible to do safely. Vlastimil, thanks for pointing out future potential issues with this patch. I likely would have missed that. Wei, thanks for taking the time to put together the patch. However, I tend to agree with Vlastimil's assesment. The cleanup is not worth the risk of running into issues if someone uses multiple instances of the macro. -- Mike Kravetz

Re: [PATCH v4] mm/hugetlb: avoid hardcoding while checking if cma is enabled

2020-07-09 Thread Mike Kravetz
ouble reservation and CMA leak. > > Fixes: cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic hugepages > using cma") > Cc: Mike Kravetz > Cc: Jonathan Cameron > Acked-by: Roman Gushchin > Signed-off-by: Barry Song Thank you! Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma is enable

2020-07-09 Thread Mike Kravetz
On 7/9/20 4:45 PM, Song Bao Hua (Barry Song) wrote: > > >> -Original Message----- >> From: Mike Kravetz [mailto:mike.krav...@oracle.com] >> Sent: Friday, July 10, 2020 6:58 AM >> To: Song Bao Hua (Barry Song) ; Roman >> Gushchin >> Cc: Andrew Mo

Re: [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma is enable

2020-07-09 Thread Mike Kravetz
_reserve when we reserve CMA. -- Mike Kravetz diff --git a/mm/hugetlb.c b/mm/hugetlb.c index fab4485b9e52..92cb882cf287 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -46,6 +46,7 @@ unsigned int default_hstate_idx; struct hstate hstates[HUGE_MAX_HSTATE]; static struct cma *hugetlb_cma[MAX_

Re: [PATCH v4 04/11] mm/hugetlb: make hugetlb migration callback CMA aware

2020-07-08 Thread Mike Kravetz
age() uses memalloc_nocma_{save,restore} > to exclude CMA memory rather than manually clearing __GFP_MOVABLE. And, > this patch also makes the deque function on hugetlb CMA aware. In the > deque function, CMA memory is skipped if PF_MEMALLOC_NOCMA flag is set > by memalloc_nocma_{sa

Re: [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma is enable

2020-07-08 Thread Mike Kravetz
parsing time and there would be no need for such a check in the allocation code (except for sanity cheching). Thoughts? I just cleaned up the parsing code and could make such a change quite easily. -- Mike Kravetz

[RFC PATCH 3/3] huegtlbfs: handle page fault/truncate races

2020-07-06 Thread Mike Kravetz
necessary. File truncation (remove_inode_hugepages) needs to handle page mapping changes before locking the page. This could happen if page was added to page cache and later backed out in fault processing. Reported-by: kernel test robot Signed-off-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 41

[RFC PATCH 0/3] hugetlbfs: address fault time regression

2020-07-06 Thread Mike Kravetz
ted. [1] https://lore.kernel.org/lkml/20200622005551.GK5535@shao2-debian Mike Kravetz (3): Revert: "hugetlbfs: Use i_mmap_rwsem to address page fault/truncate race" hugetlbfs: Only take i_mmap_rwsem when sharing is possible huegtlbfs: handle page fault/truncate races f

[RFC PATCH 2/3] hugetlbfs: Only take i_mmap_rwsem when sharing is possible

2020-07-06 Thread Mike Kravetz
always take i_mmap_rwsem. These are not as performance sensitive. Reported-by: kernel test robot Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 96 ++-- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index

[RFC PATCH 1/3] Revert: "hugetlbfs: Use i_mmap_rwsem to address page fault/truncate race"

2020-07-06 Thread Mike Kravetz
Signed-off-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 28 mm/hugetlb.c | 23 --- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ef5313f9c78f..b4bb82815dd4 100644 --- a/fs

Re: [PATCH v3 02/15] mm, hwpoison: remove recalculating hpage

2020-06-30 Thread Mike Kravetz
uot; > Signed-off-by: Naoya Horiguchi Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH v3 01/15] mm,hwpoison: cleanup unused PageHuge() check

2020-06-30 Thread Mike Kravetz
ome functions like > hwpoison_user_mappings() and identify_page_state(), so they should properly > handle 4kB page, thp, and hugetlb. > > Signed-off-by: Naoya Horiguchi > Signed-off-by: Oscar Salvador Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH v3 4/8] mm/hugetlb: make hugetlb migration callback CMA aware

2020-06-30 Thread Mike Kravetz
n. >> >> As I've said I would _prefer_ simplicity over "correctness" if it is only >> partial and hard to reason about from the userspace experience but this >> is not something I would _insist_ on. If Mike as a maintainer of the >> code is ok with that th

[PATCH] hugetlb: fix pages per hugetlb calculation

2020-06-29 Thread Mike Kravetz
smaller than PMD_SIZE. Fixes: c0d0381ade79 ("hugetlbfs: use i_mmap_rwsem for more pmd sharing synchronization") Cc: sta...@kernel.org Signed-off-by: Mike Kravetz --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 57

Re: [hugetlbfs] c0d0381ade: vm-scalability.throughput -33.4% regression

2020-06-25 Thread Mike Kravetz
On 6/22/20 3:01 PM, Mike Kravetz wrote: > On 6/21/20 5:55 PM, kernel test robot wrote: >> Greeting, >> >> FYI, we noticed a -33.4% regression of vm-scalability.throughput due to >> commit: >> >> >> commit: c0d0381ade79885c04a04c303284b040616b116e (

Re: [PATCH 2/3] mm/huge_memory.c: update tlb entry if pmd is changed

2020-06-25 Thread Mike Kravetz
On 6/25/20 5:01 AM, Aneesh Kumar K.V wrote: > Mike Kravetz writes: > >> On 6/24/20 2:26 AM, Bibo Mao wrote: >>> When set_pmd_at is called in function do_huge_pmd_anonymous_page, >>> new tlb entry can be added by software on MIPS platform. >>> >>>

Re: [PATCH 2/3] mm/huge_memory.c: update tlb entry if pmd is changed

2020-06-24 Thread Mike Kravetz
itectures. arc looks like it could be problematic as update_mmu_cache_pmd calls update_mmu_cache and then operates on (address & PAGE_MASK). That could now be different. -- Mike Kravetz > > Signed-off-by: Bibo Mao > --- > mm/huge_memory.c | 2 ++ > 1 file chang

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