From patchwork Tue Jun 25 12:16:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liangxi Liu X-Patchwork-Id: 13711003 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 D3CADC2BBCA for ; Tue, 25 Jun 2024 12:17:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 725A46B02FB; Tue, 25 Jun 2024 08:17:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AE206B02FD; Tue, 25 Jun 2024 08:17:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 528486B02FE; Tue, 25 Jun 2024 08:17:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 312E36B02FB for ; Tue, 25 Jun 2024 08:17:12 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D3AE01616AB for ; Tue, 25 Jun 2024 12:17:11 +0000 (UTC) X-FDA: 82269310662.01.446F223 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf28.hostedemail.com (Postfix) with ESMTP id 2CEF5C0017 for ; Tue, 25 Jun 2024 12:17:09 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lFqs4Kzj; spf=pass (imf28.hostedemail.com: domain of lgs156412@gmail.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=lgs156412@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719317815; 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=UU/g240f/L7w/Z66TFDfSallHVn15XV0NCyAfvU/O9Q=; b=uHbqKNBrOSt29KaiDboQh4BE7QBjQ1YUlKaEu3WwmKflpjXgszd/zoDebt44TdyFB5iqhj ouWJ+6bWzE6LKr6Xpw0NBNRTgTtWJpc/clmqCHEcQ9A3pFm79HabuaBE8f8yr5e8jXJ5K9 CUQK6FbCwo9K9hRDQLXfzhUs92jpclo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719317815; a=rsa-sha256; cv=none; b=yFFetwJrg5nOhOjm69oTqXiwiJJHIX7dUuIXIdkbW2lVYgloROVN1KfS/q/uqhks6VBCu1 Qa0lx47e0o1wjPMLfl06JBBJuRTEZQlqLVw1cOQVNvNhycYEPlFUSpu2MVwYaA2mPo642H z8n37u6p0ZxCVZBB3xgtQlSg8bODcms= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lFqs4Kzj; spf=pass (imf28.hostedemail.com: domain of lgs156412@gmail.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=lgs156412@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1f64ecb1766so41672355ad.1 for ; Tue, 25 Jun 2024 05:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719317829; x=1719922629; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UU/g240f/L7w/Z66TFDfSallHVn15XV0NCyAfvU/O9Q=; b=lFqs4KzjuEIe4gdO4pEwNhjDqyCVqxIUHyHIcXDAEO/8gcBka4vr9xCA5oEN4lHaqx 0anq9pIuBzTx0w2k/oruzjAWOPoS8hp5nxH+uiJlPzYD3vfqgVhqIGa+g9WriEJ7zQoo nFJ36cJKFSQulHKf6S+n7hUMAGI7FJfjycG6hTmyeWOB3MC/WbqQ8IqYk5kFvno2xfSm DwKaXp+nzIakdCubp1QyRp1BD6YIUbU20AgDZxDjEkGDT3RWz7MstXD4l5PxFSrL7l/+ dkYxuGYyERVnF2F1CRZQH65VIc/sN3UaI4ZZaOGDfq196MgwUgDxcJ56AxvgKlqIDgzp MYwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317829; x=1719922629; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UU/g240f/L7w/Z66TFDfSallHVn15XV0NCyAfvU/O9Q=; b=dQhsDhVwUz9jrwUhu9I7civMJ1Mz6jCb/bHfV/BkqvtdHMSMj0IGww3+r8/0AOW0ac Oa5Fxc30T8PE83RKSBvMnK0/fosvddo76v04M7eJgXQGVXd6Zsr6dQ/zBfEzbG3gBET5 m4fEyiuYiXR+LUyW9P9/MWRrMbPtcnR5bz9dhB80XjUJMfhY6NjbQjwEkHFWLFARwdVm pyu/vVPr0E/5fAWq+o0hOAhfKC5ZQpgZMhMF2mmSTZYHvVSloNgbzJHnggqtHN8933UQ 5RiPY8zwQrc6tfipLh2LKmDiHLde8V82PcOWx/8n8HjknpepEQNzS+xHYznldsGJHK9t R3GA== X-Forwarded-Encrypted: i=1; AJvYcCXGmdZw8dLJaHOL9W1E05C0CEG/9OBpgiaeb+NUYruz7agEQMLXuWK8SJb58gkLs5LMIV6ggyD1NMkw/soYp9eQr6E= X-Gm-Message-State: AOJu0YzZ6xB7NuTAf7U6zUcuUFSxUQcEQT2meXZqvXxI7prDfRfV4oLv Jkfu9wZbL+8uNKV73oJrmxvEQCrDhwH7vnN/zQxN4SVxMdRpEdDf X-Google-Smtp-Source: AGHT+IGRMS8OB61wL8cXtxJx3wCGcpMp7tS1M3woivAe2Yz6YNFRzTSQ3wNi11zN+HRWnkFb2YsOnQ== X-Received: by 2002:a17:902:ce82:b0:1f7:3d0d:4cd with SMTP id d9443c01a7336-1fa1d514687mr93247815ad.24.1719317828808; Tue, 25 Jun 2024 05:17:08 -0700 (PDT) Received: from guanshun-ubuntu.mioffice.cn ([43.224.245.235]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fa75f5401csm10166885ad.119.2024.06.25.05.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:17:08 -0700 (PDT) From: Guanshun Liu To: rppt@kernel.org Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Guanshun Liu Subject: [PATCH v2] memblock: export memblock_free() to free reserved memory. Date: Tue, 25 Jun 2024 20:16:52 +0800 Message-Id: <20240625121652.1189095-1-lgs156412@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Stat-Signature: bm6a3dxf64kthahjuantpdwgof4p1cbd X-Rspamd-Queue-Id: 2CEF5C0017 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1719317829-559740 X-HE-Meta: U2FsdGVkX19Srm5hCPYDfvMIfoKm2muyUY+HLWsBYQrMgpi26BiV44CtT2n3Ur90HtMnOloL8kIV/hd9Y8svd0AE7ZXgaFQNB7wNF4ToEF8EjkCYZna6OdpPXAqfQstbI2L4JpL54CXfFnxGJJKIWSi5A0/1TeR/7UU9tgRBWfqqQNyrjgy11+4+W6QjYxypRmb14u9ZZe2kaLYz1tntUBETNRPSkoa5IWvH5Nbow13vIRopvjR6lSDXbVQySJgLqahFVUXwlxhYrmY7L+yZwlCL8Jh+tz38PcRnFWXt/jvuvMmSgjjd0GRENubce5hJys3b6qRcLkcTxZ3CxQb4qERiM5OrKlJXCCx03iYiwc3mCd/wUvXBZCYkRTGHHjIWwqS2NYwyjl5a7rk8c2YhFzS8i+T4onvIPUj7XWnNon/9aQDHIem4znbm3JqL+IAW3fuSlkecTOV8Ci+xqAGrJzDYnlttlUoqWbhMglNa9X15YRignEooy9c9GO4t4gtYhN3kmsySYVsZRCThTSskGd1IECejwqhWGJLFtubDbF8HTeBY1Pw2JAn1KdbaCedDm2NMDouUO0g/EXC/r9hXa2CGy+LmzK9UQckJdJBhOPO/qqEnVJqL0OUoqyMtz1MDIwKy31Q0XzO1NB8Jh2OykIRQDtAJd/L473sslL8fWMnKwPHvq3nxcU6/5YY3COo5EdIi35fVhnVVcFIwaTTvxn7uYF3ehBNznkHYEbZ5PnaLa44eEkoE3whTRb8nOHFegLhzxGL3zb19zUvTrS/c0X2P5Ox88UiTnolJ/U9NAEZTFCB+YPicQnDONvbzs1370X3uwRDqFosxGbCRbAJHYmabmOIpVE3zzn/81wllPdDxqICnwilcfw5B+LX2Q2KSl0kiUurI0NqQ2xl4f3+/2SdaKvIY0USzFJEEZCvIcF5fDF9vr4IerzLzhB1BoduQsnLTYRr73LCXmPGnD2g 0Ywmm22j EYqZ/E6MXbXSPsorlfqKZvHjW4dDLeAogAhgwa7gWkvI60fi3QWqug4owY5DAJlg1J9xdkVj3pMa+gxOjQttieBo7bWrEQkiov6PQRM5i55+0RFLJjbw+mt1y3c/qCekrwMbPEDeNElzpW6T4b2VLfRZjGHflfmAPqC45Xkil7vCbWfdbyGsua4zNw0uiorLT0hdLJ0aEp1Ku0PKrxLKrANQwwsGpA+p+vEuHjOsD8btzvn0kBm+R0eKe9maWBYT7ob75KxXn3KEGw41Wd1h+0p9sxIpZNBFFWs/r0gE7Bs3jh6AFD3hyOMfeWoxRCXE3MHc3QJcJnBlDnuCdQgfW8CPiMwuB/vA3Rsqt1zvBH7oGU3cXgh5tNDb87ykCQM6/mPKEqulV1MyS/Nc= 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: List-Subscribe: List-Unsubscribe: On architectures that support the preservation of memblock metadata after __init, allow drivers to call memblock_free() to free a reservation configured in dts. This is a hack to support the freeing of bootsplash reservations passed to Linux by the bootloader. Signed-off-by: Guanshun Liu --- mm/memblock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/memblock.c b/mm/memblock.c index 6d18485571b4..20e7f81fc076 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -848,6 +848,9 @@ void __init_memblock memblock_free(void *ptr, size_t size) if (ptr) memblock_phys_free(__pa(ptr), size); } +#ifdef CONFIG_ARCH_KEEP_MEMBLOCK +EXPORT_SYMBOL_GPL(memblock_free); +#endif /** * memblock_phys_free - free boot memory block