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 810CF456F4; Tue, 30 Jul 2024 14:04:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B24DB40616; Tue, 30 Jul 2024 14:04:11 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013002.outbound.protection.outlook.com [52.101.67.2]) by mails.dpdk.org (Postfix) with ESMTP id 9E02F400D7 for ; Tue, 30 Jul 2024 13:03:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nPbPpE3319b1Ul75ZxnKOQ8SMfEjYqIigFTWwoGdNq0VUhYqe05rKorgGDkSGvRhxQZQ/Dj5BmGYvvKh8VXTOlVkvgNU1F12u+pmr5jQOMNZJbOoeScbJRKzHRwqOs6jiuc57jfDkNZpre7YBME6BloXjYi3cFcDR/+XSEjln3qSU4isQqmaLUZKanMUcmOiklpcanP0zHeD/D6VrG6igzELM9fMcOGauTC0cneoWlFJcGxflPdMRcxBKOdGQmxVyM7PP9r6F0VwpKTmcVD1XdI0tiqkF70Ubd+9vB0q2zgRTgyV71V2HV5Kni1HujBp/eCXLTYN3ZKqFA+12NnRbQ== 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=pqsTftf2gOlJmeNdGmTfdgJvS1Kw2R4Ab+YlOfJsTm8=; b=qI/TO8RB2FwMu6B7jae9fS2NmUcvLd4iQezgUzK79N4enpX3GuM0H96NLh/nqUewl/sYzQwm5UGXlxzdtTg9rn180vdytcaBDQnz1YXzpWa+NLx1aBOrodHQzw8rhLMPGtPSh9vtdnhjhK8lD9B2OSLhz73Q1S9GEsJjiJhBTs0Fcr0ddNqpBYr4qgNzSMAiQoSlmLZ96/CjcBnAiUCsAsfj/Rh8SI/R2SPaXawr21+ZxKJmmEAdfSN2GXMC5ox0FtWU8w9HjZcrdq7B+sphL+b0v7bu2/kVUiYwF+y0saWNOk+FFQmwb+mKWiJGt7Mmzy+PTRB7F67fe/TPjoXCWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pqsTftf2gOlJmeNdGmTfdgJvS1Kw2R4Ab+YlOfJsTm8=; b=lRyZTH4FL7X09czC79q+DuCiJdMHhiZLC2jU1ojWQqYJEGmGbq22JvOeHNHCQRWQBzaGAdCx8ZdIu7EnqFqUJzOezj3oaxQUmJ1FKuOtxUhfTloQhUjdpfI8JsBAxOB5NtLdY/DCJR7qz4xT+Z5FvHbBnb2+rxJlXmDGuQ9OJGFlgLl4qTZnCrpExx8d4QHvgPVTK+BPLfTH/eYDnER6ArLYfBEeqb9Vn3cf3TRnReCFWB6ru6wBcYHpqtBIb9j38gE3e3lzohpXm2jdRBAIZfksR1kA/rGvf7DAfLrQgrwRuufSq5/KrWH5vJU2wiBDSQHxOn0b3x86Aez4CBLXjQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) by AS5PR04MB10018.eurprd04.prod.outlook.com (2603:10a6:20b:67e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.26; Tue, 30 Jul 2024 11:03:31 +0000 Received: from PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f]) by PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f%7]) with mapi id 15.20.7807.026; Tue, 30 Jul 2024 11:03:31 +0000 From: Gagandeep Singh To: dev@dpdk.org, Anatoly Burakov , Tyler Retzlaff Subject: [v2 2/2] eal: add total memory size in memory dump APIs Date: Tue, 30 Jul 2024 16:33:13 +0530 Message-Id: <20240730110313.2555473-3-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240730110313.2555473-1-g.singh@nxp.com> References: <20240702131436.2873832-1-g.singh@nxp.com> <20240730110313.2555473-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0021.apcprd02.prod.outlook.com (2603:1096:4:195::10) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|AS5PR04MB10018:EE_ X-MS-Office365-Filtering-Correlation-Id: 57c4abd4-81e7-470d-4cb7-08dcb0873f74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?+5p+N8HRCUo5W0dE+nCf9sqTsjSy0Ca7vhvMvuiJshpTHyATN34vDt0WcuMe?= =?us-ascii?Q?eE3/xQxoB+oir32fGwAB13cZQZqqjwxaRb+zF0bLKR9O8ebvzDXo7Qtl+fhI?= =?us-ascii?Q?OccACAnnUNwPC9k8pLKEqkV5J9sSoDa0vvnwsSWhh0IbQlIqeuBy6DPLv37X?= =?us-ascii?Q?wnbWP0dX3zGwqEbwUbZNhTgf91/2jEkazF8qKGUIiuvNyijyvWb8/P8YW58K?= =?us-ascii?Q?lNVJIQA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ZwfyY5MhV3NrIE?= =?us-ascii?Q?zcWeiBW5nvI8PaJ6YmDPaRiY0Z2QjdUbJPCprwDQzjOTY8rQXSBi+lvnKHNr?= =?us-ascii?Q?0YGUtNENNDJ2a5F88zp362wWJpKQLp8dTpyIOHROoF/LNYJyOtOD26AT6oct?= =?us-ascii?Q?Evevm1MB8IMKy/Y9fzt/dnnl0TiJVZAnMUZAcqBTIrlmusiJ7zrCbkw5gjr0?= =?us-ascii?Q?B8MQnO9R3BJPUGb9YOxACerxVi+Wpfom5DDyO7DH3emEphvOET1XxqQOxYay?= =?us-ascii?Q?PQDDDOQ0CNjYk+tX9VaOEMpVkGIfTPCLduSFpATjnF1Vm7KKvA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8205.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?AT52oN68YDrrsBiWLGKqV7DhlVju+CMnG4x4XsOxEYX4aroIHvlYQ5rrYPo/?= =?us-ascii?Q?wnVxP+nO4eBYB/lXqKCZqqJuSAbOWFQL4VmAvzVjuQki2xizjk3QAZlHNFTH?= =?us-ascii?Q?mqVPOqcleenbxogtUjtjIZVafoXga3LVuTfjotVXdt9kg4aTBtr0AJEAYSP1?= =?us-ascii?Q?pAoOw2jKJoczCtLKb+RGSt1X1omp6cQei4xmy4wUr/K5f1L+xtpYOM0F77Yi?= =?us-ascii?Q?XXQe/um0/BE3vwtHopICWHFy/MBJqKazYMlAXLNoRgo6gc9o/goPq01AEuvb?= =?us-ascii?Q?WdXoO7P3+Lmm1xEAnycw1lsdyubcSfbxqrmMayQMxlsNNBLARIkEeZyzGDb3?= =?us-ascii?Q?wNKFLLwLJHtQnSZgNUE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o6?= =?us-ascii?Q?54h4XCVJfFTWt8Q1jOxDmirZ27xs+N1WI/Y59wKonmcmJUm5ei4qxgwV9+gb?= =?us-ascii?Q?bZr7vT5IhOe4SEeq7YunDOmMnncfY9d+00UvpoooZoqHITuqD9/DFo1bmv7U?= =?us-ascii?Q?Q0GTBmrZCYSf0HHPJv4fSPVNds2DbDUGrY3zBFsMHjKmH5vzDU9pMQJqsxYC?= =?us-ascii?Q?NUgt0yAjY0nNZTVnzxh+9Q48nauAbPEaUl6dqG2o8NS1dupsB5puTPfH07xw?= =?us-ascii?Q?2MM7h+Fu0PETF2Vc+GHwCwdyTF0Ux2QY25dycxn5SkvL5UOJ5/ru+kOWbwlR?= =?us-ascii?Q?OmCnMFCKG/CP+3r3oLth3Za7Qp7rETbuBwz2qr1x?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57c4abd4-81e7-470d-4cb7-08dcb0873f74 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 11:03:31.2985 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Wg+BDJJUljj6lLS3Q8ArjjdOZKvMjLBEQBxEqggbvwWb+0WSuEhYEUk1lB3PRBOY X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10018 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 This patch add total memory size dump in memzone and memsegments dump APIs. Signed-off-by: Gagandeep Singh --- lib/eal/common/eal_common_memory.c | 2 ++ lib/eal/common/eal_common_memzone.c | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/eal/common/eal_common_memory.c b/lib/eal/common/eal_common_memory.c index 60ddc30580..c6b9c16617 100644 --- a/lib/eal/common/eal_common_memory.c +++ b/lib/eal/common/eal_common_memory.c @@ -531,6 +531,8 @@ void rte_dump_physmem_layout(FILE *f) { rte_memseg_walk(dump_memseg, f); + fprintf(f, "Total Memory Segments size = %uM\n", + (unsigned int) rte_eal_get_physmem_size() / (1024 * 1024)); } static int diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index 2d9b6aa3e3..4cd077d8d8 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -58,6 +58,11 @@ rte_memzone_max_get(void) return mcfg->max_memzone; } +struct memzone_info { + FILE *f; + uint64_t t_size; +}; + static inline const struct rte_memzone * memzone_lookup_thread_unsafe(const char *name) { @@ -367,7 +372,8 @@ dump_memzone(const struct rte_memzone *mz, void *arg) struct rte_memseg *ms; int mz_idx, ms_idx; size_t page_sz; - FILE *f = arg; + struct memzone_info *info = arg; + FILE *f = info->f; mz_idx = rte_fbarray_find_idx(&mcfg->memzones, mz); @@ -380,6 +386,7 @@ dump_memzone(const struct rte_memzone *mz, void *arg) mz->socket_id, mz->flags); + info->t_size += mz->len; /* go through each page occupied by this memzone */ msl = rte_mem_virt2memseg_list(mz->addr); if (!msl) { @@ -412,7 +419,14 @@ dump_memzone(const struct rte_memzone *mz, void *arg) void rte_memzone_dump(FILE *f) { - rte_memzone_walk(dump_memzone, f); + struct memzone_info info; + + memset(&info, 0, sizeof(info)); + info.f = f; + + rte_memzone_walk(dump_memzone, &info); + fprintf(f, "Total Memory Zones size = %uM\n", (unsigned int)info.t_size + / (1024 * 1024)); } /* -- 2.25.1