• Home
  • Raw
  • Download

Lines Matching refs:mem

92 	struct memory_block *mem = to_memory_block(dev);  in memory_block_release()  local
94 kfree(mem); in memory_block_release()
109 struct memory_block *mem = to_memory_block(dev); in phys_index_show() local
112 phys_index = mem->start_section_nr / sections_per_block; in phys_index_show()
125 struct memory_block *mem = to_memory_block(dev); in removable_show() local
129 if (mem->state != MEM_ONLINE) in removable_show()
133 if (!present_section_nr(mem->start_section_nr + i)) in removable_show()
135 pfn = section_nr_to_pfn(mem->start_section_nr + i); in removable_show()
149 struct memory_block *mem = to_memory_block(dev); in state_show() local
156 switch (mem->state) { in state_show()
168 mem->state); in state_show()
258 static int memory_block_change_state(struct memory_block *mem, in memory_block_change_state() argument
263 if (mem->state != from_state_req) in memory_block_change_state()
267 mem->state = MEM_GOING_OFFLINE; in memory_block_change_state()
269 ret = memory_block_action(mem->start_section_nr, to_state, in memory_block_change_state()
270 mem->online_type); in memory_block_change_state()
272 mem->state = ret ? from_state_req : to_state; in memory_block_change_state()
280 struct memory_block *mem = to_memory_block(dev); in memory_subsys_online() local
283 if (mem->state == MEM_ONLINE) in memory_subsys_online()
291 if (mem->online_type < 0) in memory_subsys_online()
292 mem->online_type = MMOP_ONLINE_KEEP; in memory_subsys_online()
294 ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); in memory_subsys_online()
297 mem->online_type = -1; in memory_subsys_online()
304 struct memory_block *mem = to_memory_block(dev); in memory_subsys_offline() local
306 if (mem->state == MEM_OFFLINE) in memory_subsys_offline()
310 if (mem->section_count != sections_per_block) in memory_subsys_offline()
313 return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE); in memory_subsys_offline()
319 struct memory_block *mem = to_memory_block(dev); in state_store() local
344 mem->online_type = online_type; in state_store()
345 ret = device_online(&mem->dev); in state_store()
348 ret = device_offline(&mem->dev); in state_store()
377 struct memory_block *mem = to_memory_block(dev); in phys_device_show() local
378 return sprintf(buf, "%d\n", mem->phys_device); in phys_device_show()
398 struct memory_block *mem = to_memory_block(dev); in valid_zones_show() local
399 unsigned long start_pfn = section_nr_to_pfn(mem->start_section_nr); in valid_zones_show()
409 if (mem->state == MEM_ONLINE) { in valid_zones_show()
422 nid = mem->nid; in valid_zones_show()
648 struct memory_block *mem; in init_memory_block() local
652 mem = find_memory_block_by_id(block_id); in init_memory_block()
653 if (mem) { in init_memory_block()
654 put_device(&mem->dev); in init_memory_block()
657 mem = kzalloc(sizeof(*mem), GFP_KERNEL); in init_memory_block()
658 if (!mem) in init_memory_block()
661 mem->start_section_nr = block_id * sections_per_block; in init_memory_block()
662 mem->state = state; in init_memory_block()
663 start_pfn = section_nr_to_pfn(mem->start_section_nr); in init_memory_block()
664 mem->phys_device = arch_get_memory_phys_device(start_pfn); in init_memory_block()
665 mem->nid = NUMA_NO_NODE; in init_memory_block()
667 ret = register_memory(mem); in init_memory_block()
669 *memory = mem; in init_memory_block()
676 struct memory_block *mem; in add_memory_block() local
686 ret = init_memory_block(&mem, base_memory_block_id(base_section_nr), in add_memory_block()
690 mem->section_count = section_count; in add_memory_block()
713 struct memory_block *mem; in create_memory_block_devices() local
723 ret = init_memory_block(&mem, block_id, MEM_OFFLINE); in create_memory_block_devices()
726 mem->section_count = sections_per_block; in create_memory_block_devices()
732 mem = find_memory_block_by_id(block_id); in create_memory_block_devices()
733 mem->section_count = 0; in create_memory_block_devices()
734 unregister_memory(mem); in create_memory_block_devices()
750 struct memory_block *mem; in remove_memory_block_devices() local
759 mem = find_memory_block_by_id(block_id); in remove_memory_block_devices()
760 if (WARN_ON_ONCE(!mem)) in remove_memory_block_devices()
762 mem->section_count = 0; in remove_memory_block_devices()
763 unregister_memory_block_under_nodes(mem); in remove_memory_block_devices()
764 unregister_memory(mem); in remove_memory_block_devices()
770 bool is_memblock_offlined(struct memory_block *mem) in is_memblock_offlined() argument
772 return mem->state == MEM_OFFLINE; in is_memblock_offlined()
856 struct memory_block *mem; in walk_memory_blocks() local
864 mem = find_memory_block_by_id(block_id); in walk_memory_blocks()
865 if (!mem) in walk_memory_blocks()
868 ret = func(mem, arg); in walk_memory_blocks()
869 put_device(&mem->dev); in walk_memory_blocks()
883 struct memory_block *mem = to_memory_block(dev); in for_each_memory_block_cb() local
886 return cb_data->func(mem, cb_data->arg); in for_each_memory_block_cb()