提交 95144c78 编写于 作者: K KAMEZAWA Hiroyuki 提交者: Linus Torvalds

[PATCH] uninline zone helpers

Helper functions for for_each_online_pgdat/for_each_zone look too big to be
inlined.  Speed of these helper macro itself is not very important.  (inner
loops are tend to do more work than this)

This patch make helper function to be out-of-lined.

	inline		out-of-line
.text   005c0680        005bf6a0

005c0680 - 005bf6a0 = FE0 = 4Kbytes.
Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 ae0f15fb
...@@ -418,20 +418,9 @@ extern struct pglist_data contig_page_data; ...@@ -418,20 +418,9 @@ extern struct pglist_data contig_page_data;
#endif /* !CONFIG_NEED_MULTIPLE_NODES */ #endif /* !CONFIG_NEED_MULTIPLE_NODES */
static inline struct pglist_data *first_online_pgdat(void) extern struct pglist_data *first_online_pgdat(void);
{ extern struct pglist_data *next_online_pgdat(struct pglist_data *pgdat);
return NODE_DATA(first_online_node); extern struct zone *next_zone(struct zone *zone);
}
static inline struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
{
int nid = next_online_node(pgdat->node_id);
if (nid == MAX_NUMNODES)
return NULL;
return NODE_DATA(nid);
}
/** /**
* for_each_pgdat - helper macro to iterate over all nodes * for_each_pgdat - helper macro to iterate over all nodes
...@@ -441,27 +430,6 @@ static inline struct pglist_data *next_online_pgdat(struct pglist_data *pgdat) ...@@ -441,27 +430,6 @@ static inline struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
for (pgdat = first_online_pgdat(); \ for (pgdat = first_online_pgdat(); \
pgdat; \ pgdat; \
pgdat = next_online_pgdat(pgdat)) pgdat = next_online_pgdat(pgdat))
/*
* next_zone - helper magic for for_each_zone()
* Thanks to William Lee Irwin III for this piece of ingenuity.
*/
static inline struct zone *next_zone(struct zone *zone)
{
pg_data_t *pgdat = zone->zone_pgdat;
if (zone < pgdat->node_zones + MAX_NR_ZONES - 1)
zone++;
else {
pgdat = next_online_pgdat(pgdat);
if (pgdat)
zone = pgdat->node_zones;
else
zone = NULL;
}
return zone;
}
/** /**
* for_each_zone - helper macro to iterate over all memory zones * for_each_zone - helper macro to iterate over all memory zones
* @zone - pointer to struct zone variable * @zone - pointer to struct zone variable
......
...@@ -10,7 +10,7 @@ mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \ ...@@ -10,7 +10,7 @@ mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \ obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
page_alloc.o page-writeback.o pdflush.o \ page_alloc.o page-writeback.o pdflush.o \
readahead.o swap.o truncate.o vmscan.o \ readahead.o swap.o truncate.o vmscan.o \
prio_tree.o util.o $(mmu-y) prio_tree.o util.o mmzone.o $(mmu-y)
obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o
obj-$(CONFIG_HUGETLBFS) += hugetlb.o obj-$(CONFIG_HUGETLBFS) += hugetlb.o
......
/*
* linux/mm/mmzone.c
*
* management codes for pgdats and zones.
*/
#include <linux/config.h>
#include <linux/stddef.h>
#include <linux/mmzone.h>
#include <linux/module.h>
struct pglist_data *first_online_pgdat(void)
{
return NODE_DATA(first_online_node);
}
EXPORT_SYMBOL(first_online_pgdat);
struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
{
int nid = next_online_node(pgdat->node_id);
if (nid == MAX_NUMNODES)
return NULL;
return NODE_DATA(nid);
}
EXPORT_SYMBOL(next_online_pgdat);
/*
* next_zone - helper magic for for_each_zone()
*/
struct zone *next_zone(struct zone *zone)
{
pg_data_t *pgdat = zone->zone_pgdat;
if (zone < pgdat->node_zones + MAX_NR_ZONES - 1)
zone++;
else {
pgdat = next_online_pgdat(pgdat);
if (pgdat)
zone = pgdat->node_zones;
else
zone = NULL;
}
return zone;
}
EXPORT_SYMBOL(next_zone);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册