From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rik van Riel <riel@redhat.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Mel Gorman <mgorman@suse.de>,
Laura Abbott <lauraa@codeaurora.org>,
Minchan Kim <minchan@kernel.org>,
Heesub Shin <heesub.shin@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Michal Nazarewicz <mina86@mina86.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Hui Zhu <zhuhui@xiaomi.com>, Gioh Kim <gioh.kim@lge.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Ritesh Harjani <ritesh.list@gmail.com>,
Vlastimil Babka <vbabka@suse.cz>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: [RFC 10/16] mm/highmem: remove is_highmem_idx()
Date: Thu, 12 Feb 2015 16:32:14 +0900 [thread overview]
Message-ID: <1423726340-4084-11-git-send-email-iamjoonsoo.kim@lge.com> (raw)
In-Reply-To: <1423726340-4084-1-git-send-email-iamjoonsoo.kim@lge.com>
We can use is_highmem() on every callsites of is_highmem_idx() so
is_highmem_idx() isn't really needed. And, if we introduce a new zone
for CMA, we need to modify it to adapt for new zone, so it's
inconvenient. Therefore, this patch remove it before introducing
a new zone.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
include/linux/mmzone.h | 18 ++++--------------
lib/show_mem.c | 2 +-
mm/page_alloc.c | 6 +++---
mm/vmscan.c | 2 +-
4 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ffe66e3..90237f2 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -854,16 +854,6 @@ static inline int zone_movable_is_highmem(void)
#endif
}
-static inline int is_highmem_idx(enum zone_type idx)
-{
-#ifdef CONFIG_HIGHMEM
- return (idx == ZONE_HIGHMEM ||
- (idx == ZONE_MOVABLE && zone_movable_is_highmem()));
-#else
- return 0;
-#endif
-}
-
/**
* is_highmem - helper function to quickly check if a struct zone is a
* highmem zone or not. This is an attempt to keep references
@@ -873,10 +863,10 @@ static inline int is_highmem_idx(enum zone_type idx)
static inline int is_highmem(struct zone *zone)
{
#ifdef CONFIG_HIGHMEM
- int zone_off = (char *)zone - (char *)zone->zone_pgdat->node_zones;
- return zone_off == ZONE_HIGHMEM * sizeof(*zone) ||
- (zone_off == ZONE_MOVABLE * sizeof(*zone) &&
- zone_movable_is_highmem());
+ int idx = zone_idx(zone);
+
+ return (idx == ZONE_HIGHMEM ||
+ (idx == ZONE_MOVABLE && zone_movable_is_highmem()));
#else
return 0;
#endif
diff --git a/lib/show_mem.c b/lib/show_mem.c
index 5e25627..f336c5b1 100644
--- a/lib/show_mem.c
+++ b/lib/show_mem.c
@@ -30,7 +30,7 @@ void show_mem(unsigned int filter)
total += zone->present_pages;
reserved += zone->present_pages - zone->managed_pages;
- if (is_highmem_idx(zoneid))
+ if (is_highmem(zone))
highmem += zone->present_pages;
}
pgdat_resize_unlock(pgdat, &flags);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7733663..416e036 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4151,7 +4151,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
INIT_LIST_HEAD(&page->lru);
#ifdef WANT_PAGE_VIRTUAL
/* The shift won't overflow because ZONE_NORMAL is below 4G. */
- if (!is_highmem_idx(zone))
+ if (!is_highmem(z))
set_page_address(page, __va(pfn << PAGE_SHIFT));
#endif
}
@@ -4881,7 +4881,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
zone_names[0], dma_reserve);
}
- if (!is_highmem_idx(j))
+ if (!is_highmem(zone))
nr_kernel_pages += freesize;
/* Charge for highmem memmap if there are enough kernel pages */
else if (nr_kernel_pages > memmap_pages * 2)
@@ -4895,7 +4895,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
* when the bootmem allocator frees pages into the buddy system.
* And all highmem pages will be managed by the buddy system.
*/
- zone->managed_pages = is_highmem_idx(j) ? realsize : freesize;
+ zone->managed_pages = is_highmem(zone) ? realsize : freesize;
#ifdef CONFIG_NUMA
zone->node = nid;
zone->min_unmapped_pages = (freesize*sysctl_min_unmapped_ratio)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index dcb4707..30c34dc 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3074,7 +3074,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
* has a highmem zone, force kswapd to reclaim from
* it to relieve lowmem pressure.
*/
- if (buffer_heads_over_limit && is_highmem_idx(i)) {
+ if (buffer_heads_over_limit && is_highmem(zone)) {
end_zone = i;
break;
}
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-02-12 7:30 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 7:32 [RFC 00/16] Introduce ZONE_CMA Joonsoo Kim
2015-02-12 7:32 ` [RFC 01/16] mm/page_alloc: correct highmem memory statistics Joonsoo Kim
2015-02-12 7:32 ` [RFC 02/16] mm/writeback: correct dirty page calculation for highmem Joonsoo Kim
2015-02-12 7:32 ` [RFC 03/16] mm/highmem: make nr_free_highpages() handles all highmem zones by itself Joonsoo Kim
2015-02-12 7:32 ` [RFC 04/16] mm/vmstat: make node_page_state() handles all " Joonsoo Kim
2015-02-12 7:32 ` [RFC 05/16] mm/vmstat: watch out zone range overlap Joonsoo Kim
2015-02-12 7:32 ` [RFC 06/16] mm/page_alloc: " Joonsoo Kim
2015-02-12 7:32 ` [RFC 07/16] mm/page_isolation: " Joonsoo Kim
2015-02-13 6:40 ` Gioh Kim
2015-02-17 5:24 ` Joonsoo Kim
2015-02-12 7:32 ` [RFC 08/16] power: " Joonsoo Kim
2015-02-12 7:32 ` [RFC 09/16] mm/cma: introduce cma_total_pages() for future use Joonsoo Kim
2015-02-12 7:32 ` Joonsoo Kim [this message]
2015-02-12 7:32 ` [RFC 11/16] mm/page_alloc: clean-up free_area_init_core() Joonsoo Kim
2015-02-12 7:32 ` [RFC 12/16] mm/cma: introduce new zone, ZONE_CMA Joonsoo Kim
2015-02-12 7:32 ` [RFC 13/16] mm/cma: populate ZONE_CMA and use this zone when GFP_HIGHUSERMOVABLE Joonsoo Kim
2015-02-14 5:02 ` Gioh Kim
2015-02-17 5:25 ` Joonsoo Kim
2015-03-03 8:28 ` Aneesh Kumar K.V
2015-03-06 7:13 ` Joonsoo Kim
2015-03-18 10:03 ` Aneesh Kumar K.V
2015-03-20 4:28 ` Joonsoo Kim
2015-02-12 7:32 ` [RFC 14/16] mm/cma: print stealed page count Joonsoo Kim
2015-02-12 7:32 ` [RFC 15/16] mm/cma: remove ALLOC_CMA Joonsoo Kim
2015-02-12 7:32 ` [RFC 16/16] mm/cma: remove MIGRATE_CMA Joonsoo Kim
2015-03-05 16:53 ` [RFC 00/16] Introduce ZONE_CMA Vlastimil Babka
2015-03-05 17:48 ` Vlastimil Babka
2015-03-06 7:26 ` Joonsoo Kim
2015-03-17 9:46 ` Aneesh Kumar K.V
2015-03-18 6:01 ` Joonsoo Kim
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=1423726340-4084-11-git-send-email-iamjoonsoo.kim@lge.com \
--to=iamjoonsoo.kim@lge.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=b.zolnierkie@samsung.com \
--cc=gioh.kim@lge.com \
--cc=hannes@cmpxchg.org \
--cc=heesub.shin@samsung.com \
--cc=lauraa@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=mgorman@suse.de \
--cc=mina86@mina86.com \
--cc=minchan@kernel.org \
--cc=riel@redhat.com \
--cc=ritesh.list@gmail.com \
--cc=vbabka@suse.cz \
--cc=zhuhui@xiaomi.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