From patchwork Mon Jan 9 22:16:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaac Manjarres X-Patchwork-Id: 13094426 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 F1C6DC63797 for ; Mon, 9 Jan 2023 22:16:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7870F8E0001; Mon, 9 Jan 2023 17:16:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7379D900002; Mon, 9 Jan 2023 17:16:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 600308E0005; Mon, 9 Jan 2023 17:16:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 517FD8E0001 for ; Mon, 9 Jan 2023 17:16:35 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 30C971A132E for ; Mon, 9 Jan 2023 22:16:35 +0000 (UTC) X-FDA: 80336670750.06.837742F Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf14.hostedemail.com (Postfix) with ESMTP id 9577A100003 for ; Mon, 9 Jan 2023 22:16:33 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=UEui1WQc; spf=pass (imf14.hostedemail.com: domain of 3QJK8Yw4KCHshrZZblZmiZqqdrfnnfkd.bnlkhmtw-lljuZbj.nqf@flex--isaacmanjarres.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3QJK8Yw4KCHshrZZblZmiZqqdrfnnfkd.bnlkhmtw-lljuZbj.nqf@flex--isaacmanjarres.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673302593; a=rsa-sha256; cv=none; b=2c1KWbIcN1vxaUhtyzRZmyu401wzJHuw3pPcfVb1zShREWFp8gpooRq+RaQJJTNrnVFpao H9q51xdBHUJxjfv0hYJLXmPiBRDyTdfTx8hh5Lpp9tIM5+Z3wpFaQYxpGIagNQiMUDw+ia fTm91iGWRxzSQV2cUlZmOei40FxfJ9w= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=UEui1WQc; spf=pass (imf14.hostedemail.com: domain of 3QJK8Yw4KCHshrZZblZmiZqqdrfnnfkd.bnlkhmtw-lljuZbj.nqf@flex--isaacmanjarres.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3QJK8Yw4KCHshrZZblZmiZqqdrfnnfkd.bnlkhmtw-lljuZbj.nqf@flex--isaacmanjarres.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673302593; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UAY7ziXR1pDWT8yIaOxG4IQsxtcRX6+lmyo9rcOBFQI=; b=RyNhhOY0jMxNMeKCKKWuC+ity8X36FED+KlJGCAyHxVw2OvDgcYfO8N7Hy5e4woq9Zh3vr YEahB85YV7SptQTZIOSrrtHuzIdN/CpcJachlTpPQLsg4xC4GmuQ2lhPjU2xmK40bNvhvL B7pmKYJl9fl/LjHJItwC8q653jQ7RHs= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-4c16ff0159eso107835927b3.17 for ; Mon, 09 Jan 2023 14:16:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=UAY7ziXR1pDWT8yIaOxG4IQsxtcRX6+lmyo9rcOBFQI=; b=UEui1WQccphNYJS2B2rBldr80G72ZMsvoPivgTxDn/fxNbkP3rl2cZegNrl31wiaJT YWRA3jP5BrD3xglYqWwZOfFl/74UQK2ntqKI8UxjMlnvXsrObTXRacBD1jvkt9U0pv0N Rz6yX12fdD0UTvmPzwtyRL69HEjoWr6xF72eVcgjMKIwVTabZpr1OKMy01LQRmUelK34 uoJL9SNCI4SOmZf1qKQGaD9pPn6QfObQYClE7Mk4i0jKselSNB1MRU7B3RGPs/M3WYXA PmQuYNpgcql7zAPOU+xV8XEM/v8in/FSMDrsPu9J1WTG35YD3VEUUbyMXCfFe8PA+/hf OYug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UAY7ziXR1pDWT8yIaOxG4IQsxtcRX6+lmyo9rcOBFQI=; b=fKQJY2G6b/hjFvk0BTzw67MjX6yCj54ANWdhm3PYymcMD+SAY0MqkZegOfQdOcNKVY 1NdJEAYKtIufVz4qddm60+hm/Hbj1pxjedc4qH4k6MvMd7YaCR51EqUuxV4Ze8I+6281 Cl0gNgET0N0VVPFOEOu087KifZPr83j2O8Jq9UkDe0nD0BnHpIKWbV38yXbO9dIxk1Js YYI5P2I3bh4cVjoXZgjJy4l+GwcCG3gUXY3bydeK87lnbWDz5BdHLY1xrKv7LSqasLqk 7Hv9ypzpyt8Jx5ZtfGy2WVBRLN28GPeWLqXZTIlf5EpzpzsoJ06maeh2KtsSH53ExtGu wTjg== X-Gm-Message-State: AFqh2kp5XGBQlgssSRGSRWY0AAmXfdqwL1zZfPZM2jPx7xHt2FqLyTY0 lEHbu9SPsDxE0fsWe0ZKFgRkOEJ8tYJO7+JuC/wmFg== X-Google-Smtp-Source: AMrXdXsf7/34OOYlD8ImdQqEPY+KiIDRkgSsEo2WjPbDVqBrR8MswUATMamEBK1Wv6pIN7qPxVRK/kO82VgT8MFNA9fdcA== X-Received: from isaacmanjarres.irv.corp.google.com ([2620:15c:2d:3:3990:5e50:b0f8:bcdd]) (user=isaacmanjarres job=sendgmr) by 2002:a0d:d944:0:b0:46a:a08b:b5c9 with SMTP id b65-20020a0dd944000000b0046aa08bb5c9mr712139ywe.431.1673302592743; Mon, 09 Jan 2023 14:16:32 -0800 (PST) Date: Mon, 9 Jan 2023 14:16:22 -0800 In-Reply-To: <20230109221624.592315-1-isaacmanjarres@google.com> Mime-Version: 1.0 References: <20230109221624.592315-1-isaacmanjarres@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230109221624.592315-2-isaacmanjarres@google.com> Subject: [PATCH v1 1/2] mm/cma.c: Make kmemleak aware of all CMA regions From: "Isaac J. Manjarres" To: Andrew Morton Cc: Saravana Kannan , Suren Baghdasaryan , "Isaac J. Manjarres" , kernel-team@android.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 9577A100003 X-Stat-Signature: rx4uchw1uddxz1krcj5of4tjr8p6m8ez X-HE-Tag: 1673302593-67717 X-HE-Meta: U2FsdGVkX18PlnBAxFgMPCNcsn2Y14exyzlEzf3Y+EvtqMDrwx0WVfgHqGH7CBv8wOOdkjuaosIY3PD6WqStt9xYdwzxsXPO5Kx1Cn8exfvgTQc/T22QQFwS3cex2GmTKsbI+W+MdRCS+C+sn5L85m/a2u8UlpC1puWM0S3hxz/muviSXtr9Ls6Og5pjL0Ee7hj8Ajr4PqQI6JdM+V0zqQsB6PCN5ELunscHlvxAtqT3xK/tHTSaIkNRfu8b0L+9d5UQUQZ1IkpO6xVPV+sUXA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rzRklkYmSAIkIIVj+ACx1os+fjYltWFUf+SZhdTjXmFLVRH2jY5i8iNzL4/8K59OvQ8= 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: Currently, kmemleak tracks CMA regions that are specified through the devicetree. However, if the global CMA region is specified through the commandline, kmemleak will be unaware of the CMA region because kmemleak_alloc_phys() is not invoked after memblock_reserve(). Add the missing call to kmemleak_alloc_phys() so that all CMA regions are tracked by kmemleak before they are freed to the page allocator in cma_activate_area(). Cc: stable@vger.kernel.org Signed-off-by: Isaac J. Manjarres --- mm/cma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/cma.c b/mm/cma.c index 4a978e09547a..674b7fdd563e 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -318,6 +318,8 @@ int __init cma_declare_contiguous_nid(phys_addr_t base, ret = -EBUSY; goto err; } + + kmemleak_alloc_phys(base, size, 0); } else { phys_addr_t addr = 0;