From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: aneesh.kumar@linux.vnet.ibm.com, mpe@ellerman.id.au,
mikey@neuling.org, oohall@gmail.com
Subject: [RFC 3/7] powerpc/mm: Define TOP_ZONE as a constant
Date: Tue, 3 May 2016 11:59:22 +0530 [thread overview]
Message-ID: <1462256966-19321-4-git-send-email-khandual@linux.vnet.ibm.com> (raw)
In-Reply-To: <1462256966-19321-1-git-send-email-khandual@linux.vnet.ibm.com>
From: Oliver O'Halloran <oohall@gmail.com>
The zone that contains the top of the memory will be either ZONE_NORMAL
or ZONE_HIGHMEM depending on the kernel config. There are two functions
in there which require this information and both of them use an #ifdef
to set a local variable (top_zone). This is a little nuts, so lets just
make it a constant.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
arch/powerpc/mm/mem.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index ac79dbd..bcaede4 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -61,6 +61,12 @@
#define CPU_FTR_NOEXECUTE 0
#endif
+#ifdef CONFIG_HIGHMEM
+#define TOP_ZONE ZONE_HIGHMEM
+#else
+#define TOP_ZONE ZONE_NORMAL
+#endif
+
unsigned long long memory_limit;
#ifdef CONFIG_HIGHMEM
@@ -267,14 +273,9 @@ void __init limit_zone_pfn(enum zone_type zone, unsigned long pfn_limit)
*/
int dma_pfn_limit_to_zone(u64 pfn_limit)
{
- enum zone_type top_zone = ZONE_NORMAL;
int i;
-#ifdef CONFIG_HIGHMEM
- top_zone = ZONE_HIGHMEM;
-#endif
-
- for (i = top_zone; i >= 0; i--) {
+ for (i = TOP_ZONE; i >= 0; i--) {
if (max_zone_pfns[i] <= pfn_limit)
return i;
}
@@ -289,7 +290,6 @@ void __init paging_init(void)
{
unsigned long long total_ram = memblock_phys_mem_size();
phys_addr_t top_of_ram = memblock_end_of_DRAM();
- enum zone_type top_zone;
#ifdef CONFIG_PPC32
unsigned long v = __fix_to_virt(__end_of_fixed_addresses - 1);
@@ -313,13 +313,9 @@ void __init paging_init(void)
(long int)((top_of_ram - total_ram) >> 20));
#ifdef CONFIG_HIGHMEM
- top_zone = ZONE_HIGHMEM;
limit_zone_pfn(ZONE_NORMAL, lowmem_end_addr >> PAGE_SHIFT);
-#else
- top_zone = ZONE_NORMAL;
#endif
-
- limit_zone_pfn(top_zone, top_of_ram >> PAGE_SHIFT);
+ limit_zone_pfn(TOP_ZONE, top_of_ram >> PAGE_SHIFT);
zone_limits_final = true;
free_area_init_nodes(max_zone_pfns);
--
1.8.3.1
next prev parent reply other threads:[~2016-05-03 6:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-03 6:29 [RFC 0/7] Enable ZONE_DEVICE on POWER Anshuman Khandual
2016-05-03 6:29 ` [RFC 1/7] powerpc/mm: Make vmemmap_populate accommodate ZONE_DEVICE memory Anshuman Khandual
2016-05-03 8:04 ` Balbir Singh
2016-05-03 8:25 ` Anshuman Khandual
2016-05-03 6:29 ` [RFC 2/7] powerpc/mm: Enable support for ZONE_DEVICE on PPC_BOOK3S_64 platforms Anshuman Khandual
2016-05-03 6:29 ` Anshuman Khandual [this message]
2016-05-03 8:12 ` [RFC 3/7] powerpc/mm: Define TOP_ZONE as a constant Balbir Singh
2016-05-03 6:29 ` [RFC 4/7] powerpc/mm: Set MAX_ZONE_PFN to 0 for all zones beyond TOP_ZONE Anshuman Khandual
2016-05-03 8:13 ` Balbir Singh
2016-05-03 6:29 ` [RFC 5/7] mm/memremap: Export pfn_first, pfn_end, find_pagemap functions Anshuman Khandual
2016-05-03 6:29 ` [RFC 6/7] TEST: Reserve system memory to be emulated as device memory Anshuman Khandual
2016-05-03 6:29 ` [RFC 7/7] TEST: Driver to test device memory through ZONE_DEVICE Anshuman Khandual
2016-05-03 8:21 ` Balbir Singh
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=1462256966-19321-4-git-send-email-khandual@linux.vnet.ibm.com \
--to=khandual@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=oohall@gmail.com \
/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).