Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: change type of state in struct memory_block

The state of a memory block should be restricted to values specified in
the documentation of the memory hotplug API. However, since the state
field in the memory_block struct was defined as an unsigned long, this
restriction was not enforced at compile time.

With the introduction of the enum memory_block_state, it is now possible
to incorporate the desired semantics in the field declaration and enforce
these restrictions at compile time.

[akpm@linux-foundation.org: fix whitespace, per Randy]
Link: https://lkml.kernel.org/r/20251029195617.2210700-3-linux@israelbatista.dev.br
Signed-off-by: Israel Batista <linux@israelbatista.dev.br>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Omar Sandoval <osandov@osandov.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Israel Batista and committed by
Andrew Morton
8bc7ba3d 1a4f70f6

+2 -2
+1 -1
drivers/base/memory.c
··· 198 198 break; 199 199 default: 200 200 WARN_ON(1); 201 - return sysfs_emit(buf, "ERROR-UNKNOWN-%ld\n", mem->state); 201 + return sysfs_emit(buf, "ERROR-UNKNOWN-%d\n", mem->state); 202 202 } 203 203 204 204 return sysfs_emit(buf, "%s\n", output);
+1 -1
include/linux/memory.h
··· 78 78 79 79 struct memory_block { 80 80 unsigned long start_section_nr; 81 - unsigned long state; /* serialized by the dev->lock */ 81 + enum memory_block_state state; /* serialized by the dev->lock */ 82 82 int online_type; /* for passing data to online routine */ 83 83 int nid; /* NID for this memory block */ 84 84 /*