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 2F67CA034F; Wed, 6 May 2020 14:37:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 852181D9C6; Wed, 6 May 2020 14:36:54 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60086.outbound.protection.outlook.com [40.107.6.86]) by dpdk.org (Postfix) with ESMTP id 64EC91D980 for ; Wed, 6 May 2020 14:36:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BVeedtrtqQZxzHhOJhuwl3SsM5Pyih04uEmPJneYPjmSQZrwoHjIDNlLYB69kha0P4PrTu8d0A31X12Atk9hqLGUOKMx/oKbMsk2NJ8573WVEC7dOFDkpmP1Pj5ehJHIRFTvpgv6xElDvZyPzkcQzYEX+d8E+yfu1kcQjXbY5njVZW2LUpFZlzPXeVjnMm50xagR7soBLt846u6NfYl8MGfpH587kY5oD0J2k9Zu2BJvdIyOVPgPquqQ9CMiRJkRG0N9uqhv9wYXAZV3nym3MPPgwOl6B/9G+aX4oSt6JaSxuGrBsPGwJmAycQu8L9NyCVz1xbgbs/8glo/jvyYqGg== 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=3hHGlM4jYaX4QBtcCy2n6hGqXmhEuTKBKV/NUi4mQb0=; b=i+8/SEBcMDQHxalNl34tFPj7p1S7V8dsSFFCldloTVmUBZonBHh7DWcP7QznSinSJEwkx9QGN8GNF7EhqYnMDKSRPqe1iiDJ6cckgml9B27yzTsIUIncQGy/1uBmtkR9O3yAZh+mPjdH6kq5zJyoHksJZBZmCJQSER65lm14+M3/yAD8haaTG9lvm+IQrr5WlDMjpTHPv0UtsffVBxr4T5Gf/DYBTFZRdWkGwBdQBHzPLsvuy9pf2sIhDtZzFI557jrN/upqXPraiALqsbe83EDeLdjcq+SBIxw0zvGUf7qTLi3mxX0dVwlcONGnyYBS6VKShfZT7fDRTckLs2vQBQ== 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=3hHGlM4jYaX4QBtcCy2n6hGqXmhEuTKBKV/NUi4mQb0=; b=O13Qg/9ZFIsT7RiD4R984GTRQ0jaEFTairHtXkCW7KwfEvHpsVHfN14TllnpVmeiruLnOv0A54pcIQ9ZbNqBt7uxDScVRY40TyRzPASMtPcS9IdTwUfaJq929DoAn7WoBO6lcrv17b8urmO87yw/+f9goKlIRRHidF9Q0JgM6GQ= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) by AM0PR05MB4209.eurprd05.prod.outlook.com (2603:10a6:208:61::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.29; Wed, 6 May 2020 12:36:48 +0000 Received: from AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::900:c0ac:78bd:18fc]) by AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::900:c0ac:78bd:18fc%6]) with mapi id 15.20.2958.030; Wed, 6 May 2020 12:36:48 +0000 From: Wisam Jaddo To: dev@dpdk.org, jackmin@mellanox.com, thomas@monjalon.net, jerinjacobk@gmail.com, gerlitz.or@gmail.com, l.yan@epfl.ch, ajit.khaparde@broadcom.com Cc: Suanming Mou Date: Wed, 6 May 2020 12:36:26 +0000 Message-Id: <20200506123627.22340-5-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200506123627.22340-1-wisamm@mellanox.com> References: <20200430103341.1845-2-wisamm@mellanox.com> <20200506123627.22340-1-wisamm@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: PR0P264CA0164.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1b::32) To AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by PR0P264CA0164.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.28 via Frontend Transport; Wed, 6 May 2020 12:36:47 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3507eab2-5476-435c-aad6-08d7f1ba24f0 X-MS-TrafficTypeDiagnostic: AM0PR05MB4209:|AM0PR05MB4209: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1775; X-Forefront-PRVS: 03950F25EC X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6ZUaw9JPZgVV1C2TDEm5gBzMuuZm49dfYR+kDc1/U6V5EbeY0rQ58pH2N7aIBZTVfi1VjLyWNF6liSzXsTTD+CFn/3q8VVq8Z4M+WZ86qnny/fAlPQS7K5T0zi49X5LtYS9rhO4/FJ3G4ypJqO3vr3SWG+dqM2Bttus+hYFo4aLBUmAYuSPIIc4m7SlK1hyQVo/GWVoKYlWy3uPfY0Y9ehS/JWH04+eTpsVK7P1pk+6xB4awjvuZl/CNTp6nPawjVK+D2NrCWxAqO9WVS8+gzK7oXWHT7XMEZkFmrGncsbhFJKkrbKsQtX7es2/kigQ/I15xRF1S5anudw98TovW5npBmUxr/oSCos0lnxbwtIwCUPAWmSEod6Ao2/l8R8KIt+oS1jh53JKNmvqbbq0DRBrsMJvGrwYo+TuXh8V/GykijRlIKpiLw+LijI7rkF5LhMMxXIMX0Gz826rOdeFZf88TYdvsXvW5AoC4u6Qp52jV6Y+IdEpzT/stHgrir7SaKLDdL1qQN0g15sLGRRZPLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6610.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(376002)(136003)(39860400002)(396003)(33430700001)(316002)(86362001)(1076003)(26005)(8676002)(107886003)(55016002)(36756003)(33440700001)(52116002)(66946007)(186003)(7696005)(66556008)(66476007)(16526019)(478600001)(956004)(2906002)(8936002)(8886007)(5660300002)(6666004)(2616005)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eDpX4+ytDK7MV2kLfsAO5JTSBMVowhQaoJkVscbha6WrSMa6QKYAkoMtY8qULYn4iV9RLwNZgLsMprjhhk8AQXeFq+1TAPIA+q0ZgdJ+O0Dl6dspGqOnVt6uM8N+XPiaFWtVgxFhJdbfMGY5qpRlJkOMHCRQbqzdSiT80MV2RPZqHaCxckiTXiPWekV4eL4NWT96crUDT8dnWXtsGBUMchnPxJ0rb3zh8/CCI6hJU0tskZRIJpr8K98D7cX0RHawUAhxRM36TqthsKralyxqrJRXo4+QUbUllu6vY2PYwcZ4pRTxQldIiPv8+skFR3edBpImYrjaWGcpIyU17Z1S5nEfNXK6fy6xxxUps4zdDjfLTUca9DMqHuRD7GNqaGSnr7O+69nk3/hs6jmOSFBXuMZVcLbjb8JjhdojExaFkC7k8d5npeRJlM/A/K/j06pOqox0XRVbHp+7JJnvJI6U5B3LgkyFG61Dgq7g+/dvj/7+Tv6TCBKNQFlb9RbJ81Y1qw2rgKAlB23MrAJvGUpZh1S5GYw/AR0IApTt7xoBSNGy622cxGFmaolCfIz/FOOO8H+7xdHynaQ8llDn2lNPI+/Q2Tqx7ZjkZHXzojwFOJo/xUasrWTNHq+UJAzqgV9IDXi7nOiAj/0YRQnP9v5Mi2K5B4+kKADjqPe4c/N2C287A7jsCY0kBwkYIxKFx1kt14WuFJe6yeXRq1OJgLLQkuPftypXljTrx/MRGx5NsPnbrZwmDraSr1OD7hwlyuLJPEzpcR/crLcJqjLpKbRrjBmTnVijz34upmAB2XRB+gI= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3507eab2-5476-435c-aad6-08d7f1ba24f0 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2020 12:36:48.4586 (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: j+FvLVndUPBZE3YzkcIGlN7qKHDlGhGM3gk3sINVvzBhU8VqCxpMHh0lR6xA9hs74LF/QQIjVfRIQ2MauirpZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4209 Subject: [dpdk-dev] [PATCH v5 4/5] app/flow-perf: add memory dump to app 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" Introduce new feature to dump memory statistics of each socket and a total for all before and after the creation. This will give two main advantage: 1- Check the memory consumption for large number of flows "insertion rate scenario alone" 2- Check that no memory leackage after doing insertion then deletion. Signed-off-by: Suanming Mou Signed-off-by: Wisam Jaddo --- app/test-flow-perf/main.c | 71 +++++++++++++++++++++++++++++++++- doc/guides/tools/flow-perf.rst | 6 ++- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 1b42cffda..c4e92f938 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -49,7 +49,8 @@ static uint16_t flow_actions; static uint8_t flow_attrs; static volatile bool force_quit; static bool dump_iterations; -static bool delete_flag; +static bool delete_flag; +static bool dump_socket_mem_flag; static struct rte_mempool *mbuf_mp; static uint32_t nb_lcores; static uint32_t flows_count; @@ -67,6 +68,7 @@ usage(char *progname) " iteration\n"); printf(" --deletion-rate: Enable deletion rate" " calculations\n"); + printf(" --dump-socket-mem: To dump all socket memory\n"); printf("To set flow attributes:\n"); printf(" --ingress: set ingress attribute in flows\n"); @@ -149,6 +151,7 @@ args_parse(int argc, char **argv) { "flows-count", 1, 0, 0 }, { "dump-iterations", 0, 0, 0 }, { "deletion-rate", 0, 0, 0 }, + { "dump-socket-mem", 0, 0, 0 }, /* Attributes */ { "ingress", 0, 0, 0 }, { "egress", 0, 0, 0 }, @@ -266,6 +269,8 @@ args_parse(int argc, char **argv) dump_iterations = true; if (!strcmp(lgopts[opt_idx].name, "deletion-rate")) delete_flag = true; + if (!strcmp(lgopts[opt_idx].name, "dump-socket-mem")) + dump_socket_mem_flag = true; break; default: printf("Invalid option: %s\n", argv[optind]); @@ -277,6 +282,62 @@ args_parse(int argc, char **argv) printf("end_flow\n"); } +/* Dump the socket memory statistics on console */ +static size_t +dump_socket_mem(FILE *f) +{ + struct rte_malloc_socket_stats socket_stats; + unsigned int i = 0; + size_t total = 0; + size_t alloc = 0; + size_t free = 0; + unsigned int n_alloc = 0; + unsigned int n_free = 0; + bool active_nodes = false; + + + for (i = 0; i < RTE_MAX_NUMA_NODES; i++) { + if (rte_malloc_get_socket_stats(i, &socket_stats) || + !socket_stats.heap_totalsz_bytes) + continue; + active_nodes = true; + total += socket_stats.heap_totalsz_bytes; + alloc += socket_stats.heap_allocsz_bytes; + free += socket_stats.heap_freesz_bytes; + n_alloc += socket_stats.alloc_count; + n_free += socket_stats.free_count; + if (dump_socket_mem_flag) { + fprintf(f, "::::::::::::::::::::::::::::::::::::::::"); + fprintf(f, + "\nSocket %u:\nsize(M) total: %.6lf\nalloc:" + " %.6lf(%.3lf%%)\nfree: %.6lf" + "\nmax: %.6lf" + "\ncount alloc: %u\nfree: %u\n", + i, + socket_stats.heap_totalsz_bytes / 1.0e6, + socket_stats.heap_allocsz_bytes / 1.0e6, + (double)socket_stats.heap_allocsz_bytes * 100 / + (double)socket_stats.heap_totalsz_bytes, + socket_stats.heap_freesz_bytes / 1.0e6, + socket_stats.greatest_free_size / 1.0e6, + socket_stats.alloc_count, + socket_stats.free_count); + fprintf(f, "::::::::::::::::::::::::::::::::::::::::"); + } + } + if (dump_socket_mem_flag && active_nodes) { + fprintf(f, + "\nTotal: size(M)\ntotal: %.6lf" + "\nalloc: %.6lf(%.3lf%%)\nfree: %.6lf" + "\ncount alloc: %u\nfree: %u\n", + total / 1.0e6, alloc / 1.0e6, + (double)alloc * 100 / (double)total, free / 1.0e6, + n_alloc, n_free); + fprintf(f, "::::::::::::::::::::::::::::::::::::::::\n"); + } + return alloc; +} + static void print_flow_error(struct rte_flow_error error) { @@ -608,6 +669,7 @@ main(int argc, char **argv) int ret; uint16_t port; struct rte_flow_error error; + int64_t alloc, last_alloc; ret = rte_eal_init(argc, argv); if (ret < 0) @@ -618,6 +680,7 @@ main(int argc, char **argv) flows_count = DEFAULT_RULES_COUNT; iterations_number = DEFAULT_ITERATION; delete_flag = false; + dump_socket_mem_flag = false; flow_group = 0; signal(SIGINT, signal_handler); @@ -634,7 +697,13 @@ main(int argc, char **argv) if (nb_lcores <= 1) rte_exit(EXIT_FAILURE, "This app needs at least two cores\n"); + last_alloc = (int64_t)dump_socket_mem(stdout); flows_handler(); + alloc = (int64_t)dump_socket_mem(stdout); + + if (last_alloc) + fprintf(stdout, ":: Memory allocation change(M): %.6lf\n", + (alloc - last_alloc) / 1.0e6); RTE_ETH_FOREACH_DEV(port) { rte_flow_flush(port, &error); diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index b64c23875..6e29cde79 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -17,7 +17,8 @@ give different flow each time, and all other items will have open masks. The current design have single core insertion rate. -The application also provide the ability to measure rte flow deletion rate. +The application also provide the ability to measure rte flow deletion rate, +in addition to memory consumption before and after the flows creation. Compiling the Application @@ -68,6 +69,9 @@ The command line options are: * ``--deletion-rate`` Enable deletion rate calculations. +* ``--dump-socket-mem`` + Dump the memory stats for each socket before the insertion and after. + Attributes: * ``--ingress`` -- 2.17.1