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 D6C9ED743E8 for ; Wed, 20 Nov 2024 21:59:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15C1C6B008A; Wed, 20 Nov 2024 16:59:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 10CC36B008C; Wed, 20 Nov 2024 16:59:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F15D56B0092; Wed, 20 Nov 2024 16:59:10 -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 D37A26B008A for ; Wed, 20 Nov 2024 16:59:10 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 78CD51C7303 for ; Wed, 20 Nov 2024 21:59:10 +0000 (UTC) X-FDA: 82807837980.21.F79F02D Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by imf02.hostedemail.com (Postfix) with ESMTP id 3BC2480005 for ; Wed, 20 Nov 2024 21:57:29 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AL+NC9NM; spf=pass (imf02.hostedemail.com: domain of bjohannesmeyer@gmail.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=bjohannesmeyer@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=1732139856; 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=Faap3VyEdC3wzioh+4CPsVXtj2eSEp6gz0ge1phVFWk=; b=OaMlCdcx0Td2M6UwBMATgtkalPC/XqoMExY1mlRFxbB2eneun/iYZcINatQovg/ruFLprw WJ9EMvxlA2kX27LLxpe1i4E9oSClFjig1uHwF8YZhgvc4yLk672G7IsgVgoGueOpk0Vqdb Mv91bZNVU+Kq45JLGMraIvujRQjPIe8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732139856; a=rsa-sha256; cv=none; b=oJcx+Fk7Q2EOPF00EkannS05cjFkNQV3wlNBqcp5WxWl+CE4hYR3XKFtu7hkutG/1TgSUK Iej5bCc3oFG2UHAj85YZRKOBEzdtNRnoETYbm+WzEoD8rZArWFsQ0llfN2GdfutChCOOsv /nso2NwOssfp+OycilsyzvMiykNz4ek= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AL+NC9NM; spf=pass (imf02.hostedemail.com: domain of bjohannesmeyer@gmail.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=bjohannesmeyer@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a9a0ec0a94fso39179266b.1 for ; Wed, 20 Nov 2024 13:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732139947; x=1732744747; darn=kvack.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Faap3VyEdC3wzioh+4CPsVXtj2eSEp6gz0ge1phVFWk=; b=AL+NC9NMDgAgSfeCI8zdDZErhUeRMtzyELaWUeJGid+NvErn6gBAjTn4uirHOqZHsh GRc9HCIjp236hiCze6v1cS0CXVjiuwlJ59TdhicA4luVkHBIuU2rlKCxg6E4ZZT/+FdU ejoNEJ0ULHXMvxE+Z8mXgUJIXYdWnDjsdQeO+XDUEXsyA92RfUty4S2cxfy06a7Izx49 /iCQw4SFUEGHB6BKzEktVCt+R0gG+H3VU4NnZfS0Yf/7NJ9v5pGDEzB9NaHKgFlCZ4PJ IVmxNgapMtCdMdlCJGqjl1kU/vDqsBNAO/6Lm2hA4q2BxkpmnHT5WSdDBt3VV6/oqVLK sjww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732139947; x=1732744747; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Faap3VyEdC3wzioh+4CPsVXtj2eSEp6gz0ge1phVFWk=; b=KNEc5HVk602J40e6cBIDD23F5S6yRWNg/X3S44d10/FCPuDPnmiJwgMCvZ5EtWUOX+ W1KRtZLWLy+SHOBIq6VsXhruEblDLcLC6jXGPSDl1QsdEpiRT6m9MLliiakIiL+A5Nsl G0qO+OfIwDZa/45AF4js7N2C0Fd6LXD+/mVAypN6PSepS4AadXKtbssJqHxYSlFtS8w3 QBk46tzWvzVuikscmaM8CvdJV0IikoZAf9J2v9PEUnn/J/uK9a/ZfBL/NnS03dgY/tYg Knfy6PKHTwvjoS3AQv8Z0GOWa4NRioLObBo3YMOgiZFbyAAq85gVOSh864jiI1u9r6gS U4Fw== X-Forwarded-Encrypted: i=1; AJvYcCUfEBAjW5ZeYcKJOJA+SN3b/8udGbvszG5lL1ByqcIxV3uu4XdkrGAl1cJ+FEk6B4h85d6AjS75FA==@kvack.org X-Gm-Message-State: AOJu0YxYI46TYWhXe3UnJHVfj6rQcLGt4IXILjkoiYgAmcqY3Jcta1/E bWuSU7UI4mvHI7m/ThBqD2oyVnwaV+cZl9CBTrxyIsIKWGwHjIX/XGMxv1b6pcl5YLi6iaBEs07 MrOP2x57geaR3sgIAlLwRCawpmzE= X-Gm-Gg: ASbGncuOHo8HxAUhr5jymHiblbvwSOyqcIGgVMIqoFOnnYde0W9VZxSq/0eqOhmOjur ghS5ZB7eWU01YUGUBaSdE/6SG8qP6cCE8 X-Google-Smtp-Source: AGHT+IHluJPs2mffu5jOBAkShUEdZ9UhfbGkDRkJHNXVm15+4lFadUuU35lLsiKlOViUyZuNr1PrJYnEFbJa5qxoxEc= X-Received: by 2002:a17:907:a4b:b0:a99:eedd:6466 with SMTP id a640c23a62f3a-aa4dd552290mr466855366b.19.1732139946936; Wed, 20 Nov 2024 13:59:06 -0800 (PST) MIME-Version: 1.0 References: <20241119205529.3871048-1-bjohannesmeyer@gmail.com> In-Reply-To: From: Brian Johannesmeyer Date: Wed, 20 Nov 2024 14:58:54 -0700 Message-ID: Subject: Re: [RFC v2 0/2] dmapool: Mitigate device-controllable mem. corruption To: Keith Busch Cc: Christoph Hellwig , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Raphael Isemann , Cristiano Giuffrida , Herbert Bos , Greg KH Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam10 X-Stat-Signature: 439trh8o5cpb1jbzajb1aszdy4k97bct X-Rspamd-Queue-Id: 3BC2480005 X-Rspam-User: X-HE-Tag: 1732139849-583757 X-HE-Meta: U2FsdGVkX185kBEhg9fYKYKNZ64sDkPFqMIVQyxJxY5F8ygl4/JD4oPb/EG2Mk380z2+1FdRCFVxcUK31soBlYK+pgCrOjVO2oFBxSr2tsf63/yXhnIsxhstILS1pA2yB+9kCSwKyQfpgkSk9AakMffzdMo2WvWHk3KffGmmK8qQKJCJYR4Dup/aGCuJuO1GUtv8d1yWEgqtnm3vXbhLcbTK48krIZCwQZUd98r+udosJpiwOfU9jKwqi5RGHJIV3h0dHklvbTLOgZbHqZuMss4XKFzt1Fw5FcfhIBm0FCeBnolxTtCF2C/ZGylAfvrsOHjoEaM9SB0LaL13FdHS2vQIx7t3v/BGYQk71HDRlmTTBI+TTG+lhYCJjFsEsipJVJ5QcKOkZYClFrsdGm3OcLpV2gMBGYxbLVICjq0i5xuhlzzM5/OVyfBCW0iw4RQn3l0WEq2u1o232osQn8OMJu5ziERC49ANudG7a8q9yTutjT7xWV47kwiJaGsJn2JviZM6K1YlrNCVWka9XS6DKJGDUm9ElbB0Gkg5adE3tKowwfRecM9nwUvjC68DCWUeohPEMyVq4JTXkiYD953PiBW18HbKmZ2m9EMhIRKHxKqmSZxz0W4au2BDns5jLzO2iDcRsvOvbIuKpLo77UnRDDIKZtjJjhARgpMvLfawBnWy0bmDRgegiHICdh/cig5bVKfwDyvbhFVSfn1i73NReDG8vOnVUrLFqDwWv0HxWePzBw/giFxhK9PvWCjki3r/BGTwJW6x3jP/0Xza667u/xd9DYd891JSeB6TaPBt+9d+kjnmVsQgI0l29ZqbiF1baueZB2NLt9WT4rzfHuXOBFLvb25btEDhnNFOOLpGSFGrJShczn8nZDMDxs87LD3R285rCXCPz9wq/PdHOwI8r+VVdL+iKJz7kCtay+AwVuQpTBFJZEZs5Q1+YZG+TNrC6733Mu1V+mfhRDoebV0 wx7QC7Cj WLvD1iawXiWW5oHaRpRpFYQF4Rh2SWACkSSsqkuk41oUe5kTwv0GJk+m6PD8Gf55Ei9N5iFJFc1ys2u3ZUE8oYCNSgG5MygWdfWEJFRaAnAeiKrSGNq4EkeumNSXfacvb2nG8JQMAYCVD/D5JPBtIIEYDoifJEg1F4XF9veeOLJaHp3cfGdHSWrObDR2uWbHBhHAZYreOwqXdK10H76aKw3t/wfAllb1wcLheDRZCii0x+7pD8zRihJmqgsaRYDXvsPAx20hp/uIwWQxaFNznISb+tcwo10QpuZfjNVb3y5BMO/DoX2uIgGbLKfoNmZV0wgZK X-Bogosity: Ham, tests=bogofilter, spamicity=0.000539, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: > You should probably Cc Keith as the person who most recently did major > work on the dmpool code and might still remember how it works. Thank you for adding him, and apologies for not including him initially. > The intrusive list was overlayed in the freed blocks for spatial > optimizations. If you're moving these field outside of it (I'll have to > review the patch on lore), you can probably relax the minimum dma block > size too since we don't need to hold the data structure information in > it. I see. AFAICT, relaxing the minimum DMA block size would just mean removing these lines from `dma_pool_create()`: ``` if (size < sizeof(struct dma_block)) size = sizeof(struct dma_block); ``` > Could you rerun your tests without DMAPOOL_DEBUG enabled? That's the > more interesting kernel setup for performance comparisions. Sure, that makes sense. Here are the results with DMAPOOL_DEBUG disabled: **Without the patches applied:** ``` dmapool test: size:16 align:16 blocks:8192 time:11860 dmapool test: size:64 align:64 blocks:8192 time:11951 dmapool test: size:256 align:256 blocks:8192 time:12287 dmapool test: size:1024 align:1024 blocks:2048 time:3134 dmapool test: size:4096 align:4096 blocks:1024 time:1686 dmapool test: size:68 align:32 blocks:8192 time:12050 ``` **With the patches applied:** ``` dmapool test: size:16 align:16 blocks:8192 time:34432 dmapool test: size:64 align:64 blocks:8192 time:62262 dmapool test: size:256 align:256 blocks:8192 time:238137 dmapool test: size:1024 align:1024 blocks:2048 time:61386 dmapool test: size:4096 align:4096 blocks:1024 time:75342 dmapool test: size:68 align:32 blocks:8192 time:88243 ``` These results are consistent across multiple runs. It seems that with DMAPOOL_DEBUG disabled, the patches introduce a significant performance hit. Let me know if you have any suggestions or further tests you'd like me to run. Thanks, Brian Johannesmeyer