mmzone_32.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002
  3. *
  4. */
  5. #ifndef _ASM_X86_MMZONE_32_H
  6. #define _ASM_X86_MMZONE_32_H
  7. #include <asm/smp.h>
  8. #ifdef CONFIG_NUMA
  9. extern struct pglist_data *node_data[];
  10. #define NODE_DATA(nid) (node_data[nid])
  11. #include <asm/numaq.h>
  12. extern void resume_map_numa_kva(pgd_t *pgd);
  13. #else /* !CONFIG_NUMA */
  14. static inline void resume_map_numa_kva(pgd_t *pgd) {}
  15. #endif /* CONFIG_NUMA */
  16. #ifdef CONFIG_DISCONTIGMEM
  17. /*
  18. * generic node memory support, the following assumptions apply:
  19. *
  20. * 1) memory comes in 64Mb contiguous chunks which are either present or not
  21. * 2) we will not have more than 64Gb in total
  22. *
  23. * for now assume that 64Gb is max amount of RAM for whole system
  24. * 64Gb / 4096bytes/page = 16777216 pages
  25. */
  26. #define MAX_NR_PAGES 16777216
  27. #define MAX_SECTIONS 1024
  28. #define PAGES_PER_SECTION (MAX_NR_PAGES/MAX_SECTIONS)
  29. extern s8 physnode_map[];
  30. static inline int pfn_to_nid(unsigned long pfn)
  31. {
  32. #ifdef CONFIG_NUMA
  33. return((int) physnode_map[(pfn) / PAGES_PER_SECTION]);
  34. #else
  35. return 0;
  36. #endif
  37. }
  38. static inline int pfn_valid(int pfn)
  39. {
  40. int nid = pfn_to_nid(pfn);
  41. if (nid >= 0)
  42. return (pfn < node_end_pfn(nid));
  43. return 0;
  44. }
  45. #define early_pfn_valid(pfn) pfn_valid((pfn))
  46. #endif /* CONFIG_DISCONTIGMEM */
  47. #ifdef CONFIG_NEED_MULTIPLE_NODES
  48. /* always use node 0 for bootmem on this numa platform */
  49. #define bootmem_arch_preferred_node(__bdata, size, align, goal, limit) \
  50. (NODE_DATA(0)->bdata)
  51. #endif /* CONFIG_NEED_MULTIPLE_NODES */
  52. #endif /* _ASM_X86_MMZONE_32_H */