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 B33FB45AFE; Thu, 10 Oct 2024 09:16:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44B9B402D9; Thu, 10 Oct 2024 09:16:40 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012048.outbound.protection.outlook.com [52.101.66.48]) by mails.dpdk.org (Postfix) with ESMTP id 4EF90402CD for ; Thu, 10 Oct 2024 09:16:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=efbICIwVFr5TzWjsN3kJfQpQUfOTNL+9o7NR2quVsXB1rw1+0pJ5i5+qqxBPUGrk9TKhTA37f/yUEZK+h1wfPCPUQghL3a5/NPK0IJ1xpyNf6XnPo/mC3yFK9vOhEErEZ1akIGPTQ8kuO+YeFzYX4QmVOHX7zWmKPqvgWsviT9ocFYjCZL7lODujroHP8yThxg3Pw6wUuIA6pbEubsntCB3I8lqiP/OtGJZy2Kls/zTNOqXjKlo0OLkJnjdpkliuNZd5AjYw4xTMlSkUrfrXBDSriXFZSQsys1A/1ZSDZageVX9hgKBG9azhCwrKoLcC4bpwMUA0oaJEzkQC+ntq/Q== 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=3Bpy1qIRLqT8+QPlLWWjWwayjnBxhAFnU47gIc9g5t8=; b=oRjkflJ1T8fXQC1e9UytUardjL70ETJ7dWipeGpzMjjWeFMEtVlsTQxMassMYKR5EUurpUhslvWI49K+Ou7PB9tzuOiRhruTgXWMbOrH3qk3FVL5hZ6PiZSAhFUWF53cPwaVanMrFOyVb0F9u+OGy2UA3oDuuoaFwuOIMHfNaSYV7IyMT3YpH07D7dpLtDZVd9ExR+3U5etLiGJVQfg9p3ONg/IX8zxB2VKVPLioF9zsqvHgA5Wp2LP5t+tVmVV+7j/cnSJh56xcR4WnUWera4uxcpyKINL4XkfMGx4afUm9ecyiSkqE1iw/Gfp1SF5TszaD2TVW1RGIzqvoVPIQjQ== 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=3Bpy1qIRLqT8+QPlLWWjWwayjnBxhAFnU47gIc9g5t8=; b=UJqLdqCJ7gKXSIWA76XZNHDynaafmdItWn9mGbySSFEATQvXLi9v9fcHYERpLRcoa+TrKKnviGaTyOCSNFhXG5Z/34ByxwUOzNUv9d2UHOq/sqSycKkILgFKYJBb8kf9c8z5xi8c3iGHKGDX4Qpp6RtY3usbFNOhkAn4KM2bAviB23Oos5oaxNh7K6Zy/QxyFHNYMYUGPNvEt9347O+sbivBBQokXzfvxVhpDRH3LBVmzebhvw9Dxr+vDJCLRfgQdOQdThLLhqdhxJuMjVJwF7Il00xUxenCyUgaSg0K39IeEsrlRE0tcyeStfKhdUhXgdgEqzwoF9rUWG921Sc5Ng== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by AM7PR04MB6904.eurprd04.prod.outlook.com (2603:10a6:20b:106::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Thu, 10 Oct 2024 07:16:37 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195%4]) with mapi id 15.20.8048.017; Thu, 10 Oct 2024 07:16:37 +0000 From: Gagandeep Singh To: dev@dpdk.org, Anatoly Burakov , Tyler Retzlaff Subject: [v3 2/2] eal: add total memory size in memory dump APIs Date: Thu, 10 Oct 2024 12:46:21 +0530 Message-Id: <20241010071621.2461383-2-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241010071621.2461383-1-g.singh@nxp.com> References: <20240730110313.2555473-2-g.singh@nxp.com> <20241010071621.2461383-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR04CA0161.apcprd04.prod.outlook.com (2603:1096:4::23) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|AM7PR04MB6904:EE_ X-MS-Office365-Filtering-Correlation-Id: d519e550-3721-40b6-1dbd-08dce8fb7af2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5sqh0uYTGYf1c0delgcYugC+/2EjpwejThJC22+cgls5QemDPnY9U7Og/uFI?= =?us-ascii?Q?+JRPI8C8uzXtl18IXWujzPiHlF41CvJXPXLgG+HH11mabIZ058LSavBDH4BB?= =?us-ascii?Q?u/5ycbgYdQcNz2QuLi+L8sMZjECf3piz7OGMWH+iD/a4SFUi5hmEYSS1XhFy?= =?us-ascii?Q?JBbY63j5CROBG4qYdxsUqQDk+1ne48GPW+gfWg7LlgsUytlZekBeLU5xQlUA?= =?us-ascii?Q?m0+6NmESQnkb7xzL+cfqGmUrF/FXg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ii?Q?8ck0pGJFIFujdRWPdBaBHw1/E64NEnd1Z2YF5HQ4yGrJx+cvUhhJOl/s2Tpq?= =?us-ascii?Q?roKm/2opqNDdpPsTvUa+/3P9Jct1b2X9AOezH6HoQIGUlgbGM6o41W95urY8?= =?us-ascii?Q?ELYdplamC1/SUkHeVojzOMEKLY6fAS3SY4Lu2yIcWLPK6La29lupbXfPSiy4?= =?us-ascii?Q?37+ZCdlRZoYdjC8tOknNMWaA+qWseW9T0yjyZYDfqyZWyA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?E92BfB9cgvYYfZXeaQ4LdyyOSJi27/wvkIqy8Rk5LVd2LomAFQdqAzZAiXXq?= =?us-ascii?Q?mxjCnlBA1/bWH2n+5CxHW8Pe8CjfKZLSL8whno4tuERKIV/fEICCRMM202Qp?= =?us-ascii?Q?jcxITz7EaRhrXjU+l0zEU7sVuQqqamsCbS0/PuYbyGseS1kaEtpLkoUKwd+r?= =?us-ascii?Q?yswvVwBAJLJS0hI0bxDx2v62+thkVWyDWjYqmH5ZUt9iivu2z2Ab1qBNphGO?= =?us-ascii?Q?8LdBNGtb/uXQ02B8WPGZSr6EDrq7ISBEqEp5eSiIe/qym6czuSQ1IO3C2HAA?= =?us-ascii?Q?UJF8yTMkoHnc/rN0cUi0+NaK4W9FBu6H+ITZcHZisjpe1nxxsOR4P+pHL/KH?= =?us-ascii?Q?TMwBRSP3lXuwY8eTYyitvo9vNl55qIGrZDCIXyv6bVivTDdI1OmFmI8NoUgz?= =?us-ascii?Q?/KO6fK3cRqEKM6L3HWSipTDyIK59g2d0Uekxin2N7X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at0aBtfvvHEcWgDBpXlDkBEcfWUg3wDN9txdsFte+Btb+Nm4YpPjc6LxmFW?= =?us-ascii?Q?MSffZncEDrUkQx5urAtGNxVgAS6aFjDUepSfaVV2OU7zXWvVer+mxGrJqIWF?= =?us-ascii?Q?pzi/dk2PWlgP7X3KpPTc19lBb+jPKkWRdMV6QaLvgE2fnyvrUhBeWWdQVpH1?= =?us-ascii?Q?ZC3OElYZRJJ7qMrnaKdLa25ODgBBmvVZNq6u8cISw4srLLi8VcpNlQpIl9bJ?= =?us-ascii?Q?NVHG1s0Gx4m5keyYumo=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d519e550-3721-40b6-1dbd-08dce8fb7af2 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 07:16:37.9074 (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: 3pHuQ8OJVg8R95qQC58v5mnYa1DyDBeFrL1pa5p1G8Uy2jQ+VnFpusjUz/0tEu5u X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6904 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..7b4fb4c60d 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 = %"PRIu64"M\n", + 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..5427cbd0cb 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 = %"PRIu64"M\n", info.t_size + / (1024 * 1024)); } /* -- 2.25.1