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()
304 struct memory_block *mem = to_memory_block(dev); in phys_device_show() local
306 return sysfs_emit(buf, "%d\n", mem->phys_device); 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()
508 struct memory_block *mem; in find_memory_block_by_id() local
510 mem = xa_load(&memory_blocks, block_id); in find_memory_block_by_id()
511 if (mem) in find_memory_block_by_id()
512 get_device(&mem->dev); in find_memory_block_by_id()
513 return mem; in find_memory_block_by_id()
576 struct memory_block *mem; in init_memory_block() local
580 mem = find_memory_block_by_id(block_id); in init_memory_block()
581 if (mem) { in init_memory_block()
582 put_device(&mem->dev); in init_memory_block()
585 mem = kzalloc(sizeof(*mem), GFP_KERNEL); in init_memory_block()
586 if (!mem) in init_memory_block()
589 mem->start_section_nr = block_id * sections_per_block; in init_memory_block()
590 mem->state = state; in init_memory_block()
591 start_pfn = section_nr_to_pfn(mem->start_section_nr); in init_memory_block()
592 mem->phys_device = arch_get_memory_phys_device(start_pfn); in init_memory_block()
593 mem->nid = NUMA_NO_NODE; in init_memory_block()
595 ret = register_memory(mem); in init_memory_block()
639 struct memory_block *mem; in create_memory_block_devices() local
656 mem = find_memory_block_by_id(block_id); in create_memory_block_devices()
657 if (WARN_ON_ONCE(!mem)) in create_memory_block_devices()
659 unregister_memory(mem); in create_memory_block_devices()
676 struct memory_block *mem; in remove_memory_block_devices() local
684 mem = find_memory_block_by_id(block_id); in remove_memory_block_devices()
685 if (WARN_ON_ONCE(!mem)) in remove_memory_block_devices()
687 unregister_memory_block_under_nodes(mem); in remove_memory_block_devices()
688 unregister_memory(mem); in remove_memory_block_devices()
693 bool is_memblock_offlined(struct memory_block *mem) in is_memblock_offlined() argument
695 return mem->state == MEM_OFFLINE; in is_memblock_offlined()
777 struct memory_block *mem; in walk_memory_blocks() local
785 mem = find_memory_block_by_id(block_id); in walk_memory_blocks()
786 if (!mem) in walk_memory_blocks()
789 ret = func(mem, arg); in walk_memory_blocks()
790 put_device(&mem->dev); in walk_memory_blocks()
804 struct memory_block *mem = to_memory_block(dev); in for_each_memory_block_cb() local
807 return cb_data->func(mem, cb_data->arg); in for_each_memory_block_cb()