From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Laura Abbott <labbott@redhat.com>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>,
Grygorii Strashko <grygorii.strashko@ti.com>,
linux-arm-kernel@lists.infradead.org, lilja.magnus@gmail.com,
festevam@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 2/2] arm: Adjust memory boundaries after reservations
Date: Fri, 6 Jan 2017 00:41:37 +0000 [thread overview]
Message-ID: <20170106004137.GW14217@n2100.armlinux.org.uk> (raw)
In-Reply-To: <1483657274-11346-3-git-send-email-labbott@redhat.com>
Only comments are to do with the comments...
On Thu, Jan 05, 2017 at 03:01:14PM -0800, Laura Abbott wrote:
>
> adjust_lowmem_bounds is responsible for setting up the boundary for
> lowmem/hihgmme. This needs to be setup before memblock reservations can
highmem
> occur. At the time memblock reservations can occur, memory can also be
> removed from the system. The lowmem/highmem boundary and end of memory
> may be affected by this but it is currently not recalculated. On some
> systems this may be harmless, on o thers this may result in incorrect
others
> ranges being passed to the main memory allocator. Correct this by
> recalculating the lowmem/highmem boundary after all reservations have
> been made.
>
> Signed-off-by: Laura Abbott <labbott@redhat.com>
> ---
> v2: Rebased for changes in sanity_check_meminfo cleanup
> ---
> arch/arm/kernel/setup.c | 8 ++++++++
> arch/arm/mm/mmu.c | 9 ++++++---
> 2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index 8a8051c..4625115 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -1093,8 +1093,16 @@ void __init setup_arch(char **cmdline_p)
> setup_dma_zone(mdesc);
> xen_early_init();
> efi_init();
> + /*
> + * Make sure the calcualtion for lowmem/highmem is set appropriately
calculation
> + * before reserving/allocating any mmeory
> + */
> adjust_lowmem_bounds();
> arm_memblock_init(mdesc);
> + /*
> + * Memory may have been removed so recalculate the bounds.
> + */
Single line comments should be... /* blah */
> + adjust_lowmem_bounds();
>
> early_ioremap_reset();
>
> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
> index ce5123b..7ca6910 100644
> --- a/arch/arm/mm/mmu.c
> +++ b/arch/arm/mm/mmu.c
> @@ -1157,6 +1157,7 @@ void __init adjust_lowmem_bounds(void)
> phys_addr_t memblock_limit = 0;
> u64 vmalloc_limit;
> struct memblock_region *reg;
> + phys_addr_t lowmem_limit = 0;
>
> /*
> * Let's use our own (unoptimized) equivalent of __pa() that is
> @@ -1173,14 +1174,14 @@ void __init adjust_lowmem_bounds(void)
>
>
> if (reg->base < vmalloc_limit) {
> - if (block_end > arm_lowmem_limit)
> + if (block_end > lowmem_limit)
> /*
> * Compare as u64 to ensure vmalloc_limit does
> * not get truncated. block_end should always
> * fit in phys_addr_t so there should be no
> * issue with assignment.
> */
> - arm_lowmem_limit = min_t(u64,
> + lowmem_limit = min_t(u64,
> vmalloc_limit,
> block_end);
>
> @@ -1201,12 +1202,14 @@ void __init adjust_lowmem_bounds(void)
> if (!IS_ALIGNED(block_start, PMD_SIZE))
> memblock_limit = block_start;
> else if (!IS_ALIGNED(block_end, PMD_SIZE))
> - memblock_limit = arm_lowmem_limit;
> + memblock_limit = lowmem_limit;
> }
>
> }
> }
>
> + arm_lowmem_limit = lowmem_limit;
> +
> high_memory = __va(arm_lowmem_limit - 1) + 1;
>
> /*
> --
> 2.7.4
>
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2017-01-06 0:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 23:01 [PATCHv2 0/2] Memblock cleanup plus memory removal fix Laura Abbott
2017-01-05 23:01 ` [PATCHv2 1/2] arm: Cleanup sanity_check_meminfo Laura Abbott
2017-01-06 4:17 ` Nicolas Pitre
2017-01-10 1:07 ` Laura Abbott
2017-01-05 23:01 ` [PATCHv2 2/2] arm: Adjust memory boundaries after reservations Laura Abbott
2017-01-06 0:41 ` Russell King - ARM Linux [this message]
2017-01-06 9:46 ` [PATCHv2 0/2] Memblock cleanup plus memory removal fix Magnus Lilja
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170106004137.GW14217@n2100.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=festevam@gmail.com \
--cc=grygorii.strashko@ti.com \
--cc=labbott@redhat.com \
--cc=lilja.magnus@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.pitre@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).