mmzone_64.h 1.1 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3
/* K8 NUMA support */
/* Copyright 2002,2003 by Andi Kleen, SuSE Labs */
/* 2.5 Version loosely based on the NUMAQ Code by Pat Gaughen. */
H
H. Peter Anvin 已提交
4 5
#ifndef _ASM_X86_MMZONE_64_H
#define _ASM_X86_MMZONE_64_H
L
Linus Torvalds 已提交
6 7


8
#ifdef CONFIG_NUMA
L
Linus Torvalds 已提交
9

J
Jiri Slaby 已提交
10
#include <linux/mmdebug.h>
L
Linus Torvalds 已提交
11 12 13 14

#include <asm/smp.h>

/* Simple perfect hash to map physical addresses to node numbers */
15 16
struct memnode {
	int shift;
17
	unsigned int mapsize;
18
	s16 *map;
19
	s16 embedded_map[64 - 8];
20
} ____cacheline_aligned; /* total size = 128 bytes */
21 22 23
extern struct memnode memnode;
#define memnode_shift memnode.shift
#define memnodemap memnode.map
24
#define memnodemapsize memnode.mapsize
L
Linus Torvalds 已提交
25 26 27

extern struct pglist_data *node_data[];

28 29 30
static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
{
	unsigned nid;
31
	VIRTUAL_BUG_ON(!memnodemap);
32 33 34 35
	nid = memnodemap[addr >> memnode_shift];
	VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
	return nid;
}
L
Linus Torvalds 已提交
36 37 38 39

#define NODE_DATA(nid)		(node_data[nid])

#define node_start_pfn(nid)	(NODE_DATA(nid)->node_start_pfn)
40
#define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn +	\
L
Linus Torvalds 已提交
41
				 NODE_DATA(nid)->node_spanned_pages)
42
#endif
H
H. Peter Anvin 已提交
43
#endif /* _ASM_X86_MMZONE_64_H */