memory.c (245f0db0de926601353776085e6f6a4c974c5615) | memory.c (31bc3858ea3ebcc3157b3f5f0e624c5962f5a7a6) |
---|---|
1/* 2 * Memory subsystem support 3 * 4 * Written by Matt Tolentino <matthew.e.tolentino@intel.com> 5 * Dave Hansen <haveblue@us.ibm.com> 6 * 7 * This file provides the necessary infrastructure to represent 8 * a SPARSEMEM-memory-model system's physical memory in /sysfs. --- 237 unchanged lines hidden (view full) --- 246 WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: " 247 "%ld\n", __func__, phys_index, action, action); 248 ret = -EINVAL; 249 } 250 251 return ret; 252} 253 | 1/* 2 * Memory subsystem support 3 * 4 * Written by Matt Tolentino <matthew.e.tolentino@intel.com> 5 * Dave Hansen <haveblue@us.ibm.com> 6 * 7 * This file provides the necessary infrastructure to represent 8 * a SPARSEMEM-memory-model system's physical memory in /sysfs. --- 237 unchanged lines hidden (view full) --- 246 WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: " 247 "%ld\n", __func__, phys_index, action, action); 248 ret = -EINVAL; 249 } 250 251 return ret; 252} 253 |
254static int memory_block_change_state(struct memory_block *mem, | 254int memory_block_change_state(struct memory_block *mem, |
255 unsigned long to_state, unsigned long from_state_req) 256{ 257 int ret = 0; 258 259 if (mem->state != from_state_req) 260 return -EINVAL; 261 262 if (to_state == MEM_OFFLINE) --- 171 unchanged lines hidden (view full) --- 434 char *buf) 435{ 436 return sprintf(buf, "%lx\n", get_memory_block_size()); 437} 438 439static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL); 440 441/* | 255 unsigned long to_state, unsigned long from_state_req) 256{ 257 int ret = 0; 258 259 if (mem->state != from_state_req) 260 return -EINVAL; 261 262 if (to_state == MEM_OFFLINE) --- 171 unchanged lines hidden (view full) --- 434 char *buf) 435{ 436 return sprintf(buf, "%lx\n", get_memory_block_size()); 437} 438 439static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL); 440 441/* |
442 * Memory auto online policy. 443 */ 444 445static ssize_t 446show_auto_online_blocks(struct device *dev, struct device_attribute *attr, 447 char *buf) 448{ 449 if (memhp_auto_online) 450 return sprintf(buf, "online\n"); 451 else 452 return sprintf(buf, "offline\n"); 453} 454 455static ssize_t 456store_auto_online_blocks(struct device *dev, struct device_attribute *attr, 457 const char *buf, size_t count) 458{ 459 if (sysfs_streq(buf, "online")) 460 memhp_auto_online = true; 461 else if (sysfs_streq(buf, "offline")) 462 memhp_auto_online = false; 463 else 464 return -EINVAL; 465 466 return count; 467} 468 469static DEVICE_ATTR(auto_online_blocks, 0644, show_auto_online_blocks, 470 store_auto_online_blocks); 471 472/* |
|
442 * Some architectures will have custom drivers to do this, and 443 * will not need to do it from userspace. The fake hot-add code 444 * as well as ppc64 will do all of their discovery in userspace 445 * and will require this interface. 446 */ 447#ifdef CONFIG_ARCH_MEMORY_PROBE 448static ssize_t 449memory_probe_store(struct device *dev, struct device_attribute *attr, --- 291 unchanged lines hidden (view full) --- 741#endif 742 743#ifdef CONFIG_MEMORY_FAILURE 744 &dev_attr_soft_offline_page.attr, 745 &dev_attr_hard_offline_page.attr, 746#endif 747 748 &dev_attr_block_size_bytes.attr, | 473 * Some architectures will have custom drivers to do this, and 474 * will not need to do it from userspace. The fake hot-add code 475 * as well as ppc64 will do all of their discovery in userspace 476 * and will require this interface. 477 */ 478#ifdef CONFIG_ARCH_MEMORY_PROBE 479static ssize_t 480memory_probe_store(struct device *dev, struct device_attribute *attr, --- 291 unchanged lines hidden (view full) --- 772#endif 773 774#ifdef CONFIG_MEMORY_FAILURE 775 &dev_attr_soft_offline_page.attr, 776 &dev_attr_hard_offline_page.attr, 777#endif 778 779 &dev_attr_block_size_bytes.attr, |
780 &dev_attr_auto_online_blocks.attr, |
|
749 NULL 750}; 751 752static struct attribute_group memory_root_attr_group = { 753 .attrs = memory_root_attrs, 754}; 755 756static const struct attribute_group *memory_root_attr_groups[] = { --- 38 unchanged lines hidden --- | 781 NULL 782}; 783 784static struct attribute_group memory_root_attr_group = { 785 .attrs = memory_root_attrs, 786}; 787 788static const struct attribute_group *memory_root_attr_groups[] = { --- 38 unchanged lines hidden --- |