• Home
  • Raw
  • Download

Lines Matching refs:mem

107 	struct memory_block *mem = to_memory_block(dev);  in memory_block_release()  local
109 kfree(mem); in memory_block_release()
124 struct memory_block *mem = to_memory_block(dev); in phys_index_show() local
127 phys_index = mem->start_section_nr / sections_per_block; in phys_index_show()
148 struct memory_block *mem = to_memory_block(dev); in state_show() local
155 switch (mem->state) { in state_show()
167 return sysfs_emit(buf, "ERROR-UNKNOWN-%ld\n", mem->state); in state_show()
181 static int memory_block_online(struct memory_block *mem) in memory_block_online() argument
183 unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); in memory_block_online()
185 unsigned long nr_vmemmap_pages = mem->nr_vmemmap_pages; in memory_block_online()
189 zone = zone_for_pfn_range(mem->online_type, mem->nid, mem->group, in memory_block_online()
207 nr_pages - nr_vmemmap_pages, zone, mem->group); in memory_block_online()
219 adjust_present_page_count(pfn_to_page(start_pfn), mem->group, in memory_block_online()
222 mem->zone = zone; in memory_block_online()
231 static int memory_block_offline(struct memory_block *mem) in memory_block_offline() argument
233 unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); in memory_block_offline()
235 unsigned long nr_vmemmap_pages = mem->nr_vmemmap_pages; in memory_block_offline()
238 if (!mem->zone) in memory_block_offline()
247 adjust_present_page_count(pfn_to_page(start_pfn), mem->group, in memory_block_offline()
251 nr_pages - nr_vmemmap_pages, mem->zone, mem->group); in memory_block_offline()
256 mem->group, nr_vmemmap_pages); in memory_block_offline()
263 mem->zone = NULL; in memory_block_offline()
274 memory_block_action(struct memory_block *mem, unsigned long action) in memory_block_action() argument
280 ret = memory_block_online(mem); in memory_block_action()
283 ret = memory_block_offline(mem); in memory_block_action()
287 "%ld\n", __func__, mem->start_section_nr, action, action); in memory_block_action()
294 static int memory_block_change_state(struct memory_block *mem, in memory_block_change_state() argument
299 if (mem->state != from_state_req) in memory_block_change_state()
303 mem->state = MEM_GOING_OFFLINE; in memory_block_change_state()
305 ret = memory_block_action(mem, to_state); in memory_block_change_state()
306 mem->state = ret ? from_state_req : to_state; in memory_block_change_state()
314 struct memory_block *mem = to_memory_block(dev); in memory_subsys_online() local
317 if (mem->state == MEM_ONLINE) in memory_subsys_online()
324 if (mem->online_type == MMOP_OFFLINE) in memory_subsys_online()
325 mem->online_type = MMOP_ONLINE; in memory_subsys_online()
327 ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); in memory_subsys_online()
328 mem->online_type = MMOP_OFFLINE; in memory_subsys_online()
335 struct memory_block *mem = to_memory_block(dev); in memory_subsys_offline() local
337 if (mem->state == MEM_OFFLINE) in memory_subsys_offline()
340 return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE); in memory_subsys_offline()
347 struct memory_block *mem = to_memory_block(dev); in state_store() local
362 mem->online_type = online_type; in state_store()
363 ret = device_online(&mem->dev); in state_store()
366 ret = device_offline(&mem->dev); in state_store()
392 struct memory_block *mem = to_memory_block(dev); in phys_device_show() local
393 unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); in phys_device_show()
417 struct memory_block *mem = to_memory_block(dev); in valid_zones_show() local
418 unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); in valid_zones_show()
420 struct memory_group *group = mem->group; in valid_zones_show()
422 int nid = mem->nid; in valid_zones_show()
429 if (mem->state == MEM_ONLINE) { in valid_zones_show()
434 default_zone = mem->zone; in valid_zones_show()
596 struct memory_block *mem; in find_memory_block_by_id() local
598 mem = xa_load(&memory_blocks, block_id); in find_memory_block_by_id()
599 if (mem) in find_memory_block_by_id()
600 get_device(&mem->dev); in find_memory_block_by_id()
601 return mem; in find_memory_block_by_id()
657 static struct zone *early_node_zone_for_memory_block(struct memory_block *mem, in early_node_zone_for_memory_block() argument
660 const unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); in early_node_zone_for_memory_block()
704 void memory_block_add_nid(struct memory_block *mem, int nid, in memory_block_add_nid() argument
707 if (context == MEMINIT_EARLY && mem->nid != nid) { in memory_block_add_nid()
717 if (mem->nid == NUMA_NO_NODE) in memory_block_add_nid()
718 mem->zone = early_node_zone_for_memory_block(mem, nid); in memory_block_add_nid()
720 mem->zone = NULL; in memory_block_add_nid()
729 mem->nid = nid; in memory_block_add_nid()
737 struct memory_block *mem; in add_memory_block() local
740 mem = find_memory_block_by_id(block_id); in add_memory_block()
741 if (mem) { in add_memory_block()
742 put_device(&mem->dev); in add_memory_block()
745 mem = kzalloc(sizeof(*mem), GFP_KERNEL); in add_memory_block()
746 if (!mem) in add_memory_block()
749 mem->start_section_nr = block_id * sections_per_block; in add_memory_block()
750 mem->state = state; in add_memory_block()
751 mem->nid = NUMA_NO_NODE; in add_memory_block()
752 mem->nr_vmemmap_pages = nr_vmemmap_pages; in add_memory_block()
753 INIT_LIST_HEAD(&mem->group_next); in add_memory_block()
763 mem->zone = early_node_zone_for_memory_block(mem, NUMA_NO_NODE); in add_memory_block()
766 ret = __add_memory_block(mem); in add_memory_block()
771 mem->group = group; in add_memory_block()
772 list_add(&mem->group_next, &group->memory_blocks); in add_memory_block()
831 struct memory_block *mem; in create_memory_block_devices() local
848 mem = find_memory_block_by_id(block_id); in create_memory_block_devices()
849 if (WARN_ON_ONCE(!mem)) in create_memory_block_devices()
851 remove_memory_block(mem); in create_memory_block_devices()
868 struct memory_block *mem; in remove_memory_block_devices() local
876 mem = find_memory_block_by_id(block_id); in remove_memory_block_devices()
877 if (WARN_ON_ONCE(!mem)) in remove_memory_block_devices()
879 unregister_memory_block_under_nodes(mem); in remove_memory_block_devices()
880 remove_memory_block(mem); in remove_memory_block_devices()
963 struct memory_block *mem; in walk_memory_blocks() local
971 mem = find_memory_block_by_id(block_id); in walk_memory_blocks()
972 if (!mem) in walk_memory_blocks()
975 ret = func(mem, arg); in walk_memory_blocks()
976 put_device(&mem->dev); in walk_memory_blocks()
990 struct memory_block *mem = to_memory_block(dev); in for_each_memory_block_cb() local
993 return cb_data->func(mem, cb_data->arg); in for_each_memory_block_cb()