From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8937441B7E; Mon, 30 Jan 2023 10:23:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4634440EDE; Mon, 30 Jan 2023 10:23:39 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) by mails.dpdk.org (Postfix) with ESMTP id 41D2240C35 for ; Mon, 30 Jan 2023 10:23:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ca6VZG7xp2CE73oeVLhh4q2b/D7U7JfEL0nOXow1BEqVCNJRIF/5X4uFAcr9vlJNH2exBBY3nvLXeQumT9vBs09z7IF4TOJlmjjbvGz8AhLpBFmOXnrnCTz6xVEZyC7LWmP1xQkaImErK4fdi35foqMiZxSx8iS+3ED4zasoPbZkucpPlKART5YaPpqV9vxzM/bOFd26Je0kmaeVjM5P/jE6SizYBiGxnGvZP4Nq/gjs+pz5AfU0QqfM7ol72r4O18sRZgjjalSgGX/NUYr+xh0DVEt17YSaVyVDGo1OY2y4vUnwvvTNOQ3+lTcxWAisBNnR6j8U214GuC251JfsuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=OyuYwbSoReGEVxpJbRsNmDnMMxAUZaAfBG9KXJYKxs0=; b=jYhYXuYP+zrwzDfkrLnv8NrYU3Y29FuMfjyF3iSTMRKYKPhqMuv57pRxfuIcueirvtFqXJPJBg/j+VJVCDwSogOR152gAjtZF3UcySNcoeyxYkGa5/rgN4iIYKKzFm46gfKS01jw0x9NOfXrC1Eyo15KoU9I0A2ow6JZxMTzHoKXnpYf+VPfgQKx26MMVdSLVvc8PSc+aJ6QERL/vbxx7QrdWULxYwr+dKEeT7eeD6Mx+O9g8Ei09r3u3E/oZq+rcxjgHCYFgO2Ff6VaUIeN605klfXCiX/hHREqSHnWcgiKuIsmAt+CDLn0RG28gHL5BqsPtZmdod5Q8/KEqHfyXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OyuYwbSoReGEVxpJbRsNmDnMMxAUZaAfBG9KXJYKxs0=; b=r84z5iQPAxCxHX1fM+1RBgzZSnuHT8Ddk0gUOSjZwz+egyWRIa3GTJRf4L6vO2F7Oovuc5qvYKZMRbxuiABYMTUwYyb2Cnyk6FawekojVSz2j/SnZ0aEQADGwq/sxiZWyVcfc4b8Ba8U1MfqViRT9Y4ZhSWm3qWN4lKbpgvWQec6Dqf6a70MNSEEwf4RkKOOMXj6J+k47rUSzk1LuSpD4JHi92bXDQ54F2RBmZ6JnGmWVG+fHqaeVBc4gwGNV7VPjDHfzWV0f92eG/sM+U0yBQ5tjHj3Mz3ZgBAYpUuOI8stLi1aULdFbKlfQWuWm1YCZIFDQMXxCAtFxFmqCCBCxA== Received: from DM5PR07CA0095.namprd07.prod.outlook.com (2603:10b6:4:ae::24) by LV2PR12MB5773.namprd12.prod.outlook.com (2603:10b6:408:17b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Mon, 30 Jan 2023 09:23:35 +0000 Received: from DM6NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ae:cafe::24) by DM5PR07CA0095.outlook.office365.com (2603:10b6:4:ae::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36 via Frontend Transport; Mon, 30 Jan 2023 09:23:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT014.mail.protection.outlook.com (10.13.173.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.22 via Frontend Transport; Mon, 30 Jan 2023 09:23:34 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Mon, 30 Jan 2023 01:23:26 -0800 Received: from nvidia.com (10.126.230.37) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Mon, 30 Jan 2023 01:23:24 -0800 From: Ophir Munk To: CC: Ophir Munk , Matan Azrad , "Thomas Monjalon" , Bruce Richardson , Lior Margalit Subject: [RFC] config: customize max memzones configuration Date: Mon, 30 Jan 2023 11:23:02 +0200 Message-ID: <20230130092302.376145-1-ophirmu@nvidia.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail202.nvidia.com (10.129.68.7) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT014:EE_|LV2PR12MB5773:EE_ X-MS-Office365-Filtering-Correlation-Id: 3154524e-7bb7-4b16-1097-08db02a3a998 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3RAjCucM87C+gLmmequeN3YPCvsaUWPgfHndNLuOIztl+CQ+GUKSBS/5fnzDyFA7VtyzgUm/7uVrkWkVxpLY1s/Gf/1a9Nxg1FFmErma8NnsD3ejykKucCAzCneMAcdidNELv55VAhMhqBWcsaQ3hXqUYu0d5Jz5SqJv19Wo9Gqy4im4Wgoo5f1z3/tVIGPt+s8XcNbs+9uRw3lr44fM5jVJZuzR4Q3rR4EvYtIL6R1/CXFfd011HH2HiveaKJPtJuY+NKldgVPTh6meysyYoy9b8H9y4CsTnXRXaW+5yHQkM/gjouEc8sWbkTekxvXkTGdRFSwim+IN5YyIrItuvS5PisiYSLLg32v9RAXgD9/KGQpCM/W+aY3lgnvUsQniG6cmIi8Hviqc5Ok5f2e/mVZnwyNQpvKhGNwQFcZnE5G/VLXAY8nbYHxTPdgBsousDNDeSVqNlCRAx8GOsqAckCyqbbPxlG4zaWVX25ml+9xdSBMQj30VJcrmgGyFmeg05bHpDpPcdTDAC/mgc9ldc9wmQKiZnJYVS8TOZLm6vbUvUXT37xWxtsKx4ts9WKMHveYgRGUKuNpkrbJoO3GD3+To82y0V73ajQqeOXUGE0Ry3EPaDcM9n6NP3ptye+JekqYIU45+D4qLmD9iqh/lrQaTWEDQKT7+jhZ/KX5UBkcy/zgfbhlHF9zawf0Li4Pff46Eg4IpWaaNMwqngrAtbPKWDXrunfMoc0ZmR303M5E= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(396003)(376002)(136003)(39860400002)(346002)(451199018)(46966006)(36840700001)(40470700004)(86362001)(356005)(82310400005)(478600001)(36756003)(2906002)(54906003)(7696005)(107886003)(6666004)(41300700001)(55016003)(26005)(8936002)(40480700001)(5660300002)(316002)(8676002)(6916009)(4326008)(70206006)(70586007)(36860700001)(7636003)(82740400003)(6286002)(16526019)(186003)(1076003)(40460700003)(47076005)(426003)(336012)(2616005)(21314003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 09:23:34.9891 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3154524e-7bb7-4b16-1097-08db02a3a998 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5773 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org In current DPDK the RTE_MAX_MEMZONE definition is unconditionally hard coded as 2560. For applications requiring different values of this parameter – it is more convenient to set its value as part of the meson command line or to set the max value via an rte API - rather than changing the dpdk source code per application. An example would be of an application that uses the DPDK mempool library which is based on DPDK memzone library. The application may need to create a number of steering tables, each of which will require its own mempool allocation. This RFC is not about how to optimize the application usage of mempool nor about how to improve the mempool implementation based on memzone. It is about how to make the max memzone definition - build-time or run-time customized. I would like to suggest three options. Option 1 ======== Add a Meson option in meson options.txt and remove the RTE_MAX_MEMZONE definition from config/rte_config.h For example, config/meson.build # set other values pulled from the build options dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores')) +dpdk_conf.set('RTE_MAX_MEMZONE', get_option('max_memzones')) dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes')) meson_options.txt option('max_lcores', type: 'integer', value: 128, description: 'maximum number of cores/threads supported by EAL') +option('max_memzones', type: 'integer', value: 2560, + description: 'maximum number of memory zones supported by EAL') option('max_numa_nodes', type: 'integer', value: 32, description: 'maximum number of NUMA nodes supported by EAL') config/rte_config.h #define RTE_MAX_MEM_MB_PER_TYPE 65536 -#define RTE_MAX_MEMZONE 2560 #define RTE_MAX_TAILQ 32 Option 2 ======== Use Meson setup -Dc_args="-DRTE_MAX_MEMZONE=XXX" and make RTE_MAX_MEMZONE conditional in config/rte_config.h For example, see the code of this commit. Option 3 ======== Add a function which must be called before rte_eal_init(): void rte_memzone_set_max(int max) {memzone_max = max;} If not called, the default memzone (RTE_MAX_MEMZONE) is used. With this option there is no need to recompile DPDK and it allows using an in-box packaged DPDK. Signed-off-by: Ophir Munk --- config/rte_config.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/rte_config.h b/config/rte_config.h index fed174a..ca653cc 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -35,7 +35,9 @@ #define RTE_MAX_MEM_MB_PER_LIST 32768 #define RTE_MAX_MEMSEG_PER_TYPE 32768 #define RTE_MAX_MEM_MB_PER_TYPE 65536 +#ifndef RTE_MAX_MEMZONE #define RTE_MAX_MEMZONE 2560 +#endif #define RTE_MAX_TAILQ 32 #define RTE_LOG_DP_LEVEL RTE_LOG_INFO #define RTE_BACKTRACE 1 -- 2.8.4