From mboxrd@z Thu Jan 1 00:00:00 1970 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 7C377C61D97 for ; Fri, 27 Jan 2023 00:54:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E8B1F6B0071; Thu, 26 Jan 2023 19:54:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E3B356B0072; Thu, 26 Jan 2023 19:54:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D03F56B0074; Thu, 26 Jan 2023 19:54:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C18886B0071 for ; Thu, 26 Jan 2023 19:54:15 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A3599120EC5 for ; Fri, 27 Jan 2023 00:54:15 +0000 (UTC) X-FDA: 80398757670.03.C304112 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf02.hostedemail.com (Postfix) with ESMTP id DC71380004 for ; Fri, 27 Jan 2023 00:54:13 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=dBowJHoL; spf=pass (imf02.hostedemail.com: domain of isaacmanjarres@google.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=isaacmanjarres@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=1674780853; 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=oEIeBysx6lstniqvWYEj+an/AzIWqhVrgAAj5NjMc4s=; b=zvnb5GJKM4DdFoxwB/jm3Spz66Rm9+ki58Zad3psb3zhFBkk5nDVPKd7Q/VJgHiys54BLE cO2DdaDCbT/xsVAGHXfCb0kVQXprvxomvtmyM+AnBazWgeYdYbP/InnDoztb987PANhqPV Y9/vhixEPW2OdhDLOeNBcyzWJVUjd3k= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=dBowJHoL; spf=pass (imf02.hostedemail.com: domain of isaacmanjarres@google.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=isaacmanjarres@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674780853; a=rsa-sha256; cv=none; b=OJ2ML1Kc3jxo+Q3JiG9bQlE0YVg5IUT/YX3QJK+3axHKJE3TyOZOYDFqthbDJFhcy59cFm o/1HeAYLPbYDaQ4ail7+fpvSmhjuBHnDndwaJmt4uvSmih2zdqfyWohMG/m9t8ybU/efw1 IwIpCIPadbUupfSM9rbKWeSUceVEVAo= Received: by mail-pj1-f42.google.com with SMTP id e10-20020a17090a630a00b0022bedd66e6dso7074763pjj.1 for ; Thu, 26 Jan 2023 16:54:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=oEIeBysx6lstniqvWYEj+an/AzIWqhVrgAAj5NjMc4s=; b=dBowJHoLQntMw8JzlzkdP8SJUrroMPRbSfJTI8HhH/6fQc8mzyj63PewT8H2g70JZO XR2rXXjb5tR5ah3wpNw7zXK78wc7coTdEgmGr1NDOCGinNE4CqPZOoGeyVmvAwvjntCF lVQPa+eWVM+SESt0wQlDsThyixlxk9P5xRBcb4BUyvRxIbkEAobrcUabe00qevYN4yld Rj9lX1McxpNS9fy7ahyv0HGRZK4DLEE207MkhofsvkRoA6XZVvyldJBwt97aVMZUh001 QSyI8VWP9ebgpDSaODWYvC4pyWbCd+XmQyNRme0cIW3bZFIWDhtb57nRqJC5KQgoBMW8 iCcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oEIeBysx6lstniqvWYEj+an/AzIWqhVrgAAj5NjMc4s=; b=GsVfb1ATRHEJxf7cSitlTmPpM2ejOFqWk4ezYDY1HKF5S6Fv3BgBEIas/HzcMN2zLr FKqiyD7V+Kc1M5Eoi0l1SGjRuzzmRI7y94sqRxp6k6gMWCz3fZ+eVW6TK7rKzeMSv4su XD6B8QhHDKjnfpkjfzM1kpGWb7RtX2mptaoqC51SpO04VucvcsB1CcuwotafTKVmnia9 gjJuNMJGS5e7K3U9nF4O0JByr79Wzeb6YIyhnZSbXSCXXDB5juQFqiyjqW/kwQS8cigo jhzZs2dB/Ei7olSCfx3Gv401Sy5INb7CAV1IRfgJ73FV1EhaoAifHphbG9Leh+UQqGfn agzw== X-Gm-Message-State: AO0yUKVLIMrfOjdk0jQf5I49rKKZYWTB1gfAs356kwY3Y7xajB60ydbf 5ftUOlQQuIM2wk+ee4QtImDa3Q== X-Google-Smtp-Source: AK7set93yuuj9GvSPwrVqsYKu8qp4aLjfMFToEQojUORfgciZYzThZo6pOLUfrAAuhAS88V+09gYnA== X-Received: by 2002:a17:90a:eb06:b0:22c:952:ab22 with SMTP id j6-20020a17090aeb0600b0022c0952ab22mr863690pjz.1.1674780852536; Thu, 26 Jan 2023 16:54:12 -0800 (PST) Received: from google.com ([2620:15c:2d:3:497:8b7d:bb75:1c3]) by smtp.gmail.com with ESMTPSA id g12-20020a63374c000000b00476d1385265sm1274993pgn.25.2023.01.26.16.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 16:54:12 -0800 (PST) Date: Thu, 26 Jan 2023 16:54:07 -0800 From: Isaac Manjarres To: Rob Herring Cc: Catalin Marinas , Andrew Morton , Frank Rowand , linux-mm@kvack.org, Saravana Kannan , stable@vge.kernel.org, Calvin Zhang , kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] Revert "mm: kmemleak: alloc gray object for reserved region with direct map" Message-ID: References: <20230124230254.295589-1-isaacmanjarres@google.com> <20230125210215.GA2879887-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230125210215.GA2879887-robh@kernel.org> X-Rspamd-Queue-Id: DC71380004 X-Stat-Signature: tq5m17qpmxbiyry5rtd1oq3s9afs8a3n X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1674780853-727199 X-HE-Meta: U2FsdGVkX18cYMlM84M1lQ93x92idbsrqGzOFPYhuvfHAdsIYMRzIzkYfir3oZvSUv4tpgfGE6hFB8STnDnfXmkQ3Av20tq9Pp9pzbbxGkaG7NewW4UWOpeVEmUDMDVZuAJiqNps0woDmT8ayGEmhirlBwuc49UzvMquSufOWGH30wwggVocgkORvInBXRG1hbLkpLjSYXxqtWxzDxGRimzvqco3t0hm2jQ/WBxxQAbu0bdSKWjj9ORsFqD0Yr9u4hq9qLFOY0Z2wxyRP4IYrbRgZFbfcD6a39vJjEwMkbZ3KqGTCCPrzlbS3k158qomeScSXWb5zltBs9AcDbqZDTXWmhB56lPsx/MgFrPpuier4AyyCzqA0n6KKk8UQnA07uIZyS8cOqFtqgoo477C7Gy0yDI5P47SYSezC0atD7VTwyhdaz9JdDJo0cu7UQZFE+on4PmFnQa86bXVuZmzyQWoh0lqazDyTQgb6fZB4qYIEoV9AktcVuEunb8dJ64ing1eeyMqvmnCa3zVvqcfWQ8kJ2lyJoSnEsh69+K4QBY2/81g22aw5sr+ClAYBknhiIa3fl1OhVevOd4kd7W/qWH8KOQDE4ppOFkhAzICvUNSww3rNrFHqc1YcqgTMswSJ+F9IDcAZ8tLPeZkSgm1kp/FSCOFkn3VIJ7HeF5ZrJZeAxn2X/003QD8/pwUzo7PjJDYnkq9DGz9RUUzUUGxDp3frqrU8SmUgdqTEsCt+CvOB4Ux+86hb0vEn5zq29yPm4J+UBIk+5rBM9/4eRUQrNTuljqnWyMI3k2JpwQYPxhQaRZap1SLyfl+9oXY2fI94vOUYrmJsgsKUSU449+PJOIpXaDPepvNYScp3DOlh7H756VdetGlD5g3poMVop7zfhVnWiqOcBJT0QDUanhzs99BgxLWaumOcWfVM5I6PKCH6iVOICgTFgqaBw8rJEAN9ptUZuSVnpCqZX9C/pH lB36M036 SjaEFAfVfk3Tz/j43oXSH1mwZhUJl9CuEcqy4VSAb1+RgNZkB7U9Q2pDl4My++Ooeo1VtBhD2eNXpE+MGR0ORF20T7b0z9jAMpZ+WCdNl0eGM0dyS0cQew9F+gJml0RBgXKI6fvhpRssPg02/TZqA4wuE3wQv0J++rB9qoyQLoTnCkZ1lPzJxHG09gV0d017PxsAz9UbDE7IogkbI2GeIpu12ri3gm2uVCL2veeNs4MvwaX2k2tN2Cd4aYr9G6xQOtn6GY7ydW1UwmyoNAi1Uh75yprSYBhDlfqohcMW3Z9hXsfn1J0lCxPxyKLSQ1juj/8aYkwzaBzjoVyhG2jUHNH0XMZEeOqCbaxUHODB1rMBvEqV/UOl2wsy6GLtMq+ubnR2LkTAgLDkj1rI65ltfdMzQ/+SDjP/R1gzwo1IURR4C5oQ= 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: On Wed, Jan 25, 2023 at 03:02:15PM -0600, Rob Herring wrote: > On Tue, Jan 24, 2023 at 03:02:54PM -0800, Isaac J. Manjarres wrote: > > This reverts commit 972fa3a7c17c9d60212e32ecc0205dc585b1e769. > > > > Kmemleak operates by periodically scanning memory regions for pointers > > to allocated memory blocks to determine if they are leaked or not. > > However, reserved memory regions can be used for DMA transactions > > between a device and a CPU, and thus, wouldn't contain pointers to > > allocated memory blocks, making them inappropriate for kmemleak to > > scan. Thus, revert this commit. > > Both commits talk about the same type of memory as CMA is used for DMA. > Neither commit tells me what are the implications of kmemleak scanning > or not scanning the region? Are there false positives? If kmemleak scans the region when CONFIG_DEBUG_PAGEALLOC is enabled, and the CMA region is not in use, then kmemleak will cause a page-fault, because the region is unmapped from the kernel's address space. kmemleak scans the region because it thinks it is in use/allocated, when it's not. While this sounds like a problem of kmemleak not being informed about the region not being actually allocated, it's also a matter of CMA regions not being suitable for kmemleak to scan in the first place, because they don't have pointers to other memory blocks; they might have data from DMA transactions with another device, so it doesn't make sense for kmemleak to scan these areas. --Isaac