aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2006-03-27 04:16:02 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:44:48 -0500
commit95144c788dc01b6a0ff2c9c2222e37ffdab358b8 (patch)
tree9f7f186575bb717de39cedaf42bf02a94c11b664
parentae0f15fb91274e67d78836d38c99ec363df33073 (diff)
[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: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/linux/mmzone.h38
-rw-r--r--mm/Makefile2
-rw-r--r--mm/mmzone.c50
3 files changed, 54 insertions, 36 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 0d12c3cf1f86..b5c21122c299 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -418,20 +418,9 @@ extern struct pglist_data contig_page_data;
418 418
419#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 419#endif /* !CONFIG_NEED_MULTIPLE_NODES */
420 420
421static inline struct pglist_data *first_online_pgdat(void) 421extern struct pglist_data *first_online_pgdat(void);
422{ 422extern struct pglist_data *next_online_pgdat(struct pglist_data *pgdat);
423 return NODE_DATA(first_online_node); 423extern struct zone *next_zone(struct zone *zone);
424}
425
426static inline struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
427{
428 int nid = next_online_node(pgdat->node_id);
429
430 if (nid == MAX_NUMNODES)
431 return NULL;
432 return NODE_DATA(nid);
433}
434
435 424
436/** 425/**
437 * for_each_pgdat - helper macro to iterate over all nodes 426 * 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 for (pgdat = first_online_pgdat(); \ 430 for (pgdat = first_online_pgdat(); \
442 pgdat; \ 431 pgdat; \
443 pgdat = next_online_pgdat(pgdat)) 432 pgdat = next_online_pgdat(pgdat))
444
445/*
446 * next_zone - helper magic for for_each_zone()
447 * Thanks to William Lee Irwin III for this piece of ingenuity.
448 */
449static inline struct zone *next_zone(struct zone *zone)
450{
451 pg_data_t *pgdat = zone->zone_pgdat;
452
453 if (zone < pgdat->node_zones + MAX_NR_ZONES - 1)
454 zone++;
455 else {
456 pgdat = next_online_pgdat(pgdat);
457 if (pgdat)
458 zone = pgdat->node_zones;
459 else
460 zone = NULL;
461 }
462 return zone;
463}
464
465/** 433/**
466 * for_each_zone - helper macro to iterate over all memory zones 434 * for_each_zone - helper macro to iterate over all memory zones
467 * @zone - pointer to struct zone variable 435 * @zone - pointer to struct zone variable
diff --git a/mm/Makefile b/mm/Makefile
index f10c753dce6d..0b8f73f2ed16 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -10,7 +10,7 @@ mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
10obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \ 10obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
11 page_alloc.o page-writeback.o pdflush.o \ 11 page_alloc.o page-writeback.o pdflush.o \
12 readahead.o swap.o truncate.o vmscan.o \ 12 readahead.o swap.o truncate.o vmscan.o \
13 prio_tree.o util.o $(mmu-y) 13 prio_tree.o util.o mmzone.o $(mmu-y)
14 14
15obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o 15obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o
16obj-$(CONFIG_HUGETLBFS) += hugetlb.o 16obj-$(CONFIG_HUGETLBFS) += hugetlb.o
diff --git a/mm/mmzone.c b/mm/mmzone.c
new file mode 100644
index 000000000000..b022370e612e
--- /dev/null
+++ b/mm/mmzone.c
@@ -0,0 +1,50 @@
1/*
2 * linux/mm/mmzone.c
3 *
4 * management codes for pgdats and zones.
5 */
6
7
8#include <linux/config.h>
9#include <linux/stddef.h>
10#include <linux/mmzone.h>
11#include <linux/module.h>
12
13struct pglist_data *first_online_pgdat(void)
14{
15 return NODE_DATA(first_online_node);
16}
17
18EXPORT_SYMBOL(first_online_pgdat);
19
20struct pglist_data *next_online_pgdat(struct pglist_data *pgdat)
21{
22 int nid = next_online_node(pgdat->node_id);
23
24 if (nid == MAX_NUMNODES)
25 return NULL;
26 return NODE_DATA(nid);
27}
28EXPORT_SYMBOL(next_online_pgdat);
29
30
31/*
32 * next_zone - helper magic for for_each_zone()
33 */
34struct zone *next_zone(struct zone *zone)
35{
36 pg_data_t *pgdat = zone->zone_pgdat;
37
38 if (zone < pgdat->node_zones + MAX_NR_ZONES - 1)
39 zone++;
40 else {
41 pgdat = next_online_pgdat(pgdat);
42 if (pgdat)
43 zone = pgdat->node_zones;
44 else
45 zone = NULL;
46 }
47 return zone;
48}
49EXPORT_SYMBOL(next_zone);
50