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 1B05845ECD; Tue, 17 Dec 2024 10:00:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDAF0402A9; Tue, 17 Dec 2024 10:00:09 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 56BF8402A3 for ; Tue, 17 Dec 2024 10:00:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734426007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B8LvcPI9IgGfYTyysHWGTaaQJMPc3TIOYQVFnIOLrYQ=; b=ZzxIhspZ3JOmposKMLb9sb2tBEYuLdRmvVp9JwDg6lL6JjnxaB4YnNtMPrtr6SXfS6Xt40 ODb0MLN5KmRDdPOvxfoNcCaVxiY29hTY0HIOLd7DkwZnjGAMwZ11MvGbONGAdASd4mRkz+ EYlU238wdBXZnpK41I6eBHNVA3pOM60= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-153-LkJ08snpNmS1D-uDlG5-vg-1; Tue, 17 Dec 2024 04:00:04 -0500 X-MC-Unique: LkJ08snpNmS1D-uDlG5-vg-1 X-Mimecast-MFC-AGG-ID: LkJ08snpNmS1D-uDlG5-vg Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 708291956046; Tue, 17 Dec 2024 09:00:02 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.167]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 14F7D195605F; Tue, 17 Dec 2024 08:59:59 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, frode.nordahl@canonical.com, mattias.ronnblom@ericsson.com, anatoly.burakov@intel.com Subject: [PATCH v2 0/5] Defer lcore variables allocation Date: Tue, 17 Dec 2024 09:59:47 +0100 Message-ID: <20241217085954.3310414-1-david.marchand@redhat.com> In-Reply-To: <20241205175754.1673888-1-david.marchand@redhat.com> References: <20241205175754.1673888-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: mnIPg9eUgHQxNvSmOWHDG6LoSW5G41X6PtSEBbyPXLI_1734426002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 As I had reported in rc2, the lcore variables allocation have a noticeable impact on applications consuming DPDK, even when such applications does not use DPDK, or use features associated to some lcore variables. While the amount has been reduced in a rush before rc2, there are still cases when the increased memory footprint is noticed like in scaling tests. See https://bugs.launchpad.net/ubuntu/+source/dpdk/+bug/2090931 lcore variable allocations in constructor is a bad idea, as the application consuming DPDK has no control over such allocation: linking some code does not mean that all of it will be used at runtime. The general question on whether lcore variables in constructor should be forbidden, is left to a later discussion. For now, this series only focus on fixing subsystems using lcore variables so that those allocations are deferred either in rte_eal_init() or in the path that does require such lcore variables. -- David Marchand Changes since v1: - added a check on lcore handle, - fixed lcore variable size in lib/power, - renamed/introduced allocation helpers, David Marchand (5): eal: check lcore variable handle random: defer seeding to EAL init power: defer lcore variable allocation power: reduce memory footprint of per-lcore state eal/x86: defer power intrinsics variable allocation lib/eal/common/eal_private.h | 6 ++++++ lib/eal/common/rte_random.c | 7 +++++-- lib/eal/freebsd/eal.c | 2 ++ lib/eal/include/rte_lcore_var.h | 2 ++ lib/eal/linux/eal.c | 2 ++ lib/eal/windows/eal.c | 2 ++ lib/eal/x86/rte_power_intrinsics.c | 15 +++++++++++++-- lib/power/rte_power_pmd_mgmt.c | 29 ++++++++++++++++++++--------- 8 files changed, 52 insertions(+), 13 deletions(-) -- 2.47.0