diff options
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r-- | include/linux/mmzone.h | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 9f22090df7dd..c34f4a2c62f8 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -46,7 +46,6 @@ struct zone_padding { | |||
46 | 46 | ||
47 | struct per_cpu_pages { | 47 | struct per_cpu_pages { |
48 | int count; /* number of pages in the list */ | 48 | int count; /* number of pages in the list */ |
49 | int low; /* low watermark, refill needed */ | ||
50 | int high; /* high watermark, emptying needed */ | 49 | int high; /* high watermark, emptying needed */ |
51 | int batch; /* chunk size for buddy add/remove */ | 50 | int batch; /* chunk size for buddy add/remove */ |
52 | struct list_head list; /* the list of pages */ | 51 | struct list_head list; /* the list of pages */ |
@@ -389,6 +388,11 @@ static inline struct zone *next_zone(struct zone *zone) | |||
389 | #define for_each_zone(zone) \ | 388 | #define for_each_zone(zone) \ |
390 | for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone)) | 389 | for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone)) |
391 | 390 | ||
391 | static inline int populated_zone(struct zone *zone) | ||
392 | { | ||
393 | return (!!zone->present_pages); | ||
394 | } | ||
395 | |||
392 | static inline int is_highmem_idx(int idx) | 396 | static inline int is_highmem_idx(int idx) |
393 | { | 397 | { |
394 | return (idx == ZONE_HIGHMEM); | 398 | return (idx == ZONE_HIGHMEM); |
@@ -398,6 +402,7 @@ static inline int is_normal_idx(int idx) | |||
398 | { | 402 | { |
399 | return (idx == ZONE_NORMAL); | 403 | return (idx == ZONE_NORMAL); |
400 | } | 404 | } |
405 | |||
401 | /** | 406 | /** |
402 | * is_highmem - helper function to quickly check if a struct zone is a | 407 | * is_highmem - helper function to quickly check if a struct zone is a |
403 | * highmem zone or not. This is an attempt to keep references | 408 | * highmem zone or not. This is an attempt to keep references |
@@ -414,6 +419,16 @@ static inline int is_normal(struct zone *zone) | |||
414 | return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL; | 419 | return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL; |
415 | } | 420 | } |
416 | 421 | ||
422 | static inline int is_dma32(struct zone *zone) | ||
423 | { | ||
424 | return zone == zone->zone_pgdat->node_zones + ZONE_DMA32; | ||
425 | } | ||
426 | |||
427 | static inline int is_dma(struct zone *zone) | ||
428 | { | ||
429 | return zone == zone->zone_pgdat->node_zones + ZONE_DMA; | ||
430 | } | ||
431 | |||
417 | /* These two functions are used to setup the per zone pages min values */ | 432 | /* These two functions are used to setup the per zone pages min values */ |
418 | struct ctl_table; | 433 | struct ctl_table; |
419 | struct file; | 434 | struct file; |
@@ -435,7 +450,6 @@ extern struct pglist_data contig_page_data; | |||
435 | #define NODE_DATA(nid) (&contig_page_data) | 450 | #define NODE_DATA(nid) (&contig_page_data) |
436 | #define NODE_MEM_MAP(nid) mem_map | 451 | #define NODE_MEM_MAP(nid) mem_map |
437 | #define MAX_NODES_SHIFT 1 | 452 | #define MAX_NODES_SHIFT 1 |
438 | #define pfn_to_nid(pfn) (0) | ||
439 | 453 | ||
440 | #else /* CONFIG_NEED_MULTIPLE_NODES */ | 454 | #else /* CONFIG_NEED_MULTIPLE_NODES */ |
441 | 455 | ||
@@ -470,6 +484,10 @@ extern struct pglist_data contig_page_data; | |||
470 | #define early_pfn_to_nid(nid) (0UL) | 484 | #define early_pfn_to_nid(nid) (0UL) |
471 | #endif | 485 | #endif |
472 | 486 | ||
487 | #ifdef CONFIG_FLATMEM | ||
488 | #define pfn_to_nid(pfn) (0) | ||
489 | #endif | ||
490 | |||
473 | #define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT) | 491 | #define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT) |
474 | #define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT) | 492 | #define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT) |
475 | 493 | ||
@@ -564,11 +582,6 @@ static inline int valid_section_nr(unsigned long nr) | |||
564 | return valid_section(__nr_to_section(nr)); | 582 | return valid_section(__nr_to_section(nr)); |
565 | } | 583 | } |
566 | 584 | ||
567 | /* | ||
568 | * Given a kernel address, find the home node of the underlying memory. | ||
569 | */ | ||
570 | #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT) | ||
571 | |||
572 | static inline struct mem_section *__pfn_to_section(unsigned long pfn) | 585 | static inline struct mem_section *__pfn_to_section(unsigned long pfn) |
573 | { | 586 | { |
574 | return __nr_to_section(pfn_to_section_nr(pfn)); | 587 | return __nr_to_section(pfn_to_section_nr(pfn)); |
@@ -598,13 +611,14 @@ static inline int pfn_valid(unsigned long pfn) | |||
598 | * this restriction. | 611 | * this restriction. |
599 | */ | 612 | */ |
600 | #ifdef CONFIG_NUMA | 613 | #ifdef CONFIG_NUMA |
601 | #define pfn_to_nid early_pfn_to_nid | 614 | #define pfn_to_nid(pfn) \ |
602 | #endif | ||
603 | |||
604 | #define pfn_to_pgdat(pfn) \ | ||
605 | ({ \ | 615 | ({ \ |
606 | NODE_DATA(pfn_to_nid(pfn)); \ | 616 | unsigned long __pfn_to_nid_pfn = (pfn); \ |
617 | page_to_nid(pfn_to_page(__pfn_to_nid_pfn)); \ | ||
607 | }) | 618 | }) |
619 | #else | ||
620 | #define pfn_to_nid(pfn) (0) | ||
621 | #endif | ||
608 | 622 | ||
609 | #define early_pfn_valid(pfn) pfn_valid(pfn) | 623 | #define early_pfn_valid(pfn) pfn_valid(pfn) |
610 | void sparse_init(void); | 624 | void sparse_init(void); |
@@ -613,12 +627,6 @@ void sparse_init(void); | |||
613 | #define sparse_index_init(_sec, _nid) do {} while (0) | 627 | #define sparse_index_init(_sec, _nid) do {} while (0) |
614 | #endif /* CONFIG_SPARSEMEM */ | 628 | #endif /* CONFIG_SPARSEMEM */ |
615 | 629 | ||
616 | #ifdef CONFIG_NODES_SPAN_OTHER_NODES | ||
617 | #define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid)) | ||
618 | #else | ||
619 | #define early_pfn_in_nid(pfn, nid) (1) | ||
620 | #endif | ||
621 | |||
622 | #ifndef early_pfn_valid | 630 | #ifndef early_pfn_valid |
623 | #define early_pfn_valid(pfn) (1) | 631 | #define early_pfn_valid(pfn) (1) |
624 | #endif | 632 | #endif |