From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 271D0A0559; Mon, 16 Mar 2020 03:55:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 23AF025D9; Mon, 16 Mar 2020 03:55:21 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2069.outbound.protection.outlook.com [40.107.21.69]) by dpdk.org (Postfix) with ESMTP id DB0C1FEB for ; Mon, 16 Mar 2020 03:55:18 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YhTbqkMdLp3lPjN2MJxaaP/HEnUCWapshL5vq7ckOWva9y8zgdfJ9tc6/Cfm+wrh8FIykHj7JCt9PlDOGqQrUQ6dzETGi1qFBTI6G1rFCVQB7mOIc2Hq1/jnyLiCkcB9MhKO03b5X6RU6kKThR9G4xLumlNBCJsKwhTEX7Q0l2staSVB6wkuyhrPnw+RJKZPzYIs3W5ev6doVuwt26DVgNH96n6x2M1hRP/UFqvTgw+nDsoZECxnJ4ZbkStuebmI20D4XfFupSQvq+7MLPz/JbbN8/TvSvLk9OaXkhzhKPZ+u5fMvAjUjMaF0XCchFfWiBDJNVcYkM5PurMFWfQLOw== 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-SenderADCheck; bh=H/p4umHuY0qBgePdQX/x1XlwH1+nt7N53NZWki9eA+0=; b=Bz40QRkxZGw1bNjgGh2JsT37KYNrNUx9HmPcyjQlzMDdzqd1/N+Xe0rFKnw14wJueUbngM4N48A0l6q/z8VDTrzzrhTKOD+V7lAP8czw38fXS5UGUs78SBhsRM0XPQ4j9PkpWDBbKiHZMhHQP2XF2fNGI4R9CEYmKONl49tqqjCd79ji6kavV0Kh+OLmU0q0z5keBncdp5OFrVYz08ebnnTgFO9xSTkQqcU/5zDyButRW53qjuHbw2c95vkUo+G+AlzZEf2TgX/X3AF8SNXphJ7ouy7syhIClVy24yiaRnKCFqbYUFwDN79K6geT1LMaU7HOhcAuj/JGZdifVwDxsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H/p4umHuY0qBgePdQX/x1XlwH1+nt7N53NZWki9eA+0=; b=kGCz5btZCmTNV+K5NpIk8MC+XI1GPphi7PrzYyCQdiy1CVGut6dSthYldigSARCGMHClRzVm9F5K1rb4lmlfp+3jw337DWYbb8DgaAdQtGYJj0H938rCH2pZSb+AW06x31iyQ8lRhzd9xYQa9xeUHEikuV64M193IHFhO/J2mxE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=suanmingm@mellanox.com; Received: from HE1PR05MB3484.eurprd05.prod.outlook.com (10.170.246.12) by HE1PR05MB3339.eurprd05.prod.outlook.com (10.170.243.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.22; Mon, 16 Mar 2020 02:55:15 +0000 Received: from HE1PR05MB3484.eurprd05.prod.outlook.com ([fe80::e44a:abcc:6e96:cb00]) by HE1PR05MB3484.eurprd05.prod.outlook.com ([fe80::e44a:abcc:6e96:cb00%7]) with mapi id 15.20.2814.021; Mon, 16 Mar 2020 02:55:15 +0000 To: Matan Azrad , viacheslavo@mellanox.com Cc: dev@dpdk.org From: Suanming Mou Message-ID: <176d3eb4-e591-1609-a7b9-0bfaf9a7fa25@mellanox.com> Date: Mon, 16 Mar 2020 10:54:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 Content-Language: en-US X-ClientProxiedBy: HKAPR04CA0005.apcprd04.prod.outlook.com (2603:1096:203:d0::15) To HE1PR05MB3484.eurprd05.prod.outlook.com (2603:10a6:7:2f::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.99.168] (183.157.75.112) by HKAPR04CA0005.apcprd04.prod.outlook.com (2603:1096:203:d0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.16 via Frontend Transport; Mon, 16 Mar 2020 02:55:13 +0000 X-Originating-IP: [183.157.75.112] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d09f80cc-c3a1-4675-e8fe-08d7c95573df X-MS-TrafficTypeDiagnostic: HE1PR05MB3339:|HE1PR05MB3339: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 03449D5DD1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(366004)(396003)(376002)(136003)(39860400002)(199004)(26005)(6486002)(33964004)(66946007)(186003)(2616005)(16526019)(956004)(66556008)(2906002)(31696002)(66476007)(16576012)(316002)(36756003)(6666004)(5660300002)(81156014)(86362001)(81166006)(8936002)(6636002)(52116002)(4326008)(8676002)(478600001)(31686004)(579004); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3339; H:HE1PR05MB3484.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1AMyuCXLT7wvtQnUzL7c8L2hwxWcMmkGDjg7U5oJJ69zF/OZiwBT864+KDsSG//RtLc7iczSx60b/LpM3NhY5mf5rTCrAfbFkECmK2wr9QXFbDJ2KP+cJxe2tqgSKYxgQrvLJA9gkSwwCsXKDT9Vt77jWtoxBHOsNJGz75LNAqM9Mgm/90KGpPKGgaAkD62kmPLyzwpXSnWQ5sDi++O/Ziek8q4tD6nzm0ZL9l4kWb69NXqFYN+yoE2vgo6A9S+yziNNMzy77h1XGBt0aXO41QwSsoOi+X+16RIoZUMdJagLtIe/H6j8tCtvMuQavXs/CYxFbMeCRA8VZjekiDVZhZ5jcxfBd6ejoQRlPB39VEBpoVBuUX/vWY+uomqNZD614zApwB4m4HWFDrUtit/MC7oCT5gxUs26c68Lbtd2exkBFo/pjEmyhwQAAgISCLbO X-MS-Exchange-AntiSpam-MessageData: fUhJRFTjGNN4hVPO05x1Gk1dPLmlFhsepNfqo2RoKooTamrUzzPn3eC3CWUz6TqRe/m6z6WjiKSJoAO4vvgUYFOOgANMyRZge719e6dSUCbMTKyARWEzNbrqrgMO0M3WBXwMIowSJEfnKSvtd5+wVg== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d09f80cc-c3a1-4675-e8fe-08d7c95573df X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2020 02:55:15.3619 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ujOjs7zshn0jyiEVMm/QldjXcoSQFJ73ezbFVylc49DwM/NlmroQgJqORyKYIZW1YrgX2F54H75VhJykM0fUAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3339 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [RFC] net/mlx5: memory optimization for flow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Once there are millions of flows be created, the memory consumption of one flow will become more sensitive. A byte memory means Mbytes consumption with millions of flows. In this case, to take care of every bytes the flow costed becomes more important. We are planning to save the memory consumption with flow creation step by step. Step 1, currently, the mlx5 rte_flow is composed with the mlx5_flow subflows.  The data struct memory optimization will mainly focus on the two structs. 1. Merge the struct members those can be as union. 2. The members in the mlx5_flow subflows which are both same in the rte_flow will be moved to save only in rte_flow struct. It’s not needed to save the copies of the same actions in every mlx5_flow subflows. 3. The members in the struct use limited bits will be stripped to the bits only they are needed. 4. The structs aligned with holes will be reconstructed. 5. Some global limited resources such as port_id actions may not be recorded in the flow data struct to save the pointer memory and only to released when port is closed. Step 2, as flow creation will allocate several small memory blocks, such as the rte_flow memory, mlx5_flow memory, actions memory, the small memory blocks will be allocated from pools to avoid the overhead of every rte_malloc(). Step 3, data struct which stands for several mode may split for individual mode, such as currently the struct mlx5_flow_counter contains the members both batch and none-batch mode. The split of the members will save the bytes of counters in the pool with different mode. Thanks SuanmingMou