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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4490C54EAA for ; Thu, 26 Jan 2023 21:58:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233111AbjAZV6f (ORCPT ); Thu, 26 Jan 2023 16:58:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233110AbjAZV6d (ORCPT ); Thu, 26 Jan 2023 16:58:33 -0500 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2149673773 for ; Thu, 26 Jan 2023 13:58:32 -0800 (PST) Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.17.1.19/8.17.1.19) with ESMTP id 30QLuHvG013277 for ; Thu, 26 Jan 2023 13:58:31 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=sTD50cTBzUMl+kZHjpCHKooMyDr+UIBBgnaoHVk+PWQ=; b=Hbx4OUL16Tu9e9qaQ44WJAfgoEPgn4JxNkq1VOs97Vy9ItigT2b8Q4kLJKrJbIpuQUZP +6BiNBTANridfBxVWSRcnd1uKjAIbLGzazO+eMxPGgsemIMwmQzLwD8+7LEgOYHude5P OuI+CbVVzPzVVFX3EwgkHACOV0tHMtvI9v4WEsRwFoUNopz9zaTpAv8y7yb4571iArwU vWQ8OpqrtrCWj9eV4VWu9NiyRi0Be2k36q4NhhIKYxyJkpZLwtSMF+xWmZg8s2tYFs/q BAUPjfJuceJOT72O6RGCY5/gBP/oNNDLo3iVnmZT9fOn9A627qyVFC+HFB1zD3MM+EED 0Q== Received: from mail.thefacebook.com ([163.114.132.120]) by m0089730.ppops.net (PPS) with ESMTPS id 3nbw49tvq0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 26 Jan 2023 13:58:30 -0800 Received: from twshared24547.08.ash9.facebook.com (2620:10d:c085:108::4) by mail.thefacebook.com (2620:10d:c085:21d::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Thu, 26 Jan 2023 13:58:29 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 581ACFE80AA2; Thu, 26 Jan 2023 13:51:26 -0800 (PST) From: Keith Busch To: , , , , , CC: , Keith Busch Subject: [PATCHv4 10/12] dmapool: don't memset on free twice Date: Thu, 26 Jan 2023 13:51:23 -0800 Message-ID: <20230126215125.4069751-11-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230126215125.4069751-1-kbusch@meta.com> References: <20230126215125.4069751-1-kbusch@meta.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: RvHkgnaAZZvshAEP4t2ZlkGK-maC6mIT X-Proofpoint-GUID: RvHkgnaAZZvshAEP4t2ZlkGK-maC6mIT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-26_09,2023-01-26_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Keith Busch If debug is enabled, dmapool will poison the range, so no need to clear it to 0 immediately before writing over it. Signed-off-by: Keith Busch Reviewed-by: Christoph Hellwig --- mm/dmapool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/dmapool.c b/mm/dmapool.c index 4dea2a0dbd336..21e6d362c7264 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -160,6 +160,8 @@ static void pool_check_block(struct dma_pool *pool, v= oid *retval, static bool pool_page_err(struct dma_pool *pool, struct dma_page *page, void *vaddr, dma_addr_t dma) { + if (want_init_on_free()) + memset(vaddr, 0, pool->size); return false; } =20 @@ -441,8 +443,6 @@ void dma_pool_free(struct dma_pool *pool, void *vaddr= , dma_addr_t dma) return; } =20 - if (want_init_on_free()) - memset(vaddr, 0, pool->size); if (pool_page_err(pool, page, vaddr, dma)) { spin_unlock_irqrestore(&pool->lock, flags); return; --=20 2.30.2