Lines Matching refs:zone

414 static unsigned long find_smallest_section_pfn(int nid, struct zone *zone,  in find_smallest_section_pfn()  argument
425 if (zone != page_zone(pfn_to_page(start_pfn))) in find_smallest_section_pfn()
435 static unsigned long find_biggest_section_pfn(int nid, struct zone *zone, in find_biggest_section_pfn() argument
450 if (zone != page_zone(pfn_to_page(pfn))) in find_biggest_section_pfn()
459 static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, in shrink_zone_span() argument
463 int nid = zone_to_nid(zone); in shrink_zone_span()
465 if (zone->zone_start_pfn == start_pfn) { in shrink_zone_span()
472 pfn = find_smallest_section_pfn(nid, zone, end_pfn, in shrink_zone_span()
473 zone_end_pfn(zone)); in shrink_zone_span()
475 zone->spanned_pages = zone_end_pfn(zone) - pfn; in shrink_zone_span()
476 zone->zone_start_pfn = pfn; in shrink_zone_span()
478 zone->zone_start_pfn = 0; in shrink_zone_span()
479 zone->spanned_pages = 0; in shrink_zone_span()
481 } else if (zone_end_pfn(zone) == end_pfn) { in shrink_zone_span()
488 pfn = find_biggest_section_pfn(nid, zone, zone->zone_start_pfn, in shrink_zone_span()
491 zone->spanned_pages = pfn - zone->zone_start_pfn + 1; in shrink_zone_span()
493 zone->zone_start_pfn = 0; in shrink_zone_span()
494 zone->spanned_pages = 0; in shrink_zone_span()
502 struct zone *zone; in update_pgdat_span() local
504 for (zone = pgdat->node_zones; in update_pgdat_span()
505 zone < pgdat->node_zones + MAX_NR_ZONES; zone++) { in update_pgdat_span()
506 unsigned long end_pfn = zone_end_pfn(zone); in update_pgdat_span()
509 if (!zone->spanned_pages) in update_pgdat_span()
512 node_start_pfn = zone->zone_start_pfn; in update_pgdat_span()
519 if (zone->zone_start_pfn < node_start_pfn) in update_pgdat_span()
520 node_start_pfn = zone->zone_start_pfn; in update_pgdat_span()
527 void remove_pfn_range_from_zone(struct zone *zone, in remove_pfn_range_from_zone() argument
532 struct pglist_data *pgdat = zone->zone_pgdat; in remove_pfn_range_from_zone()
551 if (zone_is_zone_device(zone)) in remove_pfn_range_from_zone()
554 clear_zone_contiguous(zone); in remove_pfn_range_from_zone()
556 shrink_zone_span(zone, start_pfn, start_pfn + nr_pages); in remove_pfn_range_from_zone()
559 set_zone_contiguous(zone); in remove_pfn_range_from_zone()
677 struct zone *zone, struct memory_notify *arg) in node_states_check_changes_online() argument
679 int nid = zone_to_nid(zone); in node_states_check_changes_online()
686 if (zone_idx(zone) <= ZONE_NORMAL && !node_state(nid, N_NORMAL_MEMORY)) in node_states_check_changes_online()
699 static void __meminit resize_zone_range(struct zone *zone, unsigned long start_pfn, in resize_zone_range() argument
702 unsigned long old_end_pfn = zone_end_pfn(zone); in resize_zone_range()
704 if (zone_is_empty(zone) || start_pfn < zone->zone_start_pfn) in resize_zone_range()
705 zone->zone_start_pfn = start_pfn; in resize_zone_range()
707 zone->spanned_pages = max(start_pfn + nr_pages, old_end_pfn) - zone->zone_start_pfn; in resize_zone_range()
744 void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, in move_pfn_range_to_zone() argument
748 struct pglist_data *pgdat = zone->zone_pgdat; in move_pfn_range_to_zone()
751 clear_zone_contiguous(zone); in move_pfn_range_to_zone()
753 if (zone_is_empty(zone)) in move_pfn_range_to_zone()
754 init_currently_empty_zone(zone, start_pfn, nr_pages); in move_pfn_range_to_zone()
755 resize_zone_range(zone, start_pfn, nr_pages); in move_pfn_range_to_zone()
764 if (zone_is_zone_device(zone)) { in move_pfn_range_to_zone()
777 memmap_init_range(nr_pages, nid, zone_idx(zone), start_pfn, 0, in move_pfn_range_to_zone()
780 set_zone_contiguous(zone); in move_pfn_range_to_zone()
789 struct zone *zone) in auto_movable_stats_account_zone() argument
791 if (zone_idx(zone) == ZONE_MOVABLE) { in auto_movable_stats_account_zone()
792 stats->movable_pages += zone->present_pages; in auto_movable_stats_account_zone()
794 stats->kernel_early_pages += zone->present_early_pages; in auto_movable_stats_account_zone()
800 stats->movable_pages += zone->cma_pages; in auto_movable_stats_account_zone()
801 stats->kernel_early_pages -= zone->cma_pages; in auto_movable_stats_account_zone()
843 struct zone *zone; in auto_movable_can_online_movable() local
849 for_each_populated_zone(zone) in auto_movable_can_online_movable()
850 auto_movable_stats_account_zone(&stats, zone); in auto_movable_can_online_movable()
855 zone = pgdat->node_zones + i; in auto_movable_can_online_movable()
856 if (populated_zone(zone)) in auto_movable_can_online_movable()
857 auto_movable_stats_account_zone(&stats, zone); in auto_movable_can_online_movable()
892 static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn, in default_kernel_zone_for_pfn()
899 struct zone *zone = &pgdat->node_zones[zid]; in default_kernel_zone_for_pfn() local
901 if (zone_intersects(zone, start_pfn, nr_pages)) in default_kernel_zone_for_pfn()
902 return zone; in default_kernel_zone_for_pfn()
958 static struct zone *auto_movable_zone_for_pfn(int nid, in auto_movable_zone_for_pfn()
1019 static inline struct zone *default_zone_for_pfn(int nid, unsigned long start_pfn, in default_zone_for_pfn()
1022 struct zone *kernel_zone = default_kernel_zone_for_pfn(nid, start_pfn, in default_zone_for_pfn()
1024 struct zone *movable_zone = &NODE_DATA(nid)->node_zones[ZONE_MOVABLE]; in default_zone_for_pfn()
1043 struct zone *zone_for_pfn_range(int online_type, int nid, in zone_for_pfn_range()
1066 struct zone *zone = page_zone(page); in adjust_present_page_count() local
1067 const bool movable = zone_idx(zone) == ZONE_MOVABLE; in adjust_present_page_count()
1074 zone->present_early_pages += nr_pages; in adjust_present_page_count()
1075 zone->present_pages += nr_pages; in adjust_present_page_count()
1076 zone->zone_pgdat->node_present_pages += nr_pages; in adjust_present_page_count()
1085 struct zone *zone, bool mhp_off_inaccessible) in mhp_init_memmap_on_memory() argument
1103 move_pfn_range_to_zone(zone, pfn, nr_pages, NULL, MIGRATE_UNMOVABLE); in mhp_init_memmap_on_memory()
1147 struct zone *zone, struct memory_group *group) in online_pages() argument
1151 const int nid = zone_to_nid(zone); in online_pages()
1168 move_pfn_range_to_zone(zone, pfn, nr_pages, NULL, MIGRATE_ISOLATE); in online_pages()
1172 node_states_check_changes_online(nr_pages, zone, &arg); in online_pages()
1183 spin_lock_irqsave(&zone->lock, flags); in online_pages()
1184 zone->nr_isolate_pageblock += nr_pages / pageblock_nr_pages; in online_pages()
1185 spin_unlock_irqrestore(&zone->lock, flags); in online_pages()
1192 if (!populated_zone(zone)) { in online_pages()
1194 setup_zone_pageset(zone); in online_pages()
1213 shuffle_zone(zone); in online_pages()
1231 remove_pfn_range_from_zone(zone, pfn, nr_pages); in online_pages()
1877 struct zone *zone, struct memory_notify *arg) in node_states_check_changes_offline() argument
1879 struct pglist_data *pgdat = zone->zone_pgdat; in node_states_check_changes_offline()
1896 if (zone_idx(zone) <= ZONE_NORMAL && nr_pages >= present_pages) in node_states_check_changes_offline()
1897 arg->status_change_nid_normal = zone_to_nid(zone); in node_states_check_changes_offline()
1911 arg->status_change_nid = zone_to_nid(zone); in node_states_check_changes_offline()
1936 struct zone *zone, struct memory_group *group) in offline_pages() argument
1940 const int node = zone_to_nid(zone); in offline_pages()
1978 if (WARN_ON_ONCE(page_zone(pfn_to_page(start_pfn)) != zone || in offline_pages()
1979 page_zone(pfn_to_page(end_pfn - 1)) != zone)) { in offline_pages()
1989 zone_pcp_disable(zone); in offline_pages()
2004 node_states_check_changes_offline(nr_pages, zone, &arg); in offline_pages()
2068 spin_lock_irqsave(&zone->lock, flags); in offline_pages()
2069 zone->nr_isolate_pageblock -= nr_pages / pageblock_nr_pages; in offline_pages()
2070 spin_unlock_irqrestore(&zone->lock, flags); in offline_pages()
2073 zone_pcp_enable(zone); in offline_pages()
2087 if (!populated_zone(zone)) { in offline_pages()
2088 zone_pcp_reset(zone); in offline_pages()
2100 remove_pfn_range_from_zone(zone, start_pfn, nr_pages); in offline_pages()
2109 zone_pcp_enable(zone); in offline_pages()