From patchwork Wed Mar 15 11:31:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 13175674 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C35AC7618A for ; Wed, 15 Mar 2023 11:31:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FB406B0080; Wed, 15 Mar 2023 07:31:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4AB356B0081; Wed, 15 Mar 2023 07:31:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2FE1A6B0082; Wed, 15 Mar 2023 07:31:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1FA0B6B0080 for ; Wed, 15 Mar 2023 07:31:49 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EC9971610CE for ; Wed, 15 Mar 2023 11:31:48 +0000 (UTC) X-FDA: 80570917896.20.5E3F1B9 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf15.hostedemail.com (Postfix) with ESMTP id E396DA0020 for ; Wed, 15 Mar 2023 11:31:46 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=euwIkKwT; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf15.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678879907; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=VW3gFPpsCm8N47wABgitY+eyUKPIm1zewamHhleTKiU=; b=0nu9OZ2xphHyj8Ohzmgiv+TWha5NuuY3GX5nvB7pIfwIUZIH5LBPdlPj7or9G2HY92hY4L KV0j8oKxY7QtH48FmAQqHPqK+kg44LC5QiuMJ1m4LDHeScjZzeyyYgvM5p7wLnTrkf+Xpe WQj/w32/HiX2a22jUPXjM0LJH1pN0Tc= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=euwIkKwT; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf15.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678879907; a=rsa-sha256; cv=none; b=YIj0AqDGOGD6q6x9QE9B1QC0acXSqwEU/re7XA3dW1TkcaDdPgJJwYiBtjwC7vLLdSu6zy QApbZs+JwSos/mA7RG19rU9PhbG/mD/pbFtm9sRFVQqmmUpte6KgJNt3unMtLJ5S/WT7kk DYPDpb3DXcE/rwn130rnU0F75Z9m9Ww= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678879907; x=1710415907; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=emKW1DsDd6J7BoaliTpiqaTlAsPQ1Xr/3FNEg+io6NQ=; b=euwIkKwTNl5CK3tLOTQC7GnQZ29ZtRD8TCp5Tiyl7B9yYP3F7Y3pLoFu 9d5UAHchbbm5EBFvf6Kc8X5g3GC84ZanJV55cL5bU91Pb511eWXR1/Dwj bZdpVPRuMDrclMZnuQk2LLHGc4BRu8f1HN7LuS+m1xolu1W03kX0lvfOj RWvRksxi1Vsd8Xe8eLy131tAE2W2Vbw/aX5Lq4ZV8Fs5PWyHj7MDK0qAk d03qGDSUDcaax9n/Ey4RLrkYojGaw/pwcd2ywiKN1VUeYnM/IVX2CQ7z9 7SOzM2wbsS+Y5IwFpKOPK3ZH47f6rP92tFOFn7lCDkBokkHDBmsBrUHsS A==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="340040096" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="340040096" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="768455999" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="768455999" Received: from nopopovi-mobl1.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.33.48]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:38 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id A507B10CC9C; Wed, 15 Mar 2023 14:31:35 +0300 (+03) From: "Kirill A. Shutemov" To: Andrew Morton , Mel Gorman , Vlastimil Babka , David Hildenbrand Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH 00/10] Fix confusion around MAX_ORDER Date: Wed, 15 Mar 2023 14:31:23 +0300 Message-Id: <20230315113133.11326-1-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E396DA0020 X-Stat-Signature: 59568x6sebs1jp1t7cciswxd1erqx5on X-HE-Tag: 1678879906-595983 X-HE-Meta: U2FsdGVkX1+cKItzWD8ogCSkym2aAB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+VzNV8qz2hhTCyTIFsnHX1c6IhIrgfxcM6PVVd42Jk4cS2cGPQ/tE+ZxJCsLXF9xP/u+g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: MAX_ORDER currently defined as number of orders page allocator supports: user can ask buddy allocator for page order between 0 and MAX_ORDER-1. This definition is counter-intuitive and lead to number of bugs all over the kernel. Fix the bugs and then change the definition of MAX_ORDER to be inclusive: the range of orders user can ask from buddy allocator is 0..MAX_ORDER now. Kirill A. Shutemov (10): sparc/mm: Fix MAX_ORDER usage in tsb_grow() um: Fix MAX_ORDER usage in linux_main() floppy: Fix MAX_ORDER usage drm/i915: Fix MAX_ORDER usage in i915_gem_object_get_pages_internal() genwqe: Fix MAX_ORDER usage perf/core: Fix MAX_ORDER usage in rb_alloc_aux_page() mm/page_reporting: Fix MAX_ORDER usage in page_reporting_register() mm/slub: Fix MAX_ORDER usage in calculate_order() iommu: Fix MAX_ORDER usage in __iommu_dma_alloc_pages() mm, treewide: Redefine MAX_ORDER sanely .../admin-guide/kdump/vmcoreinfo.rst | 2 +- .../admin-guide/kernel-parameters.txt | 2 +- arch/arc/Kconfig | 4 +- arch/arm/Kconfig | 9 ++--- arch/arm/configs/imx_v6_v7_defconfig | 2 +- arch/arm/configs/milbeaut_m10v_defconfig | 2 +- arch/arm/configs/oxnas_v6_defconfig | 2 +- arch/arm/configs/pxa_defconfig | 2 +- arch/arm/configs/sama7_defconfig | 2 +- arch/arm/configs/sp7021_defconfig | 2 +- arch/arm64/Kconfig | 27 ++++++------- arch/arm64/include/asm/sparsemem.h | 2 +- arch/arm64/kvm/hyp/include/nvhe/gfp.h | 2 +- arch/arm64/kvm/hyp/nvhe/page_alloc.c | 10 ++--- arch/csky/Kconfig | 2 +- arch/ia64/Kconfig | 8 ++-- arch/ia64/include/asm/sparsemem.h | 4 +- arch/ia64/mm/hugetlbpage.c | 2 +- arch/loongarch/Kconfig | 15 +++----- arch/m68k/Kconfig.cpu | 5 +-- arch/mips/Kconfig | 19 ++++------ arch/nios2/Kconfig | 7 +--- arch/powerpc/Kconfig | 27 ++++++------- arch/powerpc/configs/85xx/ge_imp3a_defconfig | 2 +- arch/powerpc/configs/fsl-emb-nonhw.config | 2 +- arch/powerpc/mm/book3s64/iommu_api.c | 2 +- arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/platforms/powernv/pci-ioda.c | 2 +- arch/sh/configs/ecovec24_defconfig | 2 +- arch/sh/mm/Kconfig | 17 ++++----- arch/sparc/Kconfig | 5 +-- arch/sparc/kernel/pci_sun4v.c | 2 +- arch/sparc/kernel/traps_64.c | 2 +- arch/sparc/mm/tsb.c | 4 +- arch/xtensa/Kconfig | 5 +-- drivers/base/regmap/regmap-debugfs.c | 8 ++-- drivers/block/floppy.c | 2 +- drivers/crypto/ccp/sev-dev.c | 2 +- drivers/crypto/hisilicon/sgl.c | 6 +-- .../gpu/drm/i915/gem/selftests/huge_pages.c | 2 +- drivers/gpu/drm/ttm/ttm_pool.c | 22 +++++------ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 2 +- drivers/iommu/dma-iommu.c | 4 +- drivers/irqchip/irq-gic-v3-its.c | 4 +- drivers/md/dm-bufio.c | 2 +- drivers/misc/genwqe/card_utils.c | 2 +- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- drivers/net/ethernet/ibm/ibmvnic.h | 2 +- drivers/video/fbdev/hyperv_fb.c | 4 +- drivers/video/fbdev/vermilion/vermilion.c | 2 +- drivers/virtio/virtio_balloon.c | 2 +- drivers/virtio/virtio_mem.c | 12 +++--- fs/ramfs/file-nommu.c | 2 +- include/drm/ttm/ttm_pool.h | 2 +- include/linux/hugetlb.h | 2 +- include/linux/mmzone.h | 10 ++--- include/linux/pageblock-flags.h | 4 +- include/linux/slab.h | 6 +-- kernel/crash_core.c | 2 +- kernel/dma/pool.c | 6 +-- mm/Kconfig | 6 +-- mm/compaction.c | 8 ++-- mm/debug_vm_pgtable.c | 4 +- mm/huge_memory.c | 2 +- mm/hugetlb.c | 4 +- mm/kmsan/init.c | 6 +-- mm/memblock.c | 2 +- mm/memory_hotplug.c | 4 +- mm/page_alloc.c | 38 +++++++++---------- mm/page_isolation.c | 12 +++--- mm/page_owner.c | 6 +-- mm/page_reporting.c | 4 +- mm/shuffle.h | 2 +- mm/slab.c | 2 +- mm/slub.c | 4 +- mm/vmscan.c | 2 +- mm/vmstat.c | 14 +++---- net/smc/smc_ib.c | 2 +- security/integrity/ima/ima_crypto.c | 2 +- tools/testing/memblock/linux/mmzone.h | 6 +-- 80 files changed, 210 insertions(+), 240 deletions(-) Acked-by: Mel Gorman