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
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)
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
> >
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
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
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
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
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
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
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
.
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
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
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
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
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
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
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
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
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
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
;
> Signed-off-by: Alexandre Ghiti
> Acked-by: David S. Miller [sparc]
Thanks for all the updates
Reviewed-by: Mike Kravetz
--
Mike Kravetz
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
;
> Signed-off-by: Alexandre Ghiti
> Acked-by: David S. Miller [sparc]
Reviewed-by: Mike Kravetz
--
Mike Kravetz
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.
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
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
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.
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.
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
; 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.
(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
> >
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
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
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:
> >
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
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
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
> >
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
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.
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)
> > +{
> > +
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
.
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:
@@
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
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
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
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
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
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
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
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
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/
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
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
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
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
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
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
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
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
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
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
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
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
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
.
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
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:
@@
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
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
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
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
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.
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
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
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.
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
(): 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
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
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
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
() 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
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
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
(): 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
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
901 - 1000 of 1497 matches
Mail list logo