linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] arm64: mm: use macro instead of if judgement of ZONE_DMA
@ 2014-10-16  9:41 Yifan Zhang
  2014-10-16 17:10 ` Catalin Marinas
  0 siblings, 1 reply; 5+ messages in thread
From: Yifan Zhang @ 2014-10-16  9:41 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, mark.rutland, lauraa,
	ganapatrao.kulkarni, robh, leif.lindholm, Yalin.Wang,
	linux-arm-kernel, linux-kernel
  Cc: Yifan Zhang

if disable CONFIG_ZONE_DMA, ZONE_DMA becomes undefined.

Signed-off-by: Yifan Zhang <zhangyf@marvell.com>
---
 arch/arm64/mm/init.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 494297c..887ca5d 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -82,10 +82,10 @@ static void __init zone_sizes_init(unsigned long
min, unsigned long max)
    memset(zone_size, 0, sizeof(zone_size));

    /* 4GB maximum for 32-bit only capable devices */
-   if (IS_ENABLED(CONFIG_ZONE_DMA)) {
-       max_dma = PFN_DOWN(max_zone_dma_phys());
-       zone_size[ZONE_DMA] = max_dma - min;
-   }
+#ifdef CONFIG_ZONE_DMA
+   max_dma = PFN_DOWN(max_zone_dma_phys());
+   zone_size[ZONE_DMA] = max_dma - min;
+#endif
    zone_size[ZONE_NORMAL] = max - max_dma;

    memcpy(zhole_size, zone_size, sizeof(zhole_size));
@@ -97,10 +97,12 @@ static void __init zone_sizes_init(unsigned long
min, unsigned long max)
        if (start >= max)
            continue;

-       if (IS_ENABLED(CONFIG_ZONE_DMA) && start < max_dma) {
+#ifdef CONFIG_ZONE_DMA
+       if (start < max_dma) {
            unsigned long dma_end = min(end, max_dma);
            zhole_size[ZONE_DMA] -= dma_end - start;
        }
+#endif

        if (end > max_dma) {
            unsigned long normal_end = min(end, max);
--
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] arm64: mm: use macro instead of if judgement of ZONE_DMA
  2014-10-16  9:41 [PATCH v2] arm64: mm: use macro instead of if judgement of ZONE_DMA Yifan Zhang
@ 2014-10-16 17:10 ` Catalin Marinas
  2014-10-17  3:08   ` Yifan Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Catalin Marinas @ 2014-10-16 17:10 UTC (permalink / raw)
  To: Yifan Zhang
  Cc: Will Deacon, Mark Rutland, lauraa, ganapatrao.kulkarni, robh,
	leif.lindholm, Yalin.Wang, linux-arm-kernel, linux-kernel,
	Yifan Zhang

On Thu, Oct 16, 2014 at 10:41:01AM +0100, Yifan Zhang wrote:
> if disable CONFIG_ZONE_DMA, ZONE_DMA becomes undefined.

I agree that this is the case but can you explain why you need to
disable ZONE_DMA? It currently is def_bool y, so it cannot be disabled
unless you hack the Kconfig.

-- 
Catalin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] arm64: mm: use macro instead of if judgement of ZONE_DMA
  2014-10-16 17:10 ` Catalin Marinas
@ 2014-10-17  3:08   ` Yifan Zhang
  2014-10-17 13:28     ` Catalin Marinas
  0 siblings, 1 reply; 5+ messages in thread
From: Yifan Zhang @ 2014-10-17  3:08 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Will Deacon, Mark Rutland, lauraa, ganapatrao.kulkarni, robh,
	leif.lindholm, Yalin.Wang, linux-arm-kernel, linux-kernel,
	Yifan Zhang

Hi Catalin,

I found In current arm64 code, there is no normal zone, only DMA zone.

Number of blocks type     Unmovable  Reclaimable      Movable
Reserve          CMA      Isolate

Node 0, zone    DMA          142           12           69
1           28            0


When zone_sizes_init, zone_size[ZONE_NORMAL] is initialized to 0. (it
is 3.10, I didn't try the latest code base)

static void __init zone_sizes_init(unsigned long min, unsigned long max)
{
    struct memblock_region *reg;
    unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
    unsigned long max_dma = min;

    memset(zone_size, 0, sizeof(zone_size));

#ifdef CONFIG_ZONE_DMA
    /* 4GB maximum for 32-bit only capable devices */
    unsigned long max_dma_phys =
        (unsigned long)(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1);
    max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT));
    zone_size[ZONE_DMA] = max_dma - min;
#endif
    zone_size[ZONE_NORMAL] = max - max_dma;


Then I just tried to enable ZONE_NORMAL in our platform, and found
this compiling error.

Is this ZONE_DMA cover full memory and ZONE_NORMAL = 0 strategy on
purpose ? We will not use ZONE_NORMAL on arm64 ?



On Fri, Oct 17, 2014 at 1:10 AM, Catalin Marinas
<catalin.marinas@arm.com> wrote:
> On Thu, Oct 16, 2014 at 10:41:01AM +0100, Yifan Zhang wrote:
>> if disable CONFIG_ZONE_DMA, ZONE_DMA becomes undefined.
>
> I agree that this is the case but can you explain why you need to
> disable ZONE_DMA? It currently is def_bool y, so it cannot be disabled
> unless you hack the Kconfig.
>
> --
> Catalin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] arm64: mm: use macro instead of if judgement of ZONE_DMA
  2014-10-17  3:08   ` Yifan Zhang
@ 2014-10-17 13:28     ` Catalin Marinas
  2014-10-20  1:58       ` Yifan Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Catalin Marinas @ 2014-10-17 13:28 UTC (permalink / raw)
  To: Yifan Zhang
  Cc: Will Deacon, Mark Rutland, lauraa, ganapatrao.kulkarni, robh,
	leif.lindholm, Yalin.Wang, linux-arm-kernel, linux-kernel,
	Yifan Zhang

On Fri, Oct 17, 2014 at 04:08:43AM +0100, Yifan Zhang wrote:
> I found In current arm64 code, there is no normal zone, only DMA zone.
> 
> Number of blocks type     Unmovable  Reclaimable      Movable
> Reserve          CMA      Isolate
> 
> Node 0, zone    DMA          142           12           69
> 1           28            0
> 
> When zone_sizes_init, zone_size[ZONE_NORMAL] is initialized to 0. (it
> is 3.10, I didn't try the latest code base)
[...]
> Is this ZONE_DMA cover full memory and ZONE_NORMAL = 0 strategy on
> purpose ? We will not use ZONE_NORMAL on arm64 ?

The normal zone is still there, only that it doesn't have any pages. The
page allocator falls back to the DMA zone, so you would not see any
problems with normal page allocation.

Are you trying to solve anything (performance?) or just what the kernel
shows as part of the normal zone?

-- 
Catalin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] arm64: mm: use macro instead of if judgement of ZONE_DMA
  2014-10-17 13:28     ` Catalin Marinas
@ 2014-10-20  1:58       ` Yifan Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Yifan Zhang @ 2014-10-20  1:58 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Will Deacon, Mark Rutland, lauraa, ganapatrao.kulkarni, robh,
	leif.lindholm, Yalin.Wang, linux-arm-kernel, linux-kernel,
	Yifan Zhang

Catalin,

No, we don't have any issues w/ current configuration. I'm just
confused why normal zone is empty in arm64 when I dumped zone info. If
it is on purpose, then I'm fine.

THX all for feedback!

BR,
Yifan

On Fri, Oct 17, 2014 at 9:28 PM, Catalin Marinas
<catalin.marinas@arm.com> wrote:
> On Fri, Oct 17, 2014 at 04:08:43AM +0100, Yifan Zhang wrote:
>> I found In current arm64 code, there is no normal zone, only DMA zone.
>>
>> Number of blocks type     Unmovable  Reclaimable      Movable
>> Reserve          CMA      Isolate
>>
>> Node 0, zone    DMA          142           12           69
>> 1           28            0
>>
>> When zone_sizes_init, zone_size[ZONE_NORMAL] is initialized to 0. (it
>> is 3.10, I didn't try the latest code base)
> [...]
>> Is this ZONE_DMA cover full memory and ZONE_NORMAL = 0 strategy on
>> purpose ? We will not use ZONE_NORMAL on arm64 ?
>
> The normal zone is still there, only that it doesn't have any pages. The
> page allocator falls back to the DMA zone, so you would not see any
> problems with normal page allocation.
>
> Are you trying to solve anything (performance?) or just what the kernel
> shows as part of the normal zone?
>
> --
> Catalin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-20  1:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16  9:41 [PATCH v2] arm64: mm: use macro instead of if judgement of ZONE_DMA Yifan Zhang
2014-10-16 17:10 ` Catalin Marinas
2014-10-17  3:08   ` Yifan Zhang
2014-10-17 13:28     ` Catalin Marinas
2014-10-20  1:58       ` Yifan Zhang

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).