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 927AFA00C5; Mon, 11 May 2020 13:11:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5C3A51D173; Mon, 11 May 2020 13:09:39 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2089.outbound.protection.outlook.com [40.107.21.89]) by dpdk.org (Postfix) with ESMTP id DB5B41D14A for ; Mon, 11 May 2020 13:09:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aMTeKsabaGfV9Ybun1kSXVzzlmcs5ccOuXXu3C38wfwKI17mHYEMli6MUD6FfWaL27F6u1ahiN+HwHDqOdwjl7WQeBVakpTI+2zu/YP6cTJcWvjkdOqEG5yHY3Xh+FRCHMf5WKQVmy+8fKHRlcNcWHIACZJO2Yhog0BMQF7TfkUqd9MW2jEECZH1wPOWq+jUkuFrgwKbLKf5fzbftvRuGyPdpY5qSfPRQXIIpZBwwtm9CiXq/avd0foMN5Tsc1YJenN/7+KIAcN08S9sy/nIIWM026RuKhp8mq9EpvItIAMdshMpDcMPdVvMc9Anz4XkRR6lm9efl4UiUYmEp0fWkw== 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=BqjpVC0uEMDDz9VqacPj3Gegqb60Vpq0T3WlHEn7JYw=; b=ckGFll3dz+06ZLfsJTzeQ3knZcX01OtW1db2JWt+1DlKxhIszHaa+/s7QHAwIcxYqCsDJJ8ByxPU0IDDH/He72VGUIuwPmRXOult1iPUVS3u0li6buL4BDAbc2Wh1IQ9zO58z9qP6iriNu39aWhUbF2hjhyh/axvE/6xuzesnTNvh85e84rfoe+Io/NT4BgTp2CAJRgREvGKA/0o9/ESaBn/IZlty+KxRuBjhmKyiXvDNMdXgDkDZYKO6PGBeAPz/YZsSjKKDMdaS0MYvzRZWG0cpdSEFkj14kuNJykKDbbFUr/V7TFyGPXXhpjMyZ1aNJpT4sLs9nbVsqgUSzNEcA== 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=BqjpVC0uEMDDz9VqacPj3Gegqb60Vpq0T3WlHEn7JYw=; b=CIsKVUtqo9hkN49hiwNxbHT9LTUGXUfoLiWMkyXNw8D7Pd2zRSKaFq6LRzWpeJigI1YDZfDvBTN7T81ewIsaH5yA4t/U/Kqv2R4MGCdL2OMSGzxznnsF4Kdow5IzOGS6cr8Rwt4hDq1yPHDnyEfeUs4g6p3kH/oK+y+NsyaATRM= 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 AM0PR05MB5891.eurprd05.prod.outlook.com (2603:10a6:208:133::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.33; Mon, 11 May 2020 11:09:33 +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.035; Mon, 11 May 2020 11:09:33 +0000 From: Wisam Jaddo To: dev@dpdk.org, jackmin@mellanox.com, thomas@monjalon.net, jerinjacobk@gmail.com, ajit.khaparde@broadcom.com, arybchenko@solarflare.com Cc: Suanming Mou Date: Mon, 11 May 2020 11:09:11 +0000 Message-Id: <20200511110912.11535-5-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511110912.11535-1-wisamm@mellanox.com> References: <20200506123627.22340-2-wisamm@mellanox.com> <20200511110912.11535-1-wisamm@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: PR3P192CA0058.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:57::33) 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 PR3P192CA0058.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:57::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.29 via Frontend Transport; Mon, 11 May 2020 11:09:32 +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: 2aee42ae-5a7c-4a08-8245-08d7f59bc8e4 X-MS-TrafficTypeDiagnostic: AM0PR05MB5891:|AM0PR05MB5891: 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:2512; X-Forefront-PRVS: 04004D94E2 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DAlGvCsJ+3jSK8OL8nIHi90DUz8ezly7oAsHHCFT2upfx1ug2JmU0uU0Zjk3ukskZpsfUMsMIh1p8cEbFU5k9B1nFX1+7i6lPBxrXy6qE7bvB/9l79cr6vrbuZL8bUrbQdHoWUVoe4gAL5uUSs/ixLKVSfqUAI7afUE2nFudJc+Aa/a28priG5789trBm2yFHU6PaBGzC74osS/SHtj+gv2eEO99a4l46JlvVpxVZaiVPhMSXvhGKYR2lR0F4qHmGNZYgI4pQjAWr5ncDS0zrETLEhGrmKm2jNtzj++in0GuO4DHTtqj07fOxefGwc9+f/YEmnglUbAHSER1fueWBgmlIGSKfkR15MKSB1Np4sXaB+c7qQtynQMpxLTG89g3D9BBRPAfFz10VppqZSu0jgSiWtcnPyomuXSIfEG1hC0AkrEweG5NuG/0r/ncgbQtd9QUAjW9uv7geAAodPAHLqloyE/M9peyRcd809lPwELzLdryOx9Th3q3qgk2rV3qjQmm8JcqkbBg9WPemuDR2A== 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)(376002)(136003)(39860400002)(396003)(366004)(346002)(33430700001)(66556008)(36756003)(478600001)(5660300002)(1076003)(33440700001)(316002)(6666004)(8886007)(2906002)(8936002)(55016002)(86362001)(66476007)(8676002)(66946007)(52116002)(26005)(2616005)(956004)(107886003)(16526019)(186003)(4326008)(7696005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: iOE7SdpcnnaYx13x4lJAn5oLsYFFNwl5oqWIAI/GOOaNWnWoiJTVHX5eRUCxuh37tg9fILvsQ0yTpZrqfNbw9aGyHSvJl7yccj8akQ4dNrDOZlHUz91CEVQHJpoiITAbqAcwmgfflQLj+QmZvLdjAKI08hiays95CJShpeXv7/mgZopn60PcVzzuweotKk6D7xzv2NHrLR3KgGDeuYyAiUKvgHhS66xbglw5FSuhVz7u2+eA5SGmYMX7hJNAb02ZfoyZ+UV5Ibg8b022K7P9XL/R/TWhawtsb+3wv4sQjeVsHUpCvx9QaWSC4u7ErWrlULJYqIbTZ0KgNnemD0/UjylMMolHg4kx3ZFKJmwILIbzD+kcGcR+5M2Izqgz6EbO6rgr1WWvgNfVPXBaSV4ck1SOF1JjwwzxuqDbUgypa+HDtdB36tlWogR84u+hT4rz0XqBOCHN/5YT37Tk6DbqGJ3neUB2pk8DfqzKo6iv/mw= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2aee42ae-5a7c-4a08-8245-08d7f59bc8e4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2020 11:09:33.8277 (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: gGjRnwLaRK45y3xcamMDWwoy55mRWvgoGrXNdre9T8btxgiWlfZm4hKmAY3XCYtQUMTkRdRCMHORT2Pywiip4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5891 Subject: [dpdk-dev] [PATCH v6 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 | 72 +++++++++++++++++++++++++- doc/guides/rel_notes/release_20_05.rst | 1 + doc/guides/tools/flow-perf.rst | 6 ++- 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index b177025fa..da54bbdef 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -49,7 +49,8 @@ static uint32_t flow_actions; static uint32_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"); @@ -250,6 +252,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 }, @@ -360,6 +363,9 @@ args_parse(int argc, char **argv) if (strcmp(lgopts[opt_idx].name, "deletion-rate") == 0) delete_flag = true; + if (strcmp(lgopts[opt_idx].name, + "dump-socket-mem") == 0) + dump_socket_mem_flag = true; break; default: fprintf(stderr, "Invalid option: %s\n", argv[optind]); @@ -371,6 +377,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) { @@ -708,6 +770,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) @@ -718,6 +781,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); @@ -734,7 +798,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/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index e511e9c1a..aae1c5492 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -219,6 +219,7 @@ New Features Application features: * Measure rte_flow insertion rate. * Measure rte_flow deletion rate. + * Dump rte_flow memory consumption. Removed Items diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst index 1f8b1fa15..c8cce187e 100644 --- a/doc/guides/tools/flow-perf.rst +++ b/doc/guides/tools/flow-perf.rst @@ -25,7 +25,8 @@ The current version has limitations which can be removed in future: * Support outer items up to tunnel layer only. * Single core insertion only. -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 @@ -76,6 +77,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