Skip to content

mm: Convert memory block states (MEM_*) macros to

Israel Batista linux-debuggers linux-mm 2 versions – Applied

Status from this message: [merged mm-stable] mm-change-type-of-parameter-for-memory_notify.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 10 repliesApplied 3/3
  2. v11 patch 16 repliesSuperseded

Changes in v2 from the cover letter

- Rename the enum to make it more descriptive.
- Let the enum auto-generate the values, as the (1<<X) pattern could be misleading and they're not exposed to userspace.
- Change the type signature from unsigned long to enum memory_block_state where suitable.

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3mm: convert memory block states (MEM_*) macros to enuminclude/linux/memory.h+12 -102 repliesApplied
2/3mm: change type of state in struct memory_blockdrivers/base/memory.c include/linux/memory.h+2 -23 repliesApplied
3/3mm: change type of parameter for memory_notifydrivers/base/memory.c include/linux/memory.h+4 -44 repliesApplied

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchLorenzo StoakesDavid HildenbrandMike Rapoport (Microsoft)
SeriesA-b
1/3R-b A-b
2/3R-b A-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/3] mm: Convert memory block states (MEM_*) macros to

The MEM_* constants indicating the state of a memory block are currently defined as macros, meaning their definitions will be omitted from the debuginfo on most kernel builds. This makes it harder for debuggers to correctly map the block state at runtime, which can be quite useful when analysing errors related to memory hot plugging and unplugging with tools such as drgn.

Converting the constants to an enum would ensure the correct information is emitted by the compiler and available for the debugger, without needing to hard-code them into the debugger and track their changes.

This patch series aims to replace the current macros with a newly created enum named memory_block_state, while also taking advantage of the compile time guarantees that we get when using enums.

The first patch does the conversion of the macros to an enum, while the 2nd and 3rd patches use this enum to clean up some type declarations and make sure that only valid values are used.

---

v1 -> v2
- Rename the enum to make it more descriptive.
- Let the enum auto-generate the values, as the (1<<X) pattern could be misleading and they're not exposed to userspace.
- Change the type signature from unsigned long to enum memory_block_state where suitable.

Thanks to everyone who took their time to review the first version.

This patch series applies to commit: f30d294530d9 (mm-new)

Israel Batista (3):
mm: convert memory block states (MEM_*) macros to enum
mm: change type of state in struct memory_block
mm: change type of parameter for memory_notify

 drivers/base/memory.c  |  6 +++---
 include/linux/memory.h | 28 +++++++++++++++-------------
 2 files changed, 18 insertions(+), 16 deletions(-)
Signature · 1 line
2.51.0