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 8A94CC05027 for ; Fri, 27 Jan 2023 02:40:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90B068E0001; Thu, 26 Jan 2023 21:40:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BB346B0072; Thu, 26 Jan 2023 21:40:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 783318E0001; Thu, 26 Jan 2023 21:40:01 -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 64D6F6B0071 for ; Thu, 26 Jan 2023 21:40:01 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 35B231A0369 for ; Fri, 27 Jan 2023 02:40:01 +0000 (UTC) X-FDA: 80399024202.15.59350C2 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf23.hostedemail.com (Postfix) with ESMTP id 6949D140008 for ; Fri, 27 Jan 2023 02:39:59 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=tBLISifP; spf=pass (imf23.hostedemail.com: domain of isaacmanjarres@google.com designates 209.85.216.41 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=1674787199; 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=JmA1hDZ+MeoPFm9Yjjv0t7YVH1mZV4xy4MwoNik2CbQ=; b=oe4Rl73TTZyMcqVQkWNe1qZWC80KV819ONEXHCcjjwCDTYhJICyOFbiZA0CEtAUnmW2Mz3 lmot6bObFf8jaVEsHLTx+X/V5ot6/ugwkhAkwnA0qTpGmJjPxKH84FjV0zLCfxrmBjXBBJ 1XSQIw0HUa1TX9MwG7FCUK5xFipt8b4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=tBLISifP; spf=pass (imf23.hostedemail.com: domain of isaacmanjarres@google.com designates 209.85.216.41 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=1674787199; a=rsa-sha256; cv=none; b=AYOV6cufkzv3n2AHcYzORAsekA5uftco7ecAXpVi2hRrOX+1Ki3+RPjB1+2Fte60BC/pq8 dy9QNVCBuShH9LNcKvSckcg/ipncSRMmcZxq9Q74CyLJobZUvlsc8XoxVt+v3ggH+ETEUk smr6j7T22+VtyUdcMHbNE6fx0tSyLVI= Received: by mail-pj1-f41.google.com with SMTP id lp10so3300157pjb.4 for ; Thu, 26 Jan 2023 18:39:59 -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=JmA1hDZ+MeoPFm9Yjjv0t7YVH1mZV4xy4MwoNik2CbQ=; b=tBLISifPko9ljpQXoRW1C/WvYxncmvA27w9hF/z1oOC3769navvqXQ2aSLcOoi15GZ NMbjqKBRBg5qrDhIbEaTz89p7VEUm2IiZ53NJiV2N4c9DR+gVc0dLpE0J5t5WX5V2nvl /Vpqb/uAenFA74Ffkfoppsdig9IWA0kEjOz4Q2VJd0qzGDwH5J8ji2NYRQFz7HfjjLrr wS8RA76snYI8CxEOx0JHnlFfD7kPaNhgQTlCQgBxM512r8WQNwjdLNlBkQU0a4Riv+8H 5PVfPhsJyR6qFKi+jcYoMGmf5EvcPqOga2/4u2hDutt9h2VwPYX7or0dIQXLyXUiNJ1A MLgA== 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=JmA1hDZ+MeoPFm9Yjjv0t7YVH1mZV4xy4MwoNik2CbQ=; b=nhEHWSu+oucmMblYmsXhh+Kb+93Rlki8MnpxktQjDbsjfhi7F/ClLHzAWHBJLS6rIr +EstLwfauqAB/XBhdXH1fZzxPuqXVjeuvnwRK4sgsw/8B3hG/lBTobGl5ULyiottqdDv E3kf1+W5A96RY2WZPAKSdHPOSFPJvx0uWmtlPs/PMEeN/Q8z/F92Muulji7YyuNsE2l8 ELG1zLJzCGjq+KT8PaqeK1c3GCubMEwfHp2AH+FcLXhyaKf2yIp4K2NmbS6V6KBtdInJ grMmLQSReciOhY5R3FNqTYbOVko5FvXvtlpE+eBJ7628IFC8wS6hluonNiskNu7Wv5JZ rE3A== X-Gm-Message-State: AO0yUKVtjN3h2F1pKTJE96rzgGAIfmtnBgr7FMHOOWxGo5TxrPynqOnL j5C1fgsKkwPJZzzaRMl4uKg52g== X-Google-Smtp-Source: AK7set9gr8/5ImFQDM4ddHsTo3zTKcVeS38DHQOR23X+Tb9p8uf/UMnwHvYLYorFup38S3BtMufcXw== X-Received: by 2002:a17:902:7886:b0:194:d5ff:3ae3 with SMTP id q6-20020a170902788600b00194d5ff3ae3mr1228848pll.2.1674787197920; Thu, 26 Jan 2023 18:39:57 -0800 (PST) Received: from google.com ([2620:15c:2d:3:497:8b7d:bb75:1c3]) by smtp.gmail.com with ESMTPSA id y14-20020a17090322ce00b00196191b6b29sm1649839plg.140.2023.01.26.18.39.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 18:39:57 -0800 (PST) Date: Thu, 26 Jan 2023 18:39:53 -0800 From: Isaac Manjarres To: Catalin Marinas Cc: Andrew Morton , Saravana Kannan , Suren Baghdasaryan , kernel-team@android.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: Re: [PATCH v1 0/2] Fixes for kmemleak tracking with CMA regions Message-ID: References: <20230109221624.592315-1-isaacmanjarres@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 6949D140008 X-Stat-Signature: jefgbsfdjqrhewki5sbt7aiu8ehundq6 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1674787199-662099 X-HE-Meta: U2FsdGVkX1+kiz/1KyX4tkUb9HeOBIXLWz8eRNHgrdk0i/9yPklH/IyvDvyLTyDYhWj0zFXI8xgroaJotvf1y7kdR6EhtCTYD0Mg1HAlsHSJtBoR2S6YHrlsK3vhdNAkBWkB/Sinkgj1s75++X67FQu8A/jpQHDX3fGU1LXeW7e9BVmdMkFyDb9z/KG7g6CAK/9YCN/Mba1g24tMQhSo0YyVgqMe2Jp1Q3A6pyEwQgiaU+5GyLKJqpEVsRgLprWJicTTnoFZeHbNaMfnAcDGMF/dD/oEs8jnJwt5tKxKkZdFzyxRbYvH1L6MBKaoCdg1oeoqIqfsq6muDqb7m3S5YWCIlZRN6nNYAn4fOHgV1CiMZMbENGfWNth03hM85y+bhDb8e7Ux7ZlwIG+BYEhhPT3r1h5pP/HSwW0XrFnbtZz4KezcVw2CKO46iDmmw9CsCplSHApiqQlQxFEHpSUkhq7ZdQqEc8jrGPvDl2U7INPVXH5rc2kkT2feEv5qwJWGuQvZFbOdzzYx1tVxzSEfDoPzbEpF76TXNzNahmfJ2K9wcVStEr1ksp2+SYuJxc0w+pMmdb2/zVApRDDk2gs4QFGaQ9MqTmt4DwpeBFpNU9CJy3KHBcuA/WYR+1yB4oYn/qZCo5UumB2Ph5fTFj09M+r4rsMttsUN/7DUlkYIeHXWR3bv8eucyTve+grj1kFof3o25SM42ywyb2b8z0ZYKJd6jnaw6r36UGrYuZKCZ9CnfFD+UgoTfgpRbGUsuFef3Gw+mGu+PGfzI1lw08hEiqDzhLBqgfgbIJty0HqUD2YO39Lfog9ykld8arSwToTLWUvA2/xbRo2ES23bvkg1BRGRF5yLtZ/7BQe6kCCc7CvBzfEk3oa+BFDT7hoLz/MVtPwF9UPjamXhWJ9N0e/W8wQhGjhmVZuhAG6jPEusdeQiq3RDzbTAcz9YgnyMLlZsApWENhglRzT2u3S/hxl lz5c6oBS 8jFFXUUrTBtzUtd+Qpm23qQ8ufmx+Rk+8aenCL4XDfu1paDCa6JK8sARv0NZIdQ3plf41oicjQBdcVUKwebnqFcG6FemdaOZ8krTCv2oZum3CCNpuqdgnzKmBV5aVi0m9n/ggerch3V5mAE5r3gJI6SVzMkMp+31RvWySEt/t2oDez/YMrH9MtGvm08hEIfaeAur3bAfsUXqR4Lz0c79GW6y4up9sHvOM7ICkwfQ+Fp9fziJem6B6rV/UVIHWOT2mHCfV/05y69ZklV9WmLvA8ju7oQPEc1HXntKio0EqPx8IybOIQtg5in6+XGKRZX4ik6FqtgfMBtyWjnCZiG13dzcZxz+7SHFuVSyrq8LLhyJSSuY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, 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 12:08:58PM +0000, Catalin Marinas wrote: > That's an option. If there's too much churn to add a flag, an > alternative is to use the bottom bit of 'end' to set the noleaktrace > flag. Using the least significant bit won't work; there are allocations for CMA regions that can be specified to occur within the first 4 GB of memory, and would have an alloc-ranges of [0 0xffff_ffff]. I also don't think there's anything in the memblock documentation that ensures that those bits are supposed to be clear all the time. > Yet another idea is to avoid the kmemleak callback on all the 'phys' > memblock allocations. We can add the callback to the higher level > memblock_alloc() which returns a VA but the lower level 'phys' variants > could simply avoid it. However, I think we still need the > MEMBLOCK_ALLOC_NOLEAKTRACE flag for the kasan shadow allocation. Well, > given that this flag is not widely used, we can add explicit > kmemleak_ignore() calls in those four places. > > I think the latter, if it works, would be the least intrusive. I agree; I think using kmemleak_ignore() would be best. I will split that into series: 1 series that fixes the kmemleak issue with CMA regions by reverting Calvin's patch and adding a call to kmemleak_ignore in the call-stack I referenced earlier, and then another series that cleans up the usage of the flag. --Isaac