Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9D1A1EF38E for ; Sun, 13 Jul 2025 23:40:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752450048; cv=none; b=INJ1oqeCdXdVdXOj6C1xwg48dD/IjTlRyy4pMkIoiPk8ycC7/XdFkPMfS2QfEcurf3Krvskk7kwl83iFYXnLFQ2OXe3L+4je7GY256FLYFpRoprOMXSqY+ymMFS9MhYGNaGk8QECn4t9u0lpBaabLRr11hbmzdU/VVWHPLIaG58= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752450048; c=relaxed/simple; bh=bOXfsp8Vez22XO1tnBbd3fpoUSyQo5wDiR7RsxvmX2Q=; h=Date:To:From:Subject:Message-Id; b=e5Fb9t++Tr0lKmlz1OeUHmeAR+MMWr0ULUt+L5qxbGT71tf9+X7sUEzjOnq62fNbkY4OE5VzCbr/5HphCgPgPCK/u4kxnCkvcw2GSItzoToxUgOG7rAXlsGqfyKWZRJ6fUk+fynMerdrL5uDdejVyzb2IbQLcMPhec865apJPRA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=sWO7UM/0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="sWO7UM/0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C87FC4CEE3; Sun, 13 Jul 2025 23:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1752450048; bh=bOXfsp8Vez22XO1tnBbd3fpoUSyQo5wDiR7RsxvmX2Q=; h=Date:To:From:Subject:From; b=sWO7UM/0X2tZWJ+N3gDPnZrxntu0e2hKydhOnWjiWrgY0XTlRsY6oGKjKZZiro7bn jTlTpIizzX4wmPTjqsvvEgKwsY7XKqULkSMiCCfq2rnf79lyCS15afwnR66LzkZ3xj BppcdBjrPvvijAlUg2KfyaghKAePaa9KBdm08LEc= Date: Sun, 13 Jul 2025 16:40:47 -0700 To: mm-commits@vger.kernel.org,ptyadav@amazon.de,osalvador@suse.de,david@redhat.com,alexghiti@rivosinc.com,rppt@kernel.org,akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-stable] cma-split-resrvation-of-fixed-area-into-a-helper-function.patch removed from -mm tree Message-Id: <20250713234048.7C87FC4CEE3@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: cma: split reservation of fixed area into a helper function has been removed from the -mm tree. Its filename was cma-split-resrvation-of-fixed-area-into-a-helper-function.patch This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: "Mike Rapoport (Microsoft)" Subject: cma: split reservation of fixed area into a helper function Date: Thu, 3 Jul 2025 21:47:10 +0300 Move the check that verifies that reservation of fixed area does not cross HIGHMEM boundary and the actual memblock_resrve() call into a helper function. This makes code more readable and decouples logic related to CONFIG_HIGHMEM from the core functionality of __cma_declare_contiguous_nid(). Link: https://lkml.kernel.org/r/20250703184711.3485940-3-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) Acked-by: Oscar Salvador Acked-by: David Hildenbrand Cc: Alexandre Ghiti Cc: Pratyush Yadav Signed-off-by: Andrew Morton --- mm/cma.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) --- a/mm/cma.c~cma-split-resrvation-of-fixed-area-into-a-helper-function +++ a/mm/cma.c @@ -353,6 +353,30 @@ static void __init list_insert_sorted( } } +static int __init cma_fixed_reserve(phys_addr_t base, phys_addr_t size) +{ + if (IS_ENABLED(CONFIG_HIGHMEM)) { + phys_addr_t highmem_start = __pa(high_memory - 1) + 1; + + /* + * If allocating at a fixed base the request region must not + * cross the low/high memory boundary. + */ + if (base < highmem_start && base + size > highmem_start) { + pr_err("Region at %pa defined on low/high memory boundary (%pa)\n", + &base, &highmem_start); + return -EINVAL; + } + } + + if (memblock_is_region_reserved(base, size) || + memblock_reserve(base, size) < 0) { + return -EBUSY; + } + + return 0; +} + static int __init __cma_declare_contiguous_nid(phys_addr_t *basep, phys_addr_t size, phys_addr_t limit, phys_addr_t alignment, unsigned int order_per_bit, @@ -408,15 +432,6 @@ static int __init __cma_declare_contiguo if (!IS_ALIGNED(size >> PAGE_SHIFT, 1 << order_per_bit)) return -EINVAL; - /* - * If allocating at a fixed base the request region must not cross the - * low/high memory boundary. - */ - if (fixed && base < highmem_start && base + size > highmem_start) { - pr_err("Region at %pa defined on low/high memory boundary (%pa)\n", - &base, &highmem_start); - return -EINVAL; - } /* * If the limit is unspecified or above the memblock end, its effective @@ -434,10 +449,9 @@ static int __init __cma_declare_contiguo /* Reserve memory */ if (fixed) { - if (memblock_is_region_reserved(base, size) || - memblock_reserve(base, size) < 0) { - return -EBUSY; - } + ret = cma_fixed_reserve(base, size); + if (ret) + return ret; } else { phys_addr_t addr = 0; _ Patches currently in -mm which might be from rppt@kernel.org are