Skip to content

RFC mm: provide one common K(x) macro

Oleksandr Natalenko linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1mm: provide one common K(x) macrodrivers/base/node.c drivers/scsi/mpt3sas/mpt3sas_base.c drivers/xen/xen-balloon.c +7 more+31 -284 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/1] mm: provide one common K(x) macro

Based on discussion with Miaohe Lin [1].

There are various places where the K(x) macro is defined, sometimes under different names, sometimes it is just open-coded. In this RFC I suggest providing a common K(x) definition that replaces existing ones.

For that, a new header, mm_tools.h, is created. I couldn't find a more appropriate place for K(x). Probably, an existing header like mm_inline.h would work as well. I tried placing this macro under mm.h, but then it conflicts with uapi/linux/keyboard.h.

In case this approach is acceptable, replacing open-coded variants would be done in a separate patch. For now, I'm using git grep -nE '<<\s?\(PAGE_SHIFT\s?\-\s?10\)' to find such places.

Also note, here I do not touch files under arch/ like arch/arc/include/asm/arcregs.h where PAGES_TO_KB() is defined, or arch/powerpc/platforms/pseries/cmm.c with PAGES2KB() as well as arch/s390/appldata/appldata_mem.c with P2K() as I'm not sure if it is appropriate to include another header file there.

The patch is based on top of next-20210831 and is compile-tested using allyesconfig.

Please let me know what you think.

Thanks.

[1] https://lore.kernel.org/linux-mm/[email protected]/

Oleksandr Natalenko (1):
mm: provide one common K(x) macro

 drivers/base/node.c                 |  2 +-
 drivers/scsi/mpt3sas/mpt3sas_base.c |  5 ++---
 drivers/xen/xen-balloon.c           | 11 +++++------
 include/linux/mm_tools.h            |  9 +++++++++
 include/trace/events/writeback.h    | 19 +++++++++----------
 kernel/debug/kdb/kdb_main.c         |  2 +-
 mm/backing-dev.c                    |  3 +--
 mm/memcontrol.c                     |  2 +-
 mm/oom_kill.c                       |  3 +--
 mm/page_alloc.c                     |  3 +--
 10 files changed, 31 insertions(+), 28 deletions(-)
 create mode 100644 include/linux/mm_tools.h
Signature · 1 line
2.33.0