Re: [PATCH v8 18/24] mm: Provide speculative fault infrastructure

2018-02-26 Thread Daniel Jordan
Hi Laurent, This series doesn't build for me[*] when CONFIG_TRANSPARENT_HUGEPAGE is unset. The problem seems to be that the BUILD_BUG() version of pmd_same is called in pte_map_lock: On 02/16/2018 10:25 AM, Laurent Dufour wrote: +static bool pte_map_lock(struct vm_fault *vmf) +{ ...snip...

[PATCH 5/6] powerpc/mmu: drop mmap_sem now that locked_vm is atomic

2019-04-02 Thread Daniel Jordan
With locked_vm now an atomic, there is no need to take mmap_sem as writer. Delete and refactor accordingly. Signed-off-by: Daniel Jordan Cc: Alexey Kardashevskiy Cc: Andrew Morton Cc: Benjamin Herrenschmidt Cc: Christoph Lameter Cc: Davidlohr Bueso Cc: Michael Ellerman Cc: Paul Mackerras

[PATCH 1/6] mm: change locked_vm's type from unsigned long to atomic64_t

2019-04-02 Thread Daniel Jordan
Taking and dropping mmap_sem to modify a single counter, locked_vm, is overkill when the counter could be synchronized separately. Make mmap_sem a little less coarse by changing locked_vm to an atomic, the 64-bit variety to avoid issues with overflow on 32-bit systems. Signed-off-by: Daniel

[PATCH 6/6] kvm/book3s: drop mmap_sem now that locked_vm is atomic

2019-04-02 Thread Daniel Jordan
With locked_vm now an atomic, there is no need to take mmap_sem as writer. Delete and refactor accordingly. Signed-off-by: Daniel Jordan Cc: Alexey Kardashevskiy Cc: Andrew Morton Cc: Benjamin Herrenschmidt Cc: Christoph Lameter Cc: Davidlohr Bueso Cc: Michael Ellerman Cc: Paul Mackerras

[PATCH 0/6] convert locked_vm from unsigned long to atomic64_t

2019-04-02 Thread Daniel Jordan
ase consider for 5.2. Daniel [1] https://lore.kernel.org/linux-mm/20190211224437.25267-1-daniel.m.jor...@oracle.com/ [2] https://lore.kernel.org/linux-mm/20190206175920.31082-1-d...@stgolabs.net/ Daniel Jordan (6): mm: change locked_vm's type from unsigned long to atomic64_t vfio/type1: d

Re: [PATCH 1/6] mm: change locked_vm's type from unsigned long to atomic64_t

2019-04-03 Thread Daniel Jordan
On Wed, Apr 03, 2019 at 06:46:07AM +0200, Christophe Leroy wrote: > > > Le 02/04/2019 à 22:41, Daniel Jordan a écrit : > > Taking and dropping mmap_sem to modify a single counter, locked_vm, is > > overkill when the counter could be synchronized separately. > > >

Re: [PATCH 1/6] mm: change locked_vm's type from unsigned long to atomic64_t

2019-04-03 Thread Daniel Jordan
On Tue, Apr 02, 2019 at 04:43:57PM -0700, Davidlohr Bueso wrote: > On Tue, 02 Apr 2019, Andrew Morton wrote: > > > Also, we didn't remove any down_write(mmap_sem)s from core code so I'm > > thinking that the benefit of removing a few mmap_sem-takings from a few > > obscure drivers (sorry ;)) is

Re: [PATCH 5/6] powerpc/mmu: drop mmap_sem now that locked_vm is atomic

2019-04-03 Thread Daniel Jordan
On Wed, Apr 03, 2019 at 06:58:45AM +0200, Christophe Leroy wrote: > Le 02/04/2019 à 22:41, Daniel Jordan a écrit : > > With locked_vm now an atomic, there is no need to take mmap_sem as > > writer. Delete and refactor accordingly. > > Could you please detail the chang

Re: [PATCH 1/6] mm: change locked_vm's type from unsigned long to atomic64_t

2019-04-03 Thread Daniel Jordan
On Tue, Apr 02, 2019 at 03:04:24PM -0700, Andrew Morton wrote: > On Tue, 2 Apr 2019 16:41:53 -0400 Daniel Jordan > wrote: > > static long kvmppc_account_memlimit(unsigned long stt_pages, bool inc) > > { > > long ret = 0; > > + s64 locked_vm; > >

Re: [PATCH 0/6] convert locked_vm from unsigned long to atomic64_t

2019-04-03 Thread Daniel Jordan
On Wed, Apr 03, 2019 at 08:51:13AM -0400, Steven Sistare wrote: > On 4/2/2019 4:41 PM, Daniel Jordan wrote: > > [1] > > https://lore.kernel.org/linux-mm/20190211224437.25267-1-daniel.m.jor...@oracle.com/ > > You could clean all 6 patches up nicely with a common subrou

Re: [PATCH 2/5] vfio/spapr_tce: use pinned_vm instead of locked_vm to account pinned pages

2019-02-12 Thread Daniel Jordan
On Tue, Feb 12, 2019 at 04:50:11PM +, Christopher Lameter wrote: > On Tue, 12 Feb 2019, Alexey Kardashevskiy wrote: > > > Now it is 3 independent accesses (actually 4 but the last one is > > diagnostic) with no locking around them. Why do not we need a lock > > anymore precisely? Thanks, > >

Re: [PATCH 1/5] vfio/type1: use pinned_vm instead of locked_vm to account pinned pages

2019-02-12 Thread Daniel Jordan
On Tue, Feb 12, 2019 at 11:41:10AM -0700, Alex Williamson wrote: > Daniel Jordan wrote: > > On Mon, Feb 11, 2019 at 03:56:20PM -0700, Jason Gunthorpe wrote: > > > I haven't looked at this super closely, but how does this stuff work? > > > > > > do_mlock doesn

Re: [PATCH 1/5] vfio/type1: use pinned_vm instead of locked_vm to account pinned pages

2019-02-13 Thread Daniel Jordan
On Wed, Feb 13, 2019 at 01:03:30PM -0700, Alex Williamson wrote: > Daniel Jordan wrote: > > On Tue, Feb 12, 2019 at 11:41:10AM -0700, Alex Williamson wrote: > > > This still makes me nervous because we have userspace dependencies on > > > setting process locked memory.

[PATCH 0/5] use pinned_vm instead of locked_vm to account pinned pages

2019-02-11 Thread Daniel Jordan
/r/20181105165558.11698-8-daniel.m.jor...@oracle.com [1] http://lkml.kernel.org/r/20190206175920.31082-1-d...@stgolabs.net Daniel Jordan (5): vfio/type1: use pinned_vm instead of locked_vm to account pinned pages vfio/spapr_tce: use pinned_vm instead of locked_vm to account pinned pages

[PATCH 3/5] fpga/dlf/afu: use pinned_vm instead of locked_vm to account pinned pages

2019-02-11 Thread Daniel Jordan
as writer: delete. Signed-off-by: Daniel Jordan --- drivers/fpga/dfl-afu-dma-region.c | 50 ++- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c index e18a786fc943..a9a6b317f

Re: [PATCH 0/5] use pinned_vm instead of locked_vm to account pinned pages

2019-02-11 Thread Daniel Jordan
On Mon, Feb 11, 2019 at 03:54:47PM -0700, Jason Gunthorpe wrote: > On Mon, Feb 11, 2019 at 05:44:32PM -0500, Daniel Jordan wrote: > > Hi, > > > > This series converts users that account pinned pages with locked_vm to > > account with pinned_vm instead, pinned_v

[PATCH 2/5] vfio/spapr_tce: use pinned_vm instead of locked_vm to account pinned pages

2019-02-11 Thread Daniel Jordan
p_sem held as writer: delete. Signed-off-by: Daniel Jordan --- Documentation/vfio.txt | 6 +-- drivers/vfio/vfio_iommu_spapr_tce.c | 64 ++--- 2 files changed, 33 insertions(+), 37 deletions(-) diff --git a/Documentation/vfio.txt b/Documentation/vfio

[PATCH 5/5] kvm/book3s: use pinned_vm instead of locked_vm to account pinned pages

2019-02-11 Thread Daniel Jordan
p_sem held as writer: delete. Signed-off-by: Daniel Jordan --- arch/powerpc/kvm/book3s_64_vio.c | 35 ++-- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 532ab79734c7..2f8d7c051e

[PATCH 1/5] vfio/type1: use pinned_vm instead of locked_vm to account pinned pages

2019-02-11 Thread Daniel Jordan
er: delete. Signed-off-by: Daniel Jordan --- drivers/vfio/vfio_iommu_type1.c | 31 --- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 73652e21efec..a56cc341813f 100644 --- a/dr

Re: [PATCH 1/5] vfio/type1: use pinned_vm instead of locked_vm to account pinned pages

2019-02-11 Thread Daniel Jordan
On Mon, Feb 11, 2019 at 03:56:20PM -0700, Jason Gunthorpe wrote: > On Mon, Feb 11, 2019 at 05:44:33PM -0500, Daniel Jordan wrote: > > @@ -266,24 +267,15 @@ static int vfio_lock_acct(struct vfio_dma *dma, long > > npage, bool async) > > if (!mm) > > retur

[PATCH 4/5] powerpc/mmu: use pinned_vm instead of locked_vm to account pinned pages

2019-02-11 Thread Daniel Jordan
p_sem held as writer: delete. Signed-off-by: Daniel Jordan --- arch/powerpc/mm/mmu_context_iommu.c | 43 ++--- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/mm/mmu_context_iommu.c b/arch/powerpc/mm/mmu_context_iommu.c index a712a650a8b6..fd

Re: [PATCH 1/6] mm: change locked_vm's type from unsigned long to atomic64_t

2019-04-11 Thread Daniel Jordan
On Thu, Apr 11, 2019 at 10:55:43AM +0100, Mark Rutland wrote: > On Thu, Apr 11, 2019 at 02:22:23PM +1000, Alexey Kardashevskiy wrote: > > On 03/04/2019 07:41, Daniel Jordan wrote: > > > > - dev_dbg(dev, "[%d] RLIMIT_MEMLOCK %c%ld %ld/%ld%s\n", current-

Re: [PATCH v2] mm: add account_locked_vm utility function

2019-05-28 Thread Daniel Jordan
On Sat, May 25, 2019 at 02:51:18PM -0700, Andrew Morton wrote: > On Fri, 24 May 2019 13:50:45 -0400 Daniel Jordan > wrote: > > > locked_vm accounting is done roughly the same way in five places, so > > unify them in a helper. Standardize the debug prints, which vary >

Re: [PATCH v2] mm: add account_locked_vm utility function

2019-05-29 Thread Daniel Jordan
On Wed, May 29, 2019 at 11:05:48AM -0700, Ira Weiny wrote: > On Fri, May 24, 2019 at 01:50:45PM -0400, Daniel Jordan wrote: > > +static inline int account_locked_vm(struct mm_struct *mm, unsigned long > > pages, > > + bool inc) &

[PATCH v3] mm: add account_locked_vm utility function

2019-05-29 Thread Daniel Jordan
in tce_account_locked_vm is removed because Alexey has never seen it triggered. Signed-off-by: Daniel Jordan Tested-by: Alexey Kardashevskiy Cc: Alan Tull Cc: Alex Williamson Cc: Andrew Morton Cc: Benjamin Herrenschmidt Cc: Christoph Lameter Cc: Christophe Leroy Cc: Davidlohr Bueso Cc: Ira Weiny Cc: Jason

[PATCH v2] mm: add account_locked_vm utility function

2019-05-24 Thread Daniel Jordan
is that the -EPERM case in tce_account_locked_vm is removed because Alexey has never seen it triggered. Signed-off-by: Daniel Jordan Tested-by: Alexey Kardashevskiy Cc: Alan Tull Cc: Alex Williamson Cc: Andrew Morton Cc: Benjamin Herrenschmidt Cc: Christoph Lameter Cc: Christophe Leroy Cc

Re: [PATCH] mm: add account_locked_vm utility function

2019-05-20 Thread Daniel Jordan
On Mon, May 20, 2019 at 04:19:34PM +1000, Alexey Kardashevskiy wrote: > On 04/05/2019 06:16, Daniel Jordan wrote: > > locked_vm accounting is done roughly the same way in five places, so > > unify them in a helper. Standardize the debug prints, which vary > > slightly. &g

Re: [PATCH] mm: add account_locked_vm utility function

2019-05-06 Thread Daniel Jordan
On Fri, May 03, 2019 at 11:28:22PM +, Jason Gunthorpe wrote: > On Fri, May 03, 2019 at 01:16:30PM -0700, Daniel Jordan wrote: > > Andrew, this one patch replaces these six from [1]: > > > > mm-change-locked_vms-type-from-unsigned-long-to-atomic64_t.patch > >

[PATCH] mm: add account_locked_vm utility function

2019-05-03 Thread Daniel Jordan
locked_vm accounting is done roughly the same way in five places, so unify them in a helper. Standardize the debug prints, which vary slightly. Error codes stay the same, so user-visible behavior does too. Signed-off-by: Daniel Jordan Cc: Alan Tull Cc: Alexey Kardashevskiy Cc: Alex

Re: [PATCH 5/6] powerpc/mmu: drop mmap_sem now that locked_vm is atomic

2019-04-24 Thread Daniel Jordan
On Wed, Apr 24, 2019 at 11:10:24AM +, Jason Gunthorpe wrote: > On Tue, Apr 23, 2019 at 07:15:44PM -0700, Davidlohr Bueso wrote: > > Wouldn't the cmpxchg alternative also be exposed the locked_vm changing > > between > > validating the new value and the cmpxchg() and we'd bogusly fail even

Re: [PATCH 1/6] mm: change locked_vm's type from unsigned long to atomic64_t

2019-04-22 Thread Daniel Jordan
On Tue, Apr 16, 2019 at 04:33:51PM -0700, Andrew Morton wrote: Sorry for the delay, I was on vacation all last week. > What's the status of this patchset, btw? > > I have a note here that > powerpc-mmu-drop-mmap_sem-now-that-locked_vm-is-atomic.patch is to be > updated. Yes, the series needs a

[PATCH v2 3/7] padata: allocate work structures for parallel jobs from a pool

2020-05-20 Thread Daniel Jordan
so remove it. If the global pool is exhausted, a parallel job is run in the current task instead to throttle a system trying to do too much in parallel. Signed-off-by: Daniel Jordan --- include/linux/padata.h | 8 +-- kernel/padata.c| 118 +++-- 2 fil

[PATCH v2 4/7] padata: add basic support for multithreaded jobs

2020-05-20 Thread Daniel Jordan
and Steve Sistare. Signed-off-by: Daniel Jordan --- include/linux/padata.h | 29 kernel/padata.c| 152 - 2 files changed, 178 insertions(+), 3 deletions(-) diff --git a/include/linux/padata.h b/include/linux/padata.h index 3bfa503503ac5

[PATCH v2 1/7] padata: remove exit routine

2020-05-20 Thread Daniel Jordan
padata_driver_exit() is unnecessary because padata isn't built as a module and doesn't exit. padata's init routine will soon allocate memory, so getting rid of the exit function now avoids pointless code to free it. Signed-off-by: Daniel Jordan --- kernel/padata.c | 6 -- 1 file changed, 6

[PATCH v2 6/7] mm: make deferred init's max threads arch-specific

2020-05-20 Thread Daniel Jordan
Using padata during deferred init has only been tested on x86, so for now limit it to this architecture. If another arch wants this, it can find the max thread limit that's best for it and override deferred_page_init_max_threads(). Signed-off-by: Daniel Jordan --- arch/x86/mm/init_64.c| 12

[PATCH v2 5/7] mm: parallelize deferred_init_memmap()

2020-05-20 Thread Daniel Jordan
-restart_kvmforum2019.pdf Signed-off-by: Daniel Jordan --- mm/Kconfig | 6 ++--- mm/page_alloc.c | 60 - 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/mm/Kconfig b/mm/Kconfig index c1acc34c1c358..04c1da3f9f44c 100644 --- a/mm

[PATCH v2 7/7] padata: document multithreaded jobs

2020-05-20 Thread Daniel Jordan
Add Documentation for multithreaded jobs. Signed-off-by: Daniel Jordan --- Documentation/core-api/padata.rst | 41 +++ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/Documentation/core-api/padata.rst b/Documentation/core-api/padata.rst index

[PATCH v2 0/7] padata: parallelize deferred page init

2020-05-20 Thread Daniel Jordan
ail-anthony.yzn...@oracle.com/ [2] https://lore.kernel.org/linux-mm/20181105165558.11698-1-daniel.m.jor...@oracle.com/ Daniel Jordan (7): padata: remove exit routine padata: initialize earlier padata: allocate work structures for parallel jobs from a pool padata: add basic support for multithrea

[PATCH v2 2/7] padata: initialize earlier

2020-05-20 Thread Daniel Jordan
padata will soon initialize the system's struct pages in parallel, so it needs to be ready by page_alloc_init_late(). The error return from padata_driver_init() triggers an initcall warning, so add a warning to padata_init() to avoid silent failure. Signed-off-by: Daniel Jordan --- include

Re: [PATCH v2 5/7] mm: parallelize deferred_init_memmap()

2020-05-21 Thread Daniel Jordan
On Thu, May 21, 2020 at 09:46:35AM -0700, Alexander Duyck wrote: > It is more about not bothering with the extra tracking. We don't > really need it and having it doesn't really add much in the way of > value. Yeah, it can probably go. > > > > @@ -1863,11 +1892,32 @@ static int __init

[PATCH v3 0/8] padata: parallelize deferred page init

2020-05-27 Thread Daniel Jordan
ast-restart_kvmforum2019.pdf https://www.youtube.com/watch?v=pBsHnf93tcQ https://lore.kernel.org/linux-mm/1588812129-8596-1-git-send-email-anthony.yzn...@oracle.com/ [2] https://lore.kernel.org/linux-mm/20181105165558.11698-1-daniel.m.jor...@oracle.com/ Daniel Jordan (8): padata: remove exit rout

[PATCH v3 8/8] padata: document multithreaded jobs

2020-05-27 Thread Daniel Jordan
Add Documentation for multithreaded jobs. Signed-off-by: Daniel Jordan Tested-by: Josh Triplett --- Documentation/core-api/padata.rst | 41 +++ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/Documentation/core-api/padata.rst b/Documentation/core

[PATCH v3 7/8] mm: make deferred init's max threads arch-specific

2020-05-27 Thread Daniel Jordan
Using padata during deferred init has only been tested on x86, so for now limit it to this architecture. If another arch wants this, it can find the max thread limit that's best for it and override deferred_page_init_max_threads(). Signed-off-by: Daniel Jordan Tested-by: Josh Triplett

[PATCH v3 4/8] padata: add basic support for multithreaded jobs

2020-05-27 Thread Daniel Jordan
and Steve Sistare. Signed-off-by: Daniel Jordan Tested-by: Josh Triplett --- include/linux/padata.h | 29 kernel/padata.c| 152 - 2 files changed, 178 insertions(+), 3 deletions(-) diff --git a/include/linux/padata.h b/include/linux/padata.h

[PATCH v3 1/8] padata: remove exit routine

2020-05-27 Thread Daniel Jordan
padata_driver_exit() is unnecessary because padata isn't built as a module and doesn't exit. padata's init routine will soon allocate memory, so getting rid of the exit function now avoids pointless code to free it. Signed-off-by: Daniel Jordan Tested-by: Josh Triplett --- kernel/padata.c | 6

[PATCH v3 5/8] mm: don't track number of pages during deferred initialization

2020-05-27 Thread Daniel Jordan
that the page count can vary, just remove it. The boot message now looks like node 0 deferred pages initialised in 97ms Signed-off-by: Daniel Jordan Suggested-by: Alexander Duyck --- mm/page_alloc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_alloc.c b/mm

[PATCH v3 2/8] padata: initialize earlier

2020-05-27 Thread Daniel Jordan
padata will soon initialize the system's struct pages in parallel, so it needs to be ready by page_alloc_init_late(). The error return from padata_driver_init() triggers an initcall warning, so add a warning to padata_init() to avoid silent failure. Signed-off-by: Daniel Jordan Tested-by: Josh

[PATCH v3 6/8] mm: parallelize deferred_init_memmap()

2020-05-27 Thread Daniel Jordan
as init process With this patch series: [0.231435] node 1 initialised, 24189223 pages in 32ms [0.236718] node 0 initialised, 23398907 pages in 36ms [1] https://static.sched.com/hosted_files/kvmforum2019/66/VMM-fast-restart_kvmforum2019.pdf Signed-off-by: Daniel Jordan Tested

[PATCH v3 3/8] padata: allocate work structures for parallel jobs from a pool

2020-05-27 Thread Daniel Jordan
so remove it. If the global pool is exhausted, a parallel job is run in the current task instead to throttle a system trying to do too much in parallel. Signed-off-by: Daniel Jordan Tested-by: Josh Triplett --- include/linux/padata.h | 8 +-- kernel/padata.c

Re: [PATCH v2 5/7] mm: parallelize deferred_init_memmap()

2020-05-21 Thread Daniel Jordan
On Wed, May 20, 2020 at 06:29:32PM -0700, Alexander Duyck wrote: > On Wed, May 20, 2020 at 11:27 AM Daniel Jordan > > @@ -1814,16 +1815,44 @@ deferred_init_maxorder(u64 *i, struct zone *zone, > > unsigned long *start_pfn, > > return nr_pages; > > } &

Re: [PATCH v2 5/7] mm: parallelize deferred_init_memmap()

2020-05-21 Thread Daniel Jordan
On Thu, May 21, 2020 at 08:00:31AM -0700, Alexander Duyck wrote: > So I was thinking about my suggestion further and the loop at the end > isn't quite correct as I believe it could lead to gaps. The loop on > the end should probably be: > for_each_free_mem_pfn_range_in_zone_from(i,