Lines Matching refs:nr_pages

223 static int check_pfn_span(unsigned long pfn, unsigned long nr_pages,  in check_pfn_span()  argument
242 || !IS_ALIGNED(nr_pages, min_align)) { in check_pfn_span()
244 reason, pfn, pfn + nr_pages - 1); in check_pfn_span()
304 int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages, in __add_pages() argument
307 const unsigned long end_pfn = pfn + nr_pages; in __add_pages()
315 VM_BUG_ON(!mhp_range_allowed(PFN_PHYS(pfn), nr_pages * PAGE_SIZE, false)); in __add_pages()
322 || vmem_altmap_offset(altmap) > nr_pages) { in __add_pages()
329 err = check_pfn_span(pfn, nr_pages, "add"); in __add_pages()
462 unsigned long nr_pages) in remove_pfn_range_from_zone() argument
464 const unsigned long end_pfn = start_pfn + nr_pages; in remove_pfn_range_from_zone()
489 shrink_zone_span(zone, start_pfn, start_pfn + nr_pages); in remove_pfn_range_from_zone()
495 static void __remove_section(unsigned long pfn, unsigned long nr_pages, in __remove_section() argument
504 sparse_remove_section(ms, pfn, nr_pages, map_offset, altmap); in __remove_section()
518 void __remove_pages(unsigned long pfn, unsigned long nr_pages, in __remove_pages() argument
521 const unsigned long end_pfn = pfn + nr_pages; in __remove_pages()
527 if (check_pfn_span(pfn, nr_pages, "remove")) in __remove_pages()
591 static void online_pages_range(unsigned long start_pfn, unsigned long nr_pages) in online_pages_range() argument
593 const unsigned long end_pfn = start_pfn + nr_pages; in online_pages_range()
617 static void node_states_check_changes_online(unsigned long nr_pages, in node_states_check_changes_online() argument
641 unsigned long nr_pages) in resize_zone_range() argument
648 zone->spanned_pages = max(start_pfn + nr_pages, old_end_pfn) - zone->zone_start_pfn; in resize_zone_range()
652 unsigned long nr_pages) in resize_pgdat_range() argument
659 pgdat->node_spanned_pages = max(start_pfn + nr_pages, old_end_pfn) - pgdat->node_start_pfn; in resize_pgdat_range()
680 unsigned long nr_pages, in move_pfn_range_to_zone() argument
689 init_currently_empty_zone(zone, start_pfn, nr_pages); in move_pfn_range_to_zone()
690 resize_zone_range(zone, start_pfn, nr_pages); in move_pfn_range_to_zone()
691 resize_pgdat_range(pgdat, start_pfn, nr_pages); in move_pfn_range_to_zone()
702 if (!IS_ALIGNED(start_pfn + nr_pages, PAGES_PER_SECTION)) in move_pfn_range_to_zone()
703 section_taint_zone_device(start_pfn + nr_pages); in move_pfn_range_to_zone()
712 memmap_init_range(nr_pages, nid, zone_idx(zone), start_pfn, 0, in move_pfn_range_to_zone()
773 unsigned long nr_pages) in auto_movable_can_online_movable() argument
817 movable_pages += nr_pages; in auto_movable_can_online_movable()
827 unsigned long nr_pages) in default_kernel_zone_for_pfn() argument
835 if (zone_intersects(zone, start_pfn, nr_pages)) in default_kernel_zone_for_pfn()
895 unsigned long nr_pages) in auto_movable_zone_for_pfn() argument
910 } else if (!group || group->d.unit_pages == nr_pages) { in auto_movable_zone_for_pfn()
911 max_pages = nr_pages; in auto_movable_zone_for_pfn()
938 nr_pages = max_pages - online_pages; in auto_movable_zone_for_pfn()
939 if (!auto_movable_can_online_movable(NUMA_NO_NODE, group, nr_pages)) in auto_movable_zone_for_pfn()
944 !auto_movable_can_online_movable(nid, group, nr_pages)) in auto_movable_zone_for_pfn()
950 return default_kernel_zone_for_pfn(nid, pfn, nr_pages); in auto_movable_zone_for_pfn()
954 unsigned long nr_pages) in default_zone_for_pfn() argument
957 nr_pages); in default_zone_for_pfn()
959 bool in_kernel = zone_intersects(kernel_zone, start_pfn, nr_pages); in default_zone_for_pfn()
960 bool in_movable = zone_intersects(movable_zone, start_pfn, nr_pages); in default_zone_for_pfn()
979 unsigned long nr_pages) in zone_for_pfn_range() argument
982 return default_kernel_zone_for_pfn(nid, start_pfn, nr_pages); in zone_for_pfn_range()
988 return auto_movable_zone_for_pfn(nid, group, start_pfn, nr_pages); in zone_for_pfn_range()
990 return default_zone_for_pfn(nid, start_pfn, nr_pages); in zone_for_pfn_range()
998 long nr_pages) in adjust_present_page_count() argument
1008 zone->present_early_pages += nr_pages; in adjust_present_page_count()
1009 zone->present_pages += nr_pages; in adjust_present_page_count()
1010 zone->zone_pgdat->node_present_pages += nr_pages; in adjust_present_page_count()
1013 group->present_movable_pages += nr_pages; in adjust_present_page_count()
1015 group->present_kernel_pages += nr_pages; in adjust_present_page_count()
1018 int mhp_init_memmap_on_memory(unsigned long pfn, unsigned long nr_pages, in mhp_init_memmap_on_memory() argument
1021 unsigned long end_pfn = pfn + nr_pages; in mhp_init_memmap_on_memory()
1024 ret = kasan_add_zero_shadow(__va(PFN_PHYS(pfn)), PFN_PHYS(nr_pages)); in mhp_init_memmap_on_memory()
1028 move_pfn_range_to_zone(zone, pfn, nr_pages, NULL, MIGRATE_UNMOVABLE); in mhp_init_memmap_on_memory()
1035 if (nr_pages >= PAGES_PER_SECTION) in mhp_init_memmap_on_memory()
1041 void mhp_deinit_memmap_on_memory(unsigned long pfn, unsigned long nr_pages) in mhp_deinit_memmap_on_memory() argument
1043 unsigned long end_pfn = pfn + nr_pages; in mhp_deinit_memmap_on_memory()
1050 if (nr_pages >= PAGES_PER_SECTION) in mhp_deinit_memmap_on_memory()
1057 remove_pfn_range_from_zone(page_zone(pfn_to_page(pfn)), pfn, nr_pages); in mhp_deinit_memmap_on_memory()
1058 kasan_remove_zero_shadow(__va(PFN_PHYS(pfn)), PFN_PHYS(nr_pages)); in mhp_deinit_memmap_on_memory()
1061 int __ref online_pages(unsigned long pfn, unsigned long nr_pages, in online_pages() argument
1077 if (WARN_ON_ONCE(!nr_pages || in online_pages()
1079 !IS_ALIGNED(pfn + nr_pages, PAGES_PER_SECTION))) in online_pages()
1085 move_pfn_range_to_zone(zone, pfn, nr_pages, NULL, MIGRATE_ISOLATE); in online_pages()
1088 arg.nr_pages = nr_pages; in online_pages()
1089 node_states_check_changes_online(nr_pages, zone, &arg); in online_pages()
1101 zone->nr_isolate_pageblock += nr_pages / pageblock_nr_pages; in online_pages()
1114 online_pages_range(pfn, nr_pages); in online_pages()
1115 adjust_present_page_count(pfn_to_page(pfn), group, nr_pages); in online_pages()
1122 undo_isolate_page_range(pfn, pfn + nr_pages, MIGRATE_MOVABLE); in online_pages()
1147 (((unsigned long long) pfn + nr_pages) << PAGE_SHIFT) - 1); in online_pages()
1149 remove_pfn_range_from_zone(zone, pfn, nr_pages); in online_pages()
1790 static void node_states_check_changes_offline(unsigned long nr_pages, in node_states_check_changes_offline() argument
1810 if (zone_idx(zone) <= ZONE_NORMAL && nr_pages >= present_pages) in node_states_check_changes_offline()
1824 if (nr_pages >= present_pages) in node_states_check_changes_offline()
1838 unsigned long nr_pages, void *data) in count_system_ram_pages_cb() argument
1842 *nr_system_ram_pages += nr_pages; in count_system_ram_pages_cb()
1846 int __ref offline_pages(unsigned long start_pfn, unsigned long nr_pages, in offline_pages() argument
1849 const unsigned long end_pfn = start_pfn + nr_pages; in offline_pages()
1864 if (WARN_ON_ONCE(!nr_pages || in offline_pages()
1866 !IS_ALIGNED(start_pfn + nr_pages, PAGES_PER_SECTION))) in offline_pages()
1879 walk_system_ram_range(start_pfn, nr_pages, &system_ram_pages, in offline_pages()
1881 if (system_ram_pages != nr_pages) { in offline_pages()
1914 arg.nr_pages = nr_pages; in offline_pages()
1915 node_states_check_changes_offline(nr_pages, zone, &arg); in offline_pages()
1967 pr_debug("Offlined Pages %ld\n", nr_pages); in offline_pages()
1975 zone->nr_isolate_pageblock -= nr_pages / pageblock_nr_pages; in offline_pages()
1982 adjust_managed_page_count(pfn_to_page(start_pfn), -nr_pages); in offline_pages()
1983 adjust_present_page_count(pfn_to_page(start_pfn), group, -nr_pages); in offline_pages()
2002 remove_pfn_range_from_zone(zone, start_pfn, nr_pages); in offline_pages()