2005-11-17 14:00:10

by Con Kolivas

[permalink] [raw]
Subject: [PATCH] mm: is_dma_zone

Add a simple is_dma helper function to remain consistent with respect to
avoiding the use of ZONE_* outside the headers.

Signed-off-by: Con Kolivas <[email protected]>

include/linux/mmzone.h | 5 +++++
mm/swap_prefetch.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)

---

Index: linux-2.6.14-mm2/include/linux/mmzone.h
===================================================================
--- linux-2.6.14-mm2.orig/include/linux/mmzone.h
+++ linux-2.6.14-mm2/include/linux/mmzone.h
@@ -425,6 +425,11 @@ static inline int is_normal(struct zone
return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
}

+static inline int is_dma(struct zone *zone)
+{
+ return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
+}
+
/* These two functions are used to setup the per zone pages min values */
struct ctl_table;
struct file;
Index: linux-2.6.14-mm2/mm/swap_prefetch.c
===================================================================
--- linux-2.6.14-mm2.orig/mm/swap_prefetch.c
+++ linux-2.6.14-mm2/mm/swap_prefetch.c
@@ -180,7 +180,7 @@ static struct page *prefetch_get_page(vo
continue;

/* We don't prefetch into DMA */
- if (zone_idx(z) == ZONE_DMA)
+ if (is_dma(z))
continue;

free = z->free_pages;


2005-11-17 14:15:47

by Dave Hansen

[permalink] [raw]
Subject: Re: [PATCH] mm: is_dma_zone

On Fri, 2005-11-18 at 00:59 +1100, Con Kolivas wrote:
> +static inline int is_dma(struct zone *zone)
> +{
> + return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
> +}

Any reason you can't just use 'zone_idx(z) == ZONE_DMA' here, just like
the code you replaced?

-- Dave

2005-11-17 14:19:22

by Con Kolivas

[permalink] [raw]
Subject: Re: [PATCH] mm: is_dma_zone

On Fri, 18 Nov 2005 01:15, Dave Hansen wrote:
> On Fri, 2005-11-18 at 00:59 +1100, Con Kolivas wrote:
> > +static inline int is_dma(struct zone *zone)
> > +{
> > + return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
> > +}
>
> Any reason you can't just use 'zone_idx(z) == ZONE_DMA' here, just like
> the code you replaced?

I was just following the style of the is_highmem and is_normal immediately
preceeding this. No strong reason otherwise.

Cheers,
Con