Lines Matching full:mem
101 struct memory_block *mem = to_memory_block(dev); in memory_block_release() local
103 kfree(mem); in memory_block_release()
118 struct memory_block *mem = to_memory_block(dev); in phys_index_show() local
121 phys_index = mem->start_section_nr / sections_per_block; in phys_index_show()
142 struct memory_block *mem = to_memory_block(dev); in state_show() local
149 switch (mem->state) { in state_show()
161 return sysfs_emit(buf, "ERROR-UNKNOWN-%ld\n", mem->state); in state_show()
202 static int memory_block_change_state(struct memory_block *mem, in memory_block_change_state() argument
207 if (mem->state != from_state_req) in memory_block_change_state()
211 mem->state = MEM_GOING_OFFLINE; in memory_block_change_state()
213 ret = memory_block_action(mem->start_section_nr, to_state, in memory_block_change_state()
214 mem->online_type, mem->nid); in memory_block_change_state()
216 mem->state = ret ? from_state_req : to_state; in memory_block_change_state()
224 struct memory_block *mem = to_memory_block(dev); in memory_subsys_online() local
227 if (mem->state == MEM_ONLINE) in memory_subsys_online()
234 if (mem->online_type == MMOP_OFFLINE) in memory_subsys_online()
235 mem->online_type = MMOP_ONLINE; in memory_subsys_online()
237 ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); in memory_subsys_online()
238 mem->online_type = MMOP_OFFLINE; in memory_subsys_online()
245 struct memory_block *mem = to_memory_block(dev); in memory_subsys_offline() local
247 if (mem->state == MEM_OFFLINE) in memory_subsys_offline()
250 return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE); in memory_subsys_offline()
257 struct memory_block *mem = to_memory_block(dev); in state_store() local
271 /* mem->online_type is protected by device_hotplug_lock */ in state_store()
272 mem->online_type = online_type; in state_store()
273 ret = device_online(&mem->dev); in state_store()
276 ret = device_offline(&mem->dev); in state_store()
302 struct memory_block *mem = to_memory_block(dev); in phys_device_show() local
303 unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); in phys_device_show()
326 struct memory_block *mem = to_memory_block(dev); in valid_zones_show() local
327 unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); in valid_zones_show()
337 if (mem->state == MEM_ONLINE) { in valid_zones_show()
350 nid = mem->nid; in valid_zones_show()
504 struct memory_block *mem; in find_memory_block_by_id() local
506 mem = xa_load(&memory_blocks, block_id); in find_memory_block_by_id()
507 if (mem) in find_memory_block_by_id()
508 get_device(&mem->dev); in find_memory_block_by_id()
509 return mem; in find_memory_block_by_id()
571 struct memory_block *mem; in init_memory_block() local
574 mem = find_memory_block_by_id(block_id); in init_memory_block()
575 if (mem) { in init_memory_block()
576 put_device(&mem->dev); in init_memory_block()
579 mem = kzalloc(sizeof(*mem), GFP_KERNEL); in init_memory_block()
580 if (!mem) in init_memory_block()
583 mem->start_section_nr = block_id * sections_per_block; in init_memory_block()
584 mem->state = state; in init_memory_block()
585 mem->nid = NUMA_NO_NODE; in init_memory_block()
587 ret = register_memory(mem); in init_memory_block()
631 struct memory_block *mem; in create_memory_block_devices() local
648 mem = find_memory_block_by_id(block_id); in create_memory_block_devices()
649 if (WARN_ON_ONCE(!mem)) in create_memory_block_devices()
651 unregister_memory(mem); in create_memory_block_devices()
668 struct memory_block *mem; in remove_memory_block_devices() local
676 mem = find_memory_block_by_id(block_id); in remove_memory_block_devices()
677 if (WARN_ON_ONCE(!mem)) in remove_memory_block_devices()
679 unregister_memory_block_under_nodes(mem); in remove_memory_block_devices()
680 unregister_memory(mem); in remove_memory_block_devices()
685 bool is_memblock_offlined(struct memory_block *mem) in is_memblock_offlined() argument
687 return mem->state == MEM_OFFLINE; in is_memblock_offlined()
769 struct memory_block *mem; in walk_memory_blocks() local
777 mem = find_memory_block_by_id(block_id); in walk_memory_blocks()
778 if (!mem) in walk_memory_blocks()
781 ret = func(mem, arg); in walk_memory_blocks()
782 put_device(&mem->dev); in walk_memory_blocks()
796 struct memory_block *mem = to_memory_block(dev); in for_each_memory_block_cb() local
799 return cb_data->func(mem, cb_data->arg); in for_each_memory_block_cb()