From patchwork Tue Jul 30 07:57:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huan Yang X-Patchwork-Id: 13746907 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2076.outbound.protection.outlook.com [40.107.117.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94886192B9E; Tue, 30 Jul 2024 07:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722326314; cv=fail; b=DeW+YM/CU5qflBLZV0NdBfYBdhOpwMJSC6s/aKZ9nZJussanz4MQAKTciASUynQmjBu+svLlbzWPDMM/UVq+At6S2+4CPcqkBaaiUY+IJ6A5+gRIanSk+5sZ3KU7ru11/y4Zuh9rghFkF6p5gk/HmH1mBWSdne4vjEBzS7ePnKw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722326314; c=relaxed/simple; bh=/ulFSipo6OAt7vlHQA53ySXbJgChgaI+l7LsVciRZFQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=lONlpgjsG4m9HCKl48yysTT8IZr7TsVtxu2qTvbRAicDUEwiKsPjVVbPowawgTCIFr4mL5PQSM8/nCWDRDvOr5Tju2TLVkG7E+t5hklShyOX42Bbi5egUC6jo7SIaewLm/DroR5wjGa//TwZkbE4XAI8hZyb9eLnN8OERRNdhGk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=Lj9XAYVu; arc=fail smtp.client-ip=40.107.117.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="Lj9XAYVu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kf7S6uYNuv6kxyx30fnD7OGu0Cs7uZvPiJVPSC+h4A6d/szezgwVLZ9+VpP5tFW2qaipegBWlLS5/Ym11vUqRTOQR7bugk6S13GhPc0JOBTZaxUdkQXwdvdfihjkVjnQM0KJkshLfxLgDbMUDlNO/6ouLxDdVCPK9taGVRRpnA+sC/bTNOfEj4Sq41bzkD52vcidgl5Yb/nY1K3+wtjvk2CKfgamUxilfCvl8jkbbPELape+X+aeakYQ3X+zMo0Ive4UYBve7rz/3OqAQ6b/BqpwihCJJ7Qdv1YsrcIYc1chQVqRHTnoI9YmhdsSwsLCiCCM2ALEBeon5nGIZO1Dpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bMhwemUUoB/3WcjWcxAIFyG/JasZnHDkItVkTKGRmO0=; b=xgjc5uXUQXVGkYzbHX3w+50ObcgBsaEYgpuRyimwVBQWd7lM93WMqw/b6HT/wiZDlHPDm28I0jNK259Jr6OP/1DO2BrFt7htxJBI0LCS9pBGEcVTD8gFWbgUxEjJ7R3Af/poib88A7pNSO7qPJyVMU3d6f7vu96y9r7KSGH6Wp1c2SlWVsb++sq/1yvqDZkUet7duFKCndGUN7V3ShLSAj+uihjNq5VPycdZwjtOG+P+20g+LOE2oCJJ3e9eCg8hswO31P2LOyGfHyA7LKfw/M62kbKGqiZhWbU3rrzZBr/paM896MxywQ2S1Vzrvt3z3/1zFhOOrBbuIUvYR9WxMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bMhwemUUoB/3WcjWcxAIFyG/JasZnHDkItVkTKGRmO0=; b=Lj9XAYVuZ8R6ZsK6zx5iUmEGPzgVqZztdiTqwePe0+mRi9tMrS3J/gxLYaYbNbcJpZg72WcOuYJIEfIku37IdXbVejsYfkTt8LxBdC//QpmCvG+ZVQSf6oH0OMCsU21vzZsCXP3XDDfGtrXTws2BQh3B2OucLK9oOHgFKkP98lCWqavu7cB5AtoZrBuhE+yB4MQ7ahIhG5cvhOc14EIQi2gmyGZFy/tV7kD0Dn3I9iI1c9fzF388pQQlDjDiZHJWisT6t8ZAA4BW263oU06sEF/rEcqOTbakSFt9MdXY4kU76a1ZvpFq6MeDSBoxRC4/hgbPnMttM8k49To89xVIig== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) by SI2PR06MB5386.apcprd06.prod.outlook.com (2603:1096:4:1ed::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.27; Tue, 30 Jul 2024 07:58:29 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::a00b:f422:ac44:636f]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::a00b:f422:ac44:636f%6]) with mapi id 15.20.7807.026; Tue, 30 Jul 2024 07:58:29 +0000 From: Huan Yang To: Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , =?utf-8?q?Christian_K=C3=B6nig?= , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Huan Yang Subject: [PATCH v2 5/5] dma-buf: heaps: configurable async read gather limit Date: Tue, 30 Jul 2024 15:57:49 +0800 Message-ID: <20240730075755.10941-6-link@vivo.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730075755.10941-1-link@vivo.com> References: <20240730075755.10941-1-link@vivo.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|SI2PR06MB5386:EE_ X-MS-Office365-Filtering-Correlation-Id: 99971946-0b0a-4192-4e2b-08dcb06d6652 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|52116014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: kqaTSyl0nuEklRGXrlP6kU9dvC8CrjW13PytQsT3RiGLtmBXfrTROZAvgF/8L9sMyvARcVpm25NcGgcqMnnTP87gtsuSD86DOL52pQM9V89Lx/YE9LeTdc5vw2joHuOekp9kp0VTOpKYtbclcSToLjZzG49cb35mBfflywL1pec4g1BH95tKZ31/AgwWt4H+RLnBV8ZX6VX8E4gYyTlex/waVjzS1gWZ9TG0tIFI5f7f9rkcQlxsBG/rnw8a1pDpM+ee8GpBglzZUYqu+H0edxV8WN2h0p7L821n0YzPt7bXHGxrx4rlzQ+TOL/apfoJ3Uju2SmhBrPx1wG+0YQQ2L4MEF3q8etDWAD6Pf/zX8wWtyr6LXE0TjWqUeIIeKko0BTxPNh3K6u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: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(52116014)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fZqK6JJojZC9m15E9DrjVKd37EPpsoTZyk8yLyqMyq0/eYI3e+qiFCKNOrJGSAEJ5jpDBp5VP1f+OXIktT/RAy2SLXdnyG+4lnrEyToiuidh/UV/3PnpZpjz8mEx0VsCEGtLOOluo7WzcB+KhpM1zO2DueJiSnXDxVXXtoCWAO6wvVg0UY7RFV2oaxt2ND1FwFoHO/+YlV4yE4LAwmm2lAwRFJ/MA9ajA1ovcaAyVQftuogc7TNsYqbnx/65zkAVno5/SKGBJAZHtv/sbpMHpibxDlHAoa5pi5zgT1mjziS0FR8q1viriYIpvM5uPcr+Ci/J2dsjwbyBx4gHLQcMwr+0xVqBDA3AqEwSgbt9pUpBSY971O6fkhA3HY+PYrD6jVVWkSjdTJ/WIf6Pkq6gygpuR7M2g4L9z4bd7aZ810q6ozNe5ErsoJKG1mSXHC9fcMr0W0saqoBG4JBdr5K+udi/uLrdg0V0U58Olzn45wGfJ0vpaW3jG/SkESspxALZ3gosON7MDUo02FQ7doVV5YU2moOzlK7b8J0wnIXfTWkJnxQSqOr1OrgXS01dct79OpNeqJYcrEpUY/kwztHe8WBJblpfDTXZgtvbUeHoehfFCbdHFCoSYzDb3ZbQTYpeAYWKuc7+vnznrLb/SVBdiI1m9tZQ0TSpvCd+3rSpkwJJxvl/OoEnnL4VdB9fI+19NXYbuBXEGFWz720gq9xtzjJqMP31OQu7fvuKVLMtdxhTX41S/JmKebygjlwLM3PYG8o+cI1oil0VCAa1Ga6fDZhhMGNO8ueDcXb2ueCWgq106gxtg4S2fch/tc+eQW1h1PwSzFZpjwBB3WZZJQxfK+cNdQ65WSG2UpnL/9owXKNc3qBf/NyLsztQr/YNRW8YBppAa1LK9mqFVE9/PnlrZgoupDTsFBsNCx1lYbQQhHKuXBU5NwWGpkZnta1AVEs73Y73hgijbW+rN61SHG5sPXWOoNIvDPaeghjwLqtlTW870zViOPD7X5veemo5Joh8Gi5bPZkmiA3j4g/S+HpeUQxOYaCt6+HfcpV98Zh/Jcn8TsBzGR7DsYViBfAbLl+ksfggmkh1mxmlsSrHce0bU/igT3xTZ7qNweiIdSqRg/j3UQMetW1s4d/KW/O3df9jZSrmc84HRT+kJQXSIk+wGFo7Usj135i2NaViFlSE1QvwlIoK6EETWNTS808VUWqnaq94oMUPSskdlXRMni0lg5MXJ2V60HfCzbozrO0hXLxW+ncxb5vZglqfhuYBGb9Z9g6AfV+yHYJ2jNIyFPActMygdm6D3EvGIQ5Ge3Akh3TmKCnHjjYIMYXWY0GAORiIjOTQNrQasLziaS0cVyRCslJbyggYoHLkKoehpyiDV816XBvaPJsvJcwKOv1QDRR8R4vVqOsDfhHti6jLV/DUgHyeLAAxqWfXmsXHJ/ayggNdBzrVIumTUqFaDXmWnsFOgdlrIYQprS7G0t7/KzoHUc9ezlKmzR8CShWDmrw1MQMVP2y+5ZSt0MMdfPaW4lljsy2RAMBFvkMxIDhAycJ3dDjVyyVSwBzNIf9GmrlaZC4hFPOMciH2/5ni7yDn0hpI X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99971946-0b0a-4192-4e2b-08dcb06d6652 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 07:58:29.5867 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4CWGcnBzisIgCBGkZCAx3UWENPTN3tDJ2J4o0x2JGfS16XFkaKq0LMR/hkTiO2VsN117nOGTEzKXdrodMvDOEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB5386 The current limit default is 128MB, which is a good experience value for I/O reading. However, system administrators should be given a considerable degree of freedom to adjust based on the system's situation. This patch exports the limit to the corresponding area of the dma-heap. Signed-off-by: Huan Yang --- drivers/dma-buf/dma-heap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c index df1b2518f126..2b69cf3ca570 100644 --- a/drivers/dma-buf/dma-heap.c +++ b/drivers/dma-buf/dma-heap.c @@ -417,6 +417,11 @@ size_t dma_heap_file_size(struct dma_heap_file *heap_file) return heap_file->fsize; } +#define DEFAULT_DMA_BUF_HEAPS_GATHER_LIMIT (128 << 20) +static int dma_buf_heaps_gather_limit = DEFAULT_DMA_BUF_HEAPS_GATHER_LIMIT; +module_param_named(gather_limit, dma_buf_heaps_gather_limit, int, 0644); +MODULE_PARM_DESC(gather_limit, "Asynchronous file reading, with a maximum limit on the amount to be gathered"); + static int init_dma_heap_file(struct dma_heap_file *heap_file, int file_fd) { struct file *file; @@ -442,9 +447,8 @@ static int init_dma_heap_file(struct dma_heap_file *heap_file, int file_fd) } heap_file->file = file; -#define DEFAULT_DMA_BUF_HEAPS_GATHER_LIMIT (128 << 20) heap_file->glimit = min_t(size_t, PAGE_ALIGN(fsz), - DEFAULT_DMA_BUF_HEAPS_GATHER_LIMIT); + PAGE_ALIGN(dma_buf_heaps_gather_limit)); heap_file->fsize = fsz; heap_file->direct = file->f_flags & O_DIRECT;