Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp445271pxb; Wed, 1 Sep 2021 02:25:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxceMrJjZYXnMPVfCWKEB1LRS4nNCf5LhqiZZoeoI3onbwi/MOlT3i0aqLh+06SJx50eWvC X-Received: by 2002:aa7:cc08:: with SMTP id q8mr34209967edt.225.1630488328972; Wed, 01 Sep 2021 02:25:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630488328; cv=none; d=google.com; s=arc-20160816; b=xq+793m8SP2XRi7Lz5XeE2VV6RC+Pl56+ViE/3OXyop5ZW2LBsIPrySn7AAhkkhjDd prBVlFkHtAoFz0UfQf+HBCyaBU1JF7NDxYkfsZDIfIZCXqyW477p6jXXGMws/y692r7i 500hGTNTmgvs8Jc1hCcIizgGlRbxwf0L2NPOuFNpAAfh1YfqNL3qX51/zpQtX5QbpetR idfzw6FE1hm96eVfLa0PtkJzMcFanIzXjh4e96GeSibY9Qs1S0vYy+sWF4apKaC3FMSr GWXQ8IqpFjY0n08Y4ik2rcwfwTAeIoITQuInAGaNlx2aSc7Pb+xNl8n4nungbsXr3W6r vGZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TXpryOL6VSO9ITcKmr0S/fF3J09GeRCANFPAKsu45ZY=; b=eDYHlduGbMXDfetlr0eVg5usg1mk6rKAUD01bmy0aa6+4WHbiFcCSd9cyxRHgz8Mgt naAdh1Z95hl0WwCY/I8exginiyZf0woddUcKFL6/3Tu8e0CyaIwzFQ+1E5dLgP9BwHx8 blVbcnS7S7BrDthdo2JYzaiz6T8pD5d4hzR78pqqvvZTqhsAZm1ShAWgs/bJyWnj5mH7 CvcjhLlvlY+1VY7uUmFx4/eFBm5/Nj7dUbiu6z57hiIUiroSqY/NKSj0EdDV9lYDhHHU eOq4GO7KBQnDUCyAKF6PjLNwyJS7HkoWII996mDclbBfkc/fouM2qzKlndErOkm9c7qu kYUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@natalenko.name header.s=dkim-20170712 header.b=nbd9fnXV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si22464340edz.215.2021.09.01.02.25.02; Wed, 01 Sep 2021 02:25:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@natalenko.name header.s=dkim-20170712 header.b=nbd9fnXV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243631AbhIAJWu (ORCPT + 99 others); Wed, 1 Sep 2021 05:22:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243517AbhIAJWu (ORCPT ); Wed, 1 Sep 2021 05:22:50 -0400 Received: from vulcan.natalenko.name (vulcan.natalenko.name [IPv6:2001:19f0:6c00:8846:5400:ff:fe0c:dfa0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E419C061575 for ; Wed, 1 Sep 2021 02:21:52 -0700 (PDT) Received: from localhost (unknown [151.237.229.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vulcan.natalenko.name (Postfix) with ESMTPSA id 84F25BC74ED; Wed, 1 Sep 2021 11:21:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=natalenko.name; s=dkim-20170712; t=1630488110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=TXpryOL6VSO9ITcKmr0S/fF3J09GeRCANFPAKsu45ZY=; b=nbd9fnXVBJas6fBLM2u7Cl5iI6ipsyCds4K4K7l0KElUcUzkA0mjAoP/9EZq0SsqVZmJuo JrX/WVjfkCY4Ni1j+8iGiOafcTfJ2XM9FURaQ2dPlL9h64jrSZd+s4nHQ8OTI7P+D060BQ oM3zRQwK58ahSYXodFgpPMyT0wo2UO0= From: Oleksandr Natalenko To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , Matthew Wilcox , Greg Kroah-Hartman , Miaohe Lin , Michal Hocko , Mel Gorman , Stephen Rothwell Subject: [RFC PATCH 0/1] mm: provide one common K(x) macro Date: Wed, 1 Sep 2021 11:21:48 +0200 Message-Id: <20210901092149.994791-1-oleksandr@natalenko.name> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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