linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oleksandr Natalenko <oleksandr@natalenko.name>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Matthew Wilcox <willy@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Miaohe Lin <linmiaohe@huawei.com>,
	Michal Hocko <mhocko@kernel.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: [RFC PATCH 0/1] mm: provide one common K(x) macro
Date: Wed,  1 Sep 2021 11:21:48 +0200	[thread overview]
Message-ID: <20210901092149.994791-1-oleksandr@natalenko.name> (raw)

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/9161665.bUqNH3lxUD@natalenko.name/

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

-- 
2.33.0



             reply	other threads:[~2021-09-01  9:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  9:21 Oleksandr Natalenko [this message]
2021-09-01  9:21 ` [RFC PATCH 1/1] mm: provide one common K(x) macro Oleksandr Natalenko
2021-09-01 10:31   ` Michal Hocko
2021-09-01 10:50     ` Oleksandr Natalenko
2021-09-01 11:11       ` Michal Hocko
2021-09-02 14:52         ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210901092149.994791-1-oleksandr@natalenko.name \
    --to=oleksandr@natalenko.name \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).