Re: [PATCH 04/15] arm64: switch to generic version of pte allocation

2019-05-05 Thread Mike Rapoport
On Fri, May 03, 2019 at 11:05:09AM +0100, Mark Rutland wrote: > Hi, > > On Thu, May 02, 2019 at 06:28:31PM +0300, Mike Rapoport wrote: > > The PTE allocations in arm64 are identical to the generic ones modulo the > > GFP flags. > > > > Using the generic

Re: [PATCH 08/15] mips: switch to generic version of pte allocation

2019-05-05 Thread Mike Rapoport
On Thu, May 02, 2019 at 07:09:47PM +, Paul Burton wrote: > Hi Mike, > > On Thu, May 02, 2019 at 06:28:35PM +0300, Mike Rapoport wrote: > > MIPS allocates kernel PTE pages with > > > > __get_free_pages(GFP_KERNEL | __GFP_ZERO, PTE_ORDER)

Re: [PATCH 01/15] asm-generic, x86: introduce generic pte_{alloc,free}_one[_kernel]

2019-05-05 Thread Mike Rapoport
On Thu, May 02, 2019 at 07:03:11PM +, Paul Burton wrote: > Hi Mike, > > On Thu, May 02, 2019 at 06:28:28PM +0300, Mike Rapoport wrote: > > +/** > > + * pte_free_kernel - free PTE-level user page table page > > + * @mm: the mm_struct of the current context > >

[PATCH 15/15] unicore32: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
of __GFP_ACCOUNT to the GFP flags. The pte_free() and pte_free_kernel() versions are identical to the generic ones and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/unicore32/include/asm/pgalloc.h | 36 1 file changed, 8 insertions(+), 28

[PATCH 13/15] riscv: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
that GFP_ACCOUNT is used for the user PTE allocations. The pte_free() and pte_free_kernel() versions are identical to the generic ones and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/riscv/include/asm/pgalloc.h | 29 ++--- 1 file changed, 2 insertions(+), 27 deletions

[PATCH 14/15] um: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
to the generic ones and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/um/include/asm/pgalloc.h | 16 ++-- arch/um/kernel/mem.c | 22 -- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/arch/um/include/asm/pgalloc.h b/arch/um

[PATCH 01/15] asm-generic, x86: introduce generic pte_{alloc, free}_one[_kernel]

2019-05-02 Thread Mike Rapoport
ual memory allocation or must use non-default GFP flags. x86 is switched to use generic pte_alloc_one_kernel(), pte_free_kernel() and pte_free(). x86 still implements pte_alloc_one() to allow run-time control of GFP flags required for "userpte" command line option. Signed-off-by: Mike Rap

[PATCH 12/15] powerpc/nohash/64: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
The 64-bit book-E powerpc implements pte_alloc_one(), pte_alloc_one_kernel(), pte_free_kernel() and pte_free() the same way as the generic version. Switch it to the generic version that does exactly the same thing. Signed-off-by: Mike Rapoport --- arch/powerpc/include/asm/nohash/64/pgalloc.h

[PATCH 11/15] parisc: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
on are identical to the generic ones and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/parisc/include/asm/pgalloc.h | 33 ++--- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h

[PATCH 02/15] alpha: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
are identical to the generic ones and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/alpha/include/asm/pgalloc.h | 40 +++- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/arch/alpha/include/asm/pgalloc.h b/arch/alpha/include/asm

[PATCH 10/15] nios2: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
. Signed-off-by: Mike Rapoport --- arch/nios2/include/asm/pgalloc.h | 37 ++--- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h index 3a149ea..4bc8cf7 100644 --- a/arch/nios2/include/asm

[PATCH 09/15] nds32: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
one and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/nds32/include/asm/pgalloc.h | 31 --- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/arch/nds32/include/asm/pgalloc.h b/arch/nds32/include/asm/pgalloc.h index 3c5fee5..954696c 100644

[PATCH 08/15] mips: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
MIPS to the generic version that does exactly the same thing for the kernel page tables and adds __GFP_ACCOUNT for the user PTEs. The pte_free_kernel() and pte_free() versions on mips are identical to the generic ones and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/mips/include/asm

[PATCH 07/15] m68k: sun3: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
ones. The pte_free() and pte_free_kernel() versions are identical to the generic ones and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/m68k/include/asm/sun3_pgalloc.h | 41 ++-- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/arch

[PATCH 06/15] hexagon: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
The hexagon implementation pte_alloc_one(), pte_alloc_one_kernel(), pte_free_kernel() and pte_free() is identical to the generic except of lack of __GFP_ACCOUNT for the user PTEs allocation. Switch hexagon to use generic version of these functions. Signed-off-by: Mike Rapoport --- arch/hexagon

[PATCH 05/15] csky: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
it does not clear the allocated page but rather sets each PTE in it to a non-zero value. The pte_free_kernel() and pte_free() versions on csky are identical to the generic ones and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/csky/include/asm/pgalloc.h | 30

[PATCH 04/15] arm64: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
dropped. Signed-off-by: Mike Rapoport --- arch/arm64/include/asm/pgalloc.h | 43 arch/arm64/mm/mmu.c | 2 +- arch/arm64/mm/pgd.c | 4 ++-- virt/kvm/arm/mmu.c | 2 +- 4 files changed, 8 insertions(+), 43 deletions

[PATCH 03/15] arm: switch to generic version of pte allocation

2019-05-02 Thread Mike Rapoport
of __GFP_ACCOUNT to the GFP flags. The conversion to the generic version of pte_free_kernel() removes the NULL check for pte. The pte_free() version on arm is identical to the generic one and can be simply dropped. Signed-off-by: Mike Rapoport --- arch/arm/include/asm/pgalloc.h | 41

[PATCH 00/15] introduce generic pte_{alloc,free}_one[_kernel]

2019-05-02 Thread Mike Rapoport
neric pte_{alloc,free}_one[_kernel] Mike Rapoport (15): asm-generic, x86: introduce generic pte_{alloc,free}_one[_kernel] alpha: switch to generic version of pte allocation arm: switch to generic version of pte allocation arm64: switch to generic version of pte allocation csky: switch

[PATCH] memblock: make keeping memblock memory opt-in rather than opt-out

2019-04-24 Thread Mike Rapoport
system initialization and skips the necessity to add ARCH_DISCARD_MEMBLOCK to the architectures that are still missing that option. Signed-off-by: Mike Rapoport --- arch/arm/Kconfig | 2 +- arch/arm64/Kconfig | 1 + arch/hexagon/Kconfig | 1 - arch/ia64/Kconfig| 1

Re: [PATCH v8 4/4] hugetlb: allow to free gigantic pages regardless of the configuration

2019-03-28 Thread Mike Kravetz
; > Signed-off-by: Alexandre Ghiti > Acked-by: David S. Miller [sparc] Thanks for all the updates Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH AUTOSEL 5.0 015/262] memblock: memblock_phys_alloc_try_nid(): don't panic

2019-03-27 Thread Mike Rapoport
Hi, On Wed, Mar 27, 2019 at 01:57:50PM -0400, Sasha Levin wrote: > From: Mike Rapoport > > [ Upstream commit 337555744e6e39dd1d87698c6084dd88a606d60a ] > > The memblock_phys_alloc_try_nid() function tries to allocate memory from > the requested node and then falls back to a

Re: [PATCH v6 4/4] hugetlb: allow to free gigantic pages regardless of the configuration

2019-03-08 Thread Mike Kravetz
; > Signed-off-by: Alexandre Ghiti > Acked-by: David S. Miller [sparc] Reviewed-by: Mike Kravetz -- Mike Kravetz

Re: [PATCH v4 04/19] powerpc: mm: Add p?d_large() definitions

2019-03-08 Thread Mike Rapoport
p;& pmd_present(*pmd) && !pmd_is_leaf(*pmd))) > + if (level == 0 && !(pmd && pmd_present(*pmd) && !pmd_large(*pmd))) > new_ptep = kvmppc_pte_alloc(); > > /* Check if we might have been invalidated; let the guest retry if so */ > @@ -657,7 +651,7 @@ int kvmppc_create_pte(struct kvm *kvm, pgd_t *pgtable, > pte_t pte, > new_pmd = NULL; > } > pmd = pmd_offset(pud, gpa); > - if (pmd_is_leaf(*pmd)) { > + if (pmd_large(*pmd)) { > unsigned long lgpa = gpa & PMD_MASK; > > /* Check if we raced and someone else has set the same thing */ > -- > 2.20.1 > -- Sincerely yours, Mike.

Re: [PATCH v4 4/4] hugetlb: allow to free gigantic pages regardless of the configuration

2019-03-01 Thread Mike Kravetz
On 3/1/19 5:21 AM, Alexandre Ghiti wrote: > On 03/01/2019 07:25 AM, Alex Ghiti wrote: >> On 2/28/19 5:26 PM, Mike Kravetz wrote: >>> On 2/28/19 12:23 PM, Dave Hansen wrote: >>>> On 2/28/19 11:50 AM, Mike Kravetz wrote: >>>&g

Re: build failure of current mmotm with skiroot_defconfig

2019-02-26 Thread Mike Rapoport
On Tue, Feb 26, 2019 at 10:39:54AM +0100, Christophe Leroy wrote: > > > Le 26/02/2019 à 09:12, Mike Rapoport a écrit : > >Hi, > > > >I've encountered the following error when building skyroot_defconfig with > >current mmotm tree: > > > >make CONFIG

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

2019-02-26 Thread Mike Rapoport
ree. > > Both patches added the alloc_stack() function and git resolved it by > adding both. :-( I have added a patch to remove one of them. Yeah, me too :) https://lore.kernel.org/linux-mm/20190226064032.GA5873@rapoport-lnx/ Stephen, sorry, should have cc'ed you > -- > Cheers, > Stephen Rothwell -- Sincerely yours, Mike.

build failure of current mmotm with skiroot_defconfig

2019-02-26 Thread Mike Rapoport
et 'arch/powerpc/kernel' failed make[2]: *** [arch/powerpc/kernel] Error 2 Makefile:1049: recipe for target 'arch/powerpc' failed make[1]: *** [arch/powerpc] Error 2 -- Sincerely yours, Mike.

Re: [RESEND PATCH 3/7] mm/gup: Change GUP fast to use flags rather than a write 'bool'

2019-02-20 Thread Mike Marshall
Hi Ira Martin and I looked at your patch and agree that it doesn't change functionality for Orangefs. Reviewed-by: Mike Marshall On Wed, Feb 20, 2019 at 12:32 AM wrote: > > From: Ira Weiny > > To facilitate additional options to get_user_pages_fast() change the > singular

Re: [PATCH 0/2] x86, numa: always initialize all possible nodes

2019-02-12 Thread Mike Rapoport
; for an easier debugging of a broken zonelist setup. > > [1] http://lkml.kernel.org/r/20190114082416.30939-1-mho...@kernel.org FWIW, Reviewed-by: Mike Rapoport for the series. -- Sincerely yours, Mike.

Re: [PATCH v2 10/21] memblock: refactor internal allocation functions

2019-02-03 Thread Mike Rapoport
(dropped most of 'CC) On Sun, Feb 03, 2019 at 08:39:20PM +1100, Michael Ellerman wrote: > Mike Rapoport writes: > > > Currently, memblock has several internal functions with overlapping > > functionality. They all call memblock_find_in_range_node() to find free > >

Re: [PATCH v2 10/21] memblock: refactor internal allocation functions

2019-02-03 Thread Mike Rapoport
On Sun, Feb 03, 2019 at 08:39:20PM +1100, Michael Ellerman wrote: > Mike Rapoport writes: > > > Currently, memblock has several internal functions with overlapping > > functionality. They all call memblock_find_in_range_node() to find free > > memory and then reserve the

Re: linux-next: powerpc le qemu boot failure after merge of the akpm tree

2019-01-30 Thread Mike Rapoport
x210/0x238 > >>[c105bdb0] [c0e468f4] initmem_init+0x1e0/0x260 > >>[c105be80] [c0e3b9b0] setup_arch+0x354/0x3d4 > >>[c105bef0] [c0e33afc] start_kernel+0x98/0x648 > >>[c105bf90] [c000b270] start_here_com

Re: [PATCH v2 19/21] treewide: add checks for the return value of memblock_alloc*()

2019-01-30 Thread Mike Rapoport
On Thu, Jan 31, 2019 at 08:07:29AM +0100, Christophe Leroy wrote: > > > Le 31/01/2019 à 07:44, Christophe Leroy a écrit : > > > > > >Le 31/01/2019 à 07:41, Mike Rapoport a écrit : > >>On Thu, Jan 31, 2019 at 07:07:46AM +0100, Christophe Leroy wrote: > >

Re: [PATCH v2 19/21] treewide: add checks for the return value of memblock_alloc*()

2019-01-30 Thread Mike Rapoport
On Thu, Jan 31, 2019 at 07:07:46AM +0100, Christophe Leroy wrote: > > > Le 21/01/2019 à 09:04, Mike Rapoport a écrit : > >Add check for the return value of memblock_alloc*() functions and call > >panic() in case of error. > >The panic message repeats the one used by p

Re: linux-next: powerpc le qemu boot failure after merge of the akpm tree

2019-01-30 Thread Mike Rapoport
00105bef0] [c0e33afc] start_kernel+0x98/0x648 > >>[c105bf90] [c000b270] start_here_common+0x1c/0x52c > > > >A quick bisect leads to this: > > > >1c3c9328cde027eb875ba4692f0a5d66b0afe862 is the first bad commit > >commit 1c3c9328cd

Re: [PATCH v2 06/21] memblock: memblock_phys_alloc_try_nid(): don't panic

2019-01-25 Thread Mike Rapoport
On Fri, Jan 25, 2019 at 05:45:02PM +, Catalin Marinas wrote: > On Mon, Jan 21, 2019 at 10:03:53AM +0200, Mike Rapoport wrote: > > diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c > > index ae34e3a..2c61ea4 100644 > > --- a/arch/arm64/mm/numa.c > >

Re: [RFC PATCH] x86, numa: always initialize all possible nodes

2019-01-25 Thread Mike Rapoport
On Fri, Jan 25, 2019 at 11:40:23AM +0100, Michal Hocko wrote: > On Thu 24-01-19 19:51:44, Mike Rapoport wrote: > > On Thu, Jan 24, 2019 at 03:17:27PM +0100, Michal Hocko wrote: > > > a friendly ping for this. Does anybody see any problem with this > > > approach? > &g

Re: [RFC PATCH] x86, numa: always initialize all possible nodes

2019-01-24 Thread Mike Rapoport
e_online(self->node_id)) { > > build_zonelists(self); > > } else { > > - for_each_online_node(nid) { > > + for_each_node(nid) { > > pg_data_t *pgdat = NODE_DATA(nid); > > > > - build_zonelists(pgdat); > > + if (pgdat) > > + build_zonelists(pgdat); > > } > > > > #ifdef CONFIG_HAVE_MEMORYLESS_NODES > > @@ -6644,10 +6645,8 @@ static unsigned long __init > > find_min_pfn_for_node(int nid) > > for_each_mem_pfn_range(i, nid, _pfn, NULL, NULL) > > min_pfn = min(min_pfn, start_pfn); > > > > - if (min_pfn == ULONG_MAX) { > > - pr_warn("Could not find start_pfn for node %d\n", nid); > > + if (min_pfn == ULONG_MAX) > > return 0; > > - } > > > > return min_pfn; > > } > > @@ -6991,8 +6990,12 @@ void __init free_area_init_nodes(unsigned long > > *max_zone_pfn) > > mminit_verify_pageflags_layout(); > > setup_nr_node_ids(); > > zero_resv_unavail(); > > - for_each_online_node(nid) { > > + for_each_node(nid) { > > pg_data_t *pgdat = NODE_DATA(nid); > > + > > + if (!pgdat) > > + continue; > > + > > free_area_init_node(nid, NULL, > > find_min_pfn_for_node(nid), NULL); > > > > -- > > 2.20.1 > > > > -- > Michal Hocko > SUSE Labs > -- Sincerely yours, Mike.

Re: [PATCH v14 02/12] powerpc/irq: use memblock functions returning virtual address

2019-01-24 Thread Mike Rapoport
unctions have the advantage of also zeroing the block. > > > > Suggested-by: Mike Rapoport > > Acked-by: Mike Rapoport > > Signed-off-by: Christophe Leroy > > [...] > > > +static void *__init alloc_stack(void) > > +{ > > +

[PATCH v2 21/21] memblock: drop memblock_alloc_*_nopanic() variants

2019-01-21 Thread Mike Rapoport
As all the memblock allocation functions return NULL in case of error rather than panic(), the duplicates with _nopanic suffix can be removed. Signed-off-by: Mike Rapoport Acked-by: Greg Kroah-Hartman --- arch/arc/kernel/unwind.c | 3 +-- arch/sh/mm/init.c | 2 +- arch/x86

[PATCH v2 20/21] memblock: memblock_alloc_try_nid: don't panic

2019-01-21 Thread Mike Rapoport
As all the memblock_alloc*() users are now checking the return value and panic() in case of error, the panic() call can be removed from the core memblock allocator, namely memblock_alloc_try_nid(). Signed-off-by: Mike Rapoport --- mm/memblock.c | 15 +-- 1 file changed, 5 insertions

[PATCH v2 19/21] treewide: add checks for the return value of memblock_alloc*()

2019-01-21 Thread Mike Rapoport
the one below with manual massaging of format strings. @@ expression ptr, size, align; @@ ptr = memblock_alloc(size, align); + if (!ptr) + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", __func__, size, align); Signed-off-by: Mike Rapoport Reviewed-by: Guo Ren # c

[PATCH v2 18/21] swiotlb: add checks for the return value of memblock_alloc*()

2019-01-21 Thread Mike Rapoport
Add panic() calls if memblock_alloc() returns NULL. The panic() format duplicates the one used by memblock itself and in order to avoid explosion with long parameters list replace open coded allocation size calculations with a local variable. Signed-off-by: Mike Rapoport --- kernel/dma

[PATCH v2 17/21] init/main: add checks for the return value of memblock_alloc*()

2019-01-21 Thread Mike Rapoport
Add panic() calls if memblock_alloc() returns NULL. The panic() format duplicates the one used by memblock itself and in order to avoid explosion with long parameters list replace open coded allocation size calculations with a local variable. Signed-off-by: Mike Rapoport --- init/main.c | 26

[PATCH v2 16/21] mm/percpu: add checks for the return value of memblock_alloc*()

2019-01-21 Thread Mike Rapoport
Add panic() calls if memblock_alloc() returns NULL. The panic() format duplicates the one used by memblock itself and in order to avoid explosion with long parameters list replace open coded allocation size calculations with a local variable. Signed-off-by: Mike Rapoport --- mm/percpu.c | 73

[PATCH v2 15/21] sparc: add checks for the return value of memblock_alloc*()

2019-01-21 Thread Mike Rapoport
to accommodate the change. Signed-off-by: Mike Rapoport Acked-by: David S. Miller --- arch/sparc/kernel/prom_32.c | 2 ++ arch/sparc/kernel/setup_64.c | 6 ++ arch/sparc/kernel/smp_64.c | 12 arch/sparc/mm/init_64.c | 11 +++ arch/sparc/mm/srmmu.c| 8 5

[PATCH v2 14/21] ia64: add checks for the return value of memblock_alloc*()

2019-01-21 Thread Mike Rapoport
to accommodate the change. Signed-off-by: Mike Rapoport --- arch/ia64/kernel/mca.c | 20 ++-- arch/ia64/mm/contig.c | 8 ++-- arch/ia64/mm/discontig.c| 4 arch/ia64/mm/init.c | 38 ++ arch/ia64/mm

[PATCH v2 12/21] arch: use memblock_alloc() instead of memblock_alloc_from(size, align, 0)

2019-01-21 Thread Mike Rapoport
The last parameter of memblock_alloc_from() is the lower limit for the memory allocation. When it is 0, the call is equivalent to memblock_alloc(). Signed-off-by: Mike Rapoport Acked-by: Paul Burton # MIPS part --- arch/alpha/kernel/core_cia.c | 2 +- arch/alpha/kernel/pci_iommu.c | 4

[PATCH v2 13/21] arch: don't memset(0) memory returned by memblock_alloc()

2019-01-21 Thread Mike Rapoport
memblock_alloc() already clears the allocated memory, no point in doing it twice. Signed-off-by: Mike Rapoport Acked-by: Geert Uytterhoeven # m68k --- arch/c6x/mm/init.c | 1 - arch/h8300/mm/init.c| 1 - arch/ia64/kernel/mca.c | 2 -- arch/m68k/mm/mcfmmu.c | 1

[PATCH v2 11/21] memblock: make memblock_find_in_range_node() and choose_memblock_flags() static

2019-01-21 Thread Mike Rapoport
These functions are not used outside memblock. Make them static. Signed-off-by: Mike Rapoport --- include/linux/memblock.h | 4 mm/memblock.c| 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index

[PATCH v2 10/21] memblock: refactor internal allocation functions

2019-01-21 Thread Mike Rapoport
with exact requirement for lower bounds. The memblock_phys_alloc_nid() function is completely dropped as it is not used anywhere outside memblock and its only usage can be replaced by a call to memblock_alloc_range_nid(). Signed-off-by: Mike Rapoport --- include/linux/memblock.h | 1 - mm

[PATCH v2 09/21] memblock: drop memblock_alloc_base()

2019-01-21 Thread Mike Rapoport
The memblock_alloc_base() function tries to allocate a memory up to the limit specified by its max_addr parameter and panics if the allocation fails. Replace its usage with memblock_phys_alloc_range() and make the callers check the return value and panic in case of error. Signed-off-by: Mike

[PATCH v2 08/21] memblock: drop __memblock_alloc_base()

2019-01-21 Thread Mike Rapoport
The __memblock_alloc_base() function tries to allocate a memory up to the limit specified by its max_addr parameter. Depending on the value of this parameter, the __memblock_alloc_base() can is replaced with the appropriate memblock_phys_alloc*() variant. Signed-off-by: Mike Rapoport Acked

[PATCH v2 07/21] memblock: memblock_phys_alloc(): don't panic

2019-01-21 Thread Mike Rapoport
Make the memblock_phys_alloc() function an inline wrapper for memblock_phys_alloc_range() and update the memblock_phys_alloc() callers to check the returned value and panic in case of error. Signed-off-by: Mike Rapoport --- arch/arm/mm/init.c | 4 arch/arm64/mm/mmu.c

[PATCH v2 06/21] memblock: memblock_phys_alloc_try_nid(): don't panic

2019-01-21 Thread Mike Rapoport
with the direct call to memblock_alloc_range_nid() and update the memblock_phys_alloc_try_nid() callers to check the returned value and panic in case of error. Signed-off-by: Mike Rapoport --- arch/arm64/mm/numa.c | 4 arch/powerpc/mm/numa.c | 4 mm/memblock.c | 4 +++- 3 files changed

[PATCH v2 04/21] memblock: drop memblock_alloc_base_nid()

2019-01-21 Thread Mike Rapoport
The memblock_alloc_base_nid() is a oneliner wrapper for memblock_alloc_range_nid() without any side effect. Replace it's usage by the direct calls to memblock_alloc_range_nid(). Signed-off-by: Mike Rapoport --- include/linux/memblock.h | 3 --- mm/memblock.c| 15 --- 2

[PATCH v2 05/21] memblock: emphasize that memblock_alloc_range() returns a physical address

2019-01-21 Thread Mike Rapoport
. Signed-off-by: Mike Rapoport --- include/linux/memblock.h | 5 ++--- mm/cma.c | 10 -- mm/memblock.c| 9 + 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index f7ef313..66dfdb3 100644

[PATCH v2 03/21] memblock: replace memblock_alloc_base(ANYWHERE) with memblock_phys_alloc

2019-01-21 Thread Mike Rapoport
patch: @@ expression size, align; @@ - memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE) + memblock_phys_alloc(size, align) Signed-off-by: Mike Rapoport --- arch/arm/mm/init.c | 2 +- arch/sh/boards/mach-ap325rxa/setup.c | 2 +- arch/sh/boards/mach-ecovec24/setup.c | 4

[PATCH v2 02/21] powerpc: use memblock functions returning virtual address

2019-01-21 Thread Mike Rapoport
additional call sites ] Signed-off-by: Christophe Leroy Signed-off-by: Mike Rapoport --- arch/powerpc/kernel/dt_cpu_ftrs.c | 3 +-- arch/powerpc/kernel/irq.c | 5 - arch/powerpc/kernel/paca.c| 6 +- arch/powerpc/kernel/prom.c| 5 - arch/powerpc/kernel/setup_32

[PATCH v2 01/21] openrisc: prefer memblock APIs returning virtual address

2019-01-21 Thread Mike Rapoport
The allocation of the page tables memory in openrics uses memblock_phys_alloc() and then converts the returned physical address to virtual one. Use memblock_alloc_raw() and add a panic() if the allocation fails. Signed-off-by: Mike Rapoport --- arch/openrisc/mm/init.c | 5 - 1 file changed

[PATCH v2 00/21] Refine memblock API

2019-01-21 Thread Mike Rapoport
memblock. v2 changes: * replace some more %lu with %zu * remove panics where they are not needed in s390 and in printk * collect Acked-by and Reviewed-by. Christophe Leroy (1): powerpc: use memblock functions returning virtual address Mike Rapoport (20): openrisc: prefer memblock APIs returning

Re: [PATCH] hugetlb: allow to free gigantic pages regardless of the configuration

2019-01-17 Thread Mike Kravetz
that runtime allocation of gigantic pages is not supported, > one can still allocate boottime gigantic pages if the architecture supports > it. > > Signed-off-by: Alexandre Ghiti Thank you for doing this! Reviewed-by: Mike Kravetz > --- a/include/linux/gfp.h > +++ b/i

Re: [PATCH 19/21] treewide: add checks for the return value of memblock_alloc*()

2019-01-16 Thread Mike Rapoport
On Wed, Jan 16, 2019 at 03:27:35PM +0100, Geert Uytterhoeven wrote: > Hi Mike, > > On Wed, Jan 16, 2019 at 2:46 PM Mike Rapoport wrote: > > Add check for the return value of memblock_alloc*() functions and call > > panic() in case of error. > > The panic message repea

[PATCH 21/21] memblock: drop memblock_alloc_*_nopanic() variants

2019-01-16 Thread Mike Rapoport
As all the memblock allocation functions return NULL in case of error rather than panic(), the duplicates with _nopanic suffix can be removed. Signed-off-by: Mike Rapoport --- arch/arc/kernel/unwind.c | 3 +-- arch/sh/mm/init.c | 2 +- arch/x86/kernel/setup_percpu.c | 10

[PATCH 20/21] memblock: memblock_alloc_try_nid: don't panic

2019-01-16 Thread Mike Rapoport
As all the memblock_alloc*() users are now checking the return value and panic() in case of error, the panic() call can be removed from the core memblock allocator, namely memblock_alloc_try_nid(). Signed-off-by: Mike Rapoport --- mm/memblock.c | 15 +-- 1 file changed, 5 insertions

[PATCH 19/21] treewide: add checks for the return value of memblock_alloc*()

2019-01-16 Thread Mike Rapoport
the one below with manual massaging of format strings. @@ expression ptr, size, align; @@ ptr = memblock_alloc(size, align); + if (!ptr) + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", __func__, size, align); Signed-off-by: Mike Rapoport --- arch/alpha/kernel/

[PATCH 18/21] swiotlb: add checks for the return value of memblock_alloc*()

2019-01-16 Thread Mike Rapoport
Add panic() calls if memblock_alloc() returns NULL. The panic() format duplicates the one used by memblock itself and in order to avoid explosion with long parameters list replace open coded allocation size calculations with a local variable. Signed-off-by: Mike Rapoport --- kernel/dma

[PATCH 17/21] init/main: add checks for the return value of memblock_alloc*()

2019-01-16 Thread Mike Rapoport
Add panic() calls if memblock_alloc() returns NULL. The panic() format duplicates the one used by memblock itself and in order to avoid explosion with long parameters list replace open coded allocation size calculations with a local variable. Signed-off-by: Mike Rapoport --- init/main.c | 26

[PATCH 16/21] mm/percpu: add checks for the return value of memblock_alloc*()

2019-01-16 Thread Mike Rapoport
Add panic() calls if memblock_alloc() returns NULL. The panic() format duplicates the one used by memblock itself and in order to avoid explosion with long parameters list replace open coded allocation size calculations with a local variable. Signed-off-by: Mike Rapoport --- mm/percpu.c | 73

[PATCH 14/21] ia64: add checks for the return value of memblock_alloc*()

2019-01-16 Thread Mike Rapoport
to accommodate the change. Signed-off-by: Mike Rapoport --- arch/ia64/kernel/mca.c | 20 ++-- arch/ia64/mm/contig.c | 8 ++-- arch/ia64/mm/discontig.c| 4 arch/ia64/mm/init.c | 38 ++ arch/ia64/mm

[PATCH 15/21] sparc: add checks for the return value of memblock_alloc*()

2019-01-16 Thread Mike Rapoport
to accommodate the change. Signed-off-by: Mike Rapoport --- arch/sparc/kernel/prom_32.c | 2 ++ arch/sparc/kernel/setup_64.c | 6 ++ arch/sparc/kernel/smp_64.c | 12 arch/sparc/mm/init_64.c | 11 +++ arch/sparc/mm/srmmu.c| 8 5 files changed, 39

[PATCH 13/21] arch: don't memset(0) memory returned by memblock_alloc()

2019-01-16 Thread Mike Rapoport
memblock_alloc() already clears the allocated memory, no point in doing it twice. Signed-off-by: Mike Rapoport --- arch/c6x/mm/init.c | 1 - arch/h8300/mm/init.c| 1 - arch/ia64/kernel/mca.c | 2 -- arch/m68k/mm/mcfmmu.c | 1 - arch/microblaze/mm/init.c | 6

[PATCH 12/21] arch: use memblock_alloc() instead of memblock_alloc_from(size, align, 0)

2019-01-16 Thread Mike Rapoport
The last parameter of memblock_alloc_from() is the lower limit for the memory allocation. When it is 0, the call is equivalent to memblock_alloc(). Signed-off-by: Mike Rapoport --- arch/alpha/kernel/core_cia.c | 2 +- arch/alpha/kernel/pci_iommu.c | 4 ++-- arch/alpha/kernel/setup.c | 2

[PATCH 11/21] memblock: make memblock_find_in_range_node() and choose_memblock_flags() static

2019-01-16 Thread Mike Rapoport
These functions are not used outside memblock. Make them static. Signed-off-by: Mike Rapoport --- include/linux/memblock.h | 4 mm/memblock.c| 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index

[PATCH 10/21] memblock: refactor internal allocation functions

2019-01-16 Thread Mike Rapoport
with exact requirement for lower bounds. The memblock_phys_alloc_nid() function is completely dropped as it is not used anywhere outside memblock and its only usage can be replaced by a call to memblock_alloc_range_nid(). Signed-off-by: Mike Rapoport --- include/linux/memblock.h | 1 - mm

[PATCH 09/21] memblock: drop memblock_alloc_base()

2019-01-16 Thread Mike Rapoport
The memblock_alloc_base() function tries to allocate a memory up to the limit specified by its max_addr parameter and panics if the allocation fails. Replace its usage with memblock_phys_alloc_range() and make the callers check the return value and panic in case of error. Signed-off-by: Mike

[PATCH 08/21] memblock: drop __memblock_alloc_base()

2019-01-16 Thread Mike Rapoport
The __memblock_alloc_base() function tries to allocate a memory up to the limit specified by its max_addr parameter. Depending on the value of this parameter, the __memblock_alloc_base() can is replaced with the appropriate memblock_phys_alloc*() variant. Signed-off-by: Mike Rapoport --- arch

[PATCH 07/21] memblock: memblock_phys_alloc(): don't panic

2019-01-16 Thread Mike Rapoport
Make the memblock_phys_alloc() function an inline wrapper for memblock_phys_alloc_range() and update the memblock_phys_alloc() callers to check the returned value and panic in case of error. Signed-off-by: Mike Rapoport --- arch/arm/mm/init.c | 4 arch/arm64/mm/mmu.c

[PATCH 06/21] memblock: memblock_phys_alloc_try_nid(): don't panic

2019-01-16 Thread Mike Rapoport
with the direct call to memblock_alloc_range_nid() and update the memblock_phys_alloc_try_nid() callers to check the returned value and panic in case of error. Signed-off-by: Mike Rapoport --- arch/arm64/mm/numa.c | 4 arch/powerpc/mm/numa.c | 4 mm/memblock.c | 4 +++- 3 files changed

[PATCH 05/21] memblock: emphasize that memblock_alloc_range() returns a physical address

2019-01-16 Thread Mike Rapoport
. Signed-off-by: Mike Rapoport --- include/linux/memblock.h | 5 ++--- mm/cma.c | 10 -- mm/memblock.c| 9 + 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index f7ef313..66dfdb3 100644

[PATCH 04/21] memblock: drop memblock_alloc_base_nid()

2019-01-16 Thread Mike Rapoport
The memblock_alloc_base_nid() is a oneliner wrapper for memblock_alloc_range_nid() without any side effect. Replace it's usage by the direct calls to memblock_alloc_range_nid(). Signed-off-by: Mike Rapoport --- include/linux/memblock.h | 3 --- mm/memblock.c| 15 --- 2

[PATCH 03/21] memblock: replace memblock_alloc_base(ANYWHERE) with memblock_phys_alloc

2019-01-16 Thread Mike Rapoport
patch: @@ expression size, align; @@ - memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE) + memblock_phys_alloc(size, align) Signed-off-by: Mike Rapoport --- arch/arm/mm/init.c | 2 +- arch/sh/boards/mach-ap325rxa/setup.c | 2 +- arch/sh/boards/mach-ecovec24/setup.c | 4

[PATCH 02/21] powerpc: use memblock functions returning virtual address

2019-01-16 Thread Mike Rapoport
additional call sites ] Signed-off-by: Christophe Leroy Signed-off-by: Mike Rapoport --- arch/powerpc/kernel/dt_cpu_ftrs.c | 3 +-- arch/powerpc/kernel/irq.c | 5 - arch/powerpc/kernel/paca.c| 6 +- arch/powerpc/kernel/prom.c| 5 - arch/powerpc/kernel/setup_32

[PATCH 01/21] openrisc: prefer memblock APIs returning virtual address

2019-01-16 Thread Mike Rapoport
The allocation of the page tables memory in openrics uses memblock_phys_alloc() and then converts the returned physical address to virtual one. Use memblock_alloc_raw() and add a panic() if the allocation fails. Signed-off-by: Mike Rapoport --- arch/openrisc/mm/init.c | 5 - 1 file changed

[PATCH 00/21] Refine memblock API

2019-01-16 Thread Mike Rapoport
memblock. Christophe Leroy (1): powerpc: use memblock functions returning virtual address Mike Rapoport (20): openrisc: prefer memblock APIs returning virtual address memblock: replace memblock_alloc_base(ANYWHERE) with memblock_phys_alloc memblock: drop memblock_alloc_base_nid() memblock

Re: [PATCH V2] mm: Introduce GFP_PGTABLE

2019-01-15 Thread Mike Rapoport
pgd_cache, GFP_PGTABLE | __GFP_ACCOUNT); > } > > static inline void _pgd_free(pgd_t *pgd) > @@ -422,7 +420,8 @@ static inline void _pgd_free(pgd_t *pgd) > > static inline pgd_t *_pgd_alloc(void) > { > - return (pgd_t *)__get_free_pages(PGALLOC_GFP, PGD_ALLOCATION_ORDER); > + return (pgd_t *)__get_free_pages(GFP_PGTABLE | __GFP_ACCOUNT, > + PGD_ALLOCATION_ORDER); > } > > static inline void _pgd_free(pgd_t *pgd) > diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h > index 05e61e6..3d9cde6 100644 > --- a/include/asm-generic/pgtable.h > +++ b/include/asm-generic/pgtable.h > @@ -1186,4 +1186,6 @@ static inline bool arch_has_pfn_modify_check(void) > #define mm_pmd_folded(mm)__is_defined(__PAGETABLE_PMD_FOLDED) > #endif > > +#define GFP_PGTABLE (GFP_KERNEL | __GFP_ZERO) > + > #endif /* _ASM_GENERIC_PGTABLE_H */ > diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c > index fbdf3ac..f60a5b8 100644 > --- a/virt/kvm/arm/mmu.c > +++ b/virt/kvm/arm/mmu.c > @@ -143,7 +143,7 @@ static int mmu_topup_memory_cache(struct > kvm_mmu_memory_cache *cache, > if (cache->nobjs >= min) > return 0; > while (cache->nobjs < max) { > - page = (void *)__get_free_page(PGALLOC_GFP); > + page = (void *)__get_free_page(GFP_PGTABLE); > if (!page) > return -ENOMEM; > cache->objects[cache->nobjs++] = page; > -- > 2.7.4 > -- Sincerely yours, Mike.

Re: [PATCH v12 01/10] powerpc/irq: use memblock functions returning virtual address

2019-01-08 Thread Mike Rapoport
Hi, On Tue, Jan 08, 2019 at 01:43:09PM +, Christophe Leroy wrote: > Since only the virtual address of allocated blocks is used, > lets use functions returning directly virtual address. > > Those functions have the advantage of also zeroing the block. > > Suggested

Re: [PATCH v4 1/6] powerpc: prefer memblock APIs returning virtual address

2019-01-08 Thread Mike Rapoport
Hi, On Tue, Jan 08, 2019 at 11:02:24AM +0100, Christophe Leroy wrote: > > Le 31/12/2018 à 10:29, Mike Rapoport a écrit : > >There are a several places that allocate memory using memblock APIs that > >return a physical address, convert the returned address to the virtual > &g

Re: [PATCH v2 1/2] mm: add probe_user_read()

2019-01-07 Thread Mike Rapoport
size_t size) > +{ > + long ret; > + > + if (!access_ok(src, size)) > + return -EFAULT; > + > + pagefault_disable(); > + ret = __copy_from_user_inatomic(dst, src, size); > + pagefault_enable(); > + > + return ret ? -EFAULT : 0; > +} > +#endif > + > #ifndef user_access_begin > #define user_access_begin(ptr,len) access_ok(ptr, len) > #define user_access_end() do { } while (0) > -- > 2.13.3 > -- Sincerely yours, Mike.

[PATCH v4 6/6] arm, s390, unicore32: remove oneliner wrappers for memblock_alloc()

2018-12-31 Thread Mike Rapoport
arm, s390 and unicore32 use oneliner wrappers for memblock_alloc(). Replace their usage with direct call to memblock_alloc(). Suggested-by: Christoph Hellwig Signed-off-by: Mike Rapoport --- arch/arm/mm/mmu.c | 11 +++ arch/s390/numa/numa.c | 10 +- arch/unicore32/mm

[PATCH v4 5/6] arch: simplify several early memory allocations

2018-12-31 Thread Mike Rapoport
(): it allocates the memory in the same way as memblock_phys_alloc(), then it performs the phys_to_virt() conversion and clears the allocated memory. Replace the longer sequence with a simpler call to memblock_alloc(). Signed-off-by: Mike Rapoport --- arch/arm/mm/mmu.c | 4 +--- arch

[PATCH v4 4/6] openrisc: simplify pte_alloc_one_kernel()

2018-12-31 Thread Mike Rapoport
the allocated page is cleared using clear_page(). The code is simplified by replacing __get_free_page() with get_zeroed_page() and by replacing memblock_phys_alloc() with memblock_alloc(). Signed-off-by: Mike Rapoport Acked-by: Stafford Horne --- arch/openrisc/mm/ioremap.c | 11 --- 1

[PATCH v4 3/6] sh: prefer memblock APIs returning virtual address

2018-12-31 Thread Mike Rapoport
allocation failed, the non-local allocation attempt will be made. Signed-off-by: Mike Rapoport --- arch/sh/mm/init.c | 18 +- arch/sh/mm/numa.c | 5 ++--- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index a8e5c0e..a0fa4de

[PATCH v4 2/6] microblaze: prefer memblock API returning virtual address

2018-12-31 Thread Mike Rapoport
Rather than use the memblock_alloc_base that returns a physical address and then convert this address to the virtual one, use appropriate memblock function that returns a virtual address. Signed-off-by: Mike Rapoport Tested-by: Michal Simek --- arch/microblaze/mm/init.c | 5 +++-- 1 file

[PATCH v4 1/6] powerpc: prefer memblock APIs returning virtual address

2018-12-31 Thread Mike Rapoport
() calls are added to the call sites. Signed-off-by: Mike Rapoport --- arch/powerpc/kernel/paca.c | 16 ++-- arch/powerpc/kernel/setup_64.c | 24 ++-- arch/powerpc/mm/hash_utils_64.c| 6 +++--- arch/powerpc/mm/pgtable-book3e.c | 8

[PATCH v4 0/6] memblock: simplify several early memory allocation

2018-12-31 Thread Mike Rapoport
allocations that clear memory in alloc_paca_data() and alloc_stack() - ensure the replacement is equivalent to old API v2: * added Ack from Stafford Horne for openrisc changes * entirely drop early_alloc wrappers on arm and unicore32, as per Christoph Hellwig Mike Rapoport (6): powerpc: prefer

[PATCH v3 6/6] arm, unicore32: remove early_alloc*() wrappers

2018-12-09 Thread Mike Rapoport
On arm and unicore32i the early_alloc_aligned() and and early_alloc() are oneliner wrappers for memblock_alloc. Replace their usage with direct call to memblock_alloc. Suggested-by: Christoph Hellwig Signed-off-by: Mike Rapoport --- arch/arm/mm/mmu.c | 11 +++ arch/unicore32/mm

[PATCH v3 5/6] arch: simplify several early memory allocations

2018-12-09 Thread Mike Rapoport
(): it allocates the memory in the same way as memblock_phys_alloc(), then it performs the phys_to_virt() conversion and clears the allocated memory. Replace the longer sequence with a simpler call to memblock_alloc(). Signed-off-by: Mike Rapoport --- arch/arm/mm/mmu.c | 4 +--- arch

[PATCH v3 4/6] openrisc: simplify pte_alloc_one_kernel()

2018-12-09 Thread Mike Rapoport
the allocated page is cleared using clear_page(). The code is simplified by replacing __get_free_page() with get_zeroed_page() and by replacing memblock_phys_alloc() with memblock_alloc(). Signed-off-by: Mike Rapoport Acked-by: Stafford Horne --- arch/openrisc/mm/ioremap.c | 11 --- 1

<    5   6   7   8   9   10   11   12   13   14   >