From patchwork Sun Mar 10 19:07:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 138143 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2546943C7D; Sun, 10 Mar 2024 20:08:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E06144027A; Sun, 10 Mar 2024 20:08:03 +0100 (CET) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTP id B67F640266 for ; Sun, 10 Mar 2024 20:08:02 +0100 (CET) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-5bdbe2de25fso3207096a12.3 for ; Sun, 10 Mar 2024 12:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1710097682; x=1710702482; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oqAM3O6uqAtL08eS0djgcn36VR51GxdL6fU/sdElm1s=; b=Gf/Nd7mEPBARmCbr5MnV/LmbPOPjgn7iYVPTrtaOSsnvDQW0PSH+Y4gAtCXAPr6hud a9gkiDkD3lGsQUiTfmvDBzLaaQJeAL6PV7jy71+dJ7JbzMtyUrHzxkw1sZzdS/bx9Psn kESoMw3sCTKt2ZYEaOwtn13SgX1gmtEkQBCFFCQt1CSDF0/6TgTD1WowNYit2UR7JUPA 2RWcnql12iUufIDwSjXgbeaUFxGkB08Xtz0uHOIh600Hu15v5KtZHSrO/RuGXE1H568k eRKbYzMrHVbw/nzASmDAY7n8YONo++XwrcWpP0Vjjt1LeIB/LlnxeF9x/cmCxc6F+3Bb wwzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710097682; x=1710702482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oqAM3O6uqAtL08eS0djgcn36VR51GxdL6fU/sdElm1s=; b=gT56DF9eE7ZAyOMoK49nEodQ9OLF6OmdUbAPuT0uD7PNQZEJSisTy8hmavfkGGNkZ6 WWjTmjaFQa27BzTQto3doHebjSvo1JDyFJyR+8VgMlrkUE0RdqzuuqStwR5kOBLRy/6W T/pHQer34Z/g6v+uhxYFU55oFRptWQ0NHTBE4r8L5ciudCiHdUAZX+f8o8s3OJcOK7/g FkWNNZVW3n/PHx/TdV305vqt6e4dxJzJ8Be+aIkkl37CraVEYz11U+7+WYbFZ+saW+um 2HZPGCPD79nF9YUlCbNMJET2Qdj6/X/GmeNfy82CEAAEwQybobuPFvo0PdE/yNfNmHtA Vuig== X-Gm-Message-State: AOJu0YzYMCuntvzB+HlqEQtbU/WEOYyW0XB8CSG6aYYpLb+kj0TfUVn8 kn5C0BBA1TSApNf6PinddqEPQXE2p28PQ0uvzSi16VjGmIc4m4HTzRh3u5dM68X4LjxokI/cvls yt5Q= X-Google-Smtp-Source: AGHT+IFjvD1gwfUqzezGx8wYUSHdCiDOhJnJLQvPAGRKml2R3UjUm5kadWkfds3WH16aflzTll6AZQ== X-Received: by 2002:a17:903:11c7:b0:1dd:22ec:7b22 with SMTP id q7-20020a17090311c700b001dd22ec7b22mr7016983plh.33.1710097681690; Sun, 10 Mar 2024 12:08:01 -0700 (PDT) Received: from hermes.lan (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id q1-20020a170902a3c100b001dbb6fef41fsm3047420plb.257.2024.03.10.12.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 12:08:01 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [RFC v2] eal: reduce size of internal config structure Date: Sun, 10 Mar 2024 12:07:24 -0700 Message-ID: <20240310190759.305837-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <0240310172124.212792-1-stephen@networkplumber.org> References: <0240310172124.212792-1-stephen@networkplumber.org> MIME-Version: 1.0 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 The internal config structure is a hodgepodge of earlier changes and has lots of holes. - convert boolean flag values to bits - rearrange to eliminate holes saves one cacheline. - don't use docbook comment on internal structure - put the big arrays at the end for better locality Signed-off-by: Stephen Hemminger --- v2 - number of channels and ranks should be uint8_t not boolean lib/eal/common/eal_internal_cfg.h | 91 +++++++++++++------------------ 1 file changed, 38 insertions(+), 53 deletions(-) diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h index 167ec501fa79..cf7d30fa1c66 100644 --- a/lib/eal/common/eal_internal_cfg.h +++ b/lib/eal/common/eal_internal_cfg.h @@ -42,67 +42,52 @@ struct simd_bitwidth { /** Hugepage backing files discipline. */ struct hugepage_file_discipline { - /** Unlink files before mapping them to leave no trace in hugetlbfs. */ - bool unlink_before_mapping; - /** Unlink existing files at startup, re-create them before mapping. */ - bool unlink_existing; + uint8_t unlink_before_mapping; /* Unlink files before mapping, leave no trace */ + uint8_t unlink_existing; /* Unlink existing files at startup */ }; /** * internal configuration */ struct internal_config { - volatile size_t memory; /**< amount of asked memory */ - volatile unsigned force_nchannel; /**< force number of channels */ - volatile unsigned force_nrank; /**< force number of ranks */ - volatile unsigned no_hugetlbfs; /**< true to disable hugetlbfs */ + volatile size_t memory; /* amount of asked memory */ + volatile enum rte_proc_type_t process_type; /* multi-process proc type */ + volatile uint8_t force_nchannel; /* force number of channels */ + volatile uint8_t force_nrank; /* force number of ranks */ + volatile uint16_t + no_hugetlbfs:1, /* disable hugetlbfs */ + no_pci:1, /* disable PCI */ + no_hpet:1, /* disable HPET */ + vmware_tsc_map:1, /* use VMware TSC mapping */ + no_shconf:1, /* no shared config */ + in_memory:1, /* operate entirely in-memory no shared files */ + create_uio_dev:1, /* create /dev/uioX devices */ + force_sockets:1, /* allocate memory on specific sockets */ + force_socket_limits:1, + legacy_mem:1, /* no dynamic allocation */ + match_allocations:1, /* free hugepages exactly as allocated */ + unlink_before_mapping:1, /* unlink before mapping leave no trace in hugetlbfs */ + unlink_existing:1, /* unlink existing files at startup */ + single_file_segments:1, /* all page within single file */ + no_telemetry:1, /* disable telemetry */ + init_complete:1; /* EAL has completed initialization */ + + uintptr_t base_virtaddr; /* base address to try and reserve memory from */ + volatile enum rte_intr_mode vfio_intr_mode; /* default interrupt mode for VFIO */ + rte_uuid_t vfio_vf_token; /* VF token for VFIO-PCI bound PF and VFs devices */ + volatile int syslog_facility; /* facility passed to openlog() */ + char *user_mbuf_pool_ops_name; /* user defined mbuf pool ops name */ + rte_cpuset_t ctrl_cpuset; /* cpuset for ctrl threads */ + struct simd_bitwidth max_simd_bitwidth; /* max simd bitwidth path to use */ struct hugepage_file_discipline hugepage_file; - volatile unsigned no_pci; /**< true to disable PCI */ - volatile unsigned no_hpet; /**< true to disable HPET */ - volatile unsigned vmware_tsc_map; /**< true to use VMware TSC mapping - * instead of native TSC */ - volatile unsigned no_shconf; /**< true if there is no shared config */ - volatile unsigned in_memory; - /**< true if DPDK should operate entirely in-memory and not create any - * shared files or runtime data. - */ - volatile unsigned create_uio_dev; /**< true to create /dev/uioX devices */ - volatile enum rte_proc_type_t process_type; /**< multi-process proc type */ - /** true to try allocating memory on specific sockets */ - volatile unsigned force_sockets; - volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */ - volatile unsigned force_socket_limits; - volatile uint64_t socket_limit[RTE_MAX_NUMA_NODES]; /**< limit amount of memory per socket */ - uintptr_t base_virtaddr; /**< base address to try and reserve memory from */ - volatile unsigned legacy_mem; - /**< true to enable legacy memory behavior (no dynamic allocation, - * IOVA-contiguous segments). - */ - volatile unsigned match_allocations; - /**< true to free hugepages exactly as allocated */ - volatile unsigned single_file_segments; - /**< true if storing all pages within single files (per-page-size, - * per-node) non-legacy mode only. - */ - volatile int syslog_facility; /**< facility passed to openlog() */ - /** default interrupt mode for VFIO */ - volatile enum rte_intr_mode vfio_intr_mode; - /** the shared VF token for VFIO-PCI bound PF and VFs devices */ - rte_uuid_t vfio_vf_token; - char *hugefile_prefix; /**< the base filename of hugetlbfs files */ - char *hugepage_dir; /**< specific hugetlbfs directory to use */ - char *user_mbuf_pool_ops_name; - /**< user defined mbuf pool ops name */ - unsigned num_hugepage_sizes; /**< how many sizes on this system */ + enum rte_iova_mode iova_mode ; /* IOVA mode on this system */ + unsigned int num_hugepage_sizes; /* how many sizes on this system */ + size_t huge_worker_stack_size; /* worker thread stack size */ + char *hugefile_prefix; /* base filename of hugetlbfs files */ + char *hugepage_dir; /* hugetlbfs directory */ struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES]; - enum rte_iova_mode iova_mode ; /**< Set IOVA mode on this system */ - rte_cpuset_t ctrl_cpuset; /**< cpuset for ctrl threads */ - volatile unsigned int init_complete; - /**< indicates whether EAL has completed initialization */ - unsigned int no_telemetry; /**< true to disable Telemetry */ - struct simd_bitwidth max_simd_bitwidth; - /**< max simd bitwidth path to use */ - size_t huge_worker_stack_size; /**< worker thread stack size */ + volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /* amount of memory per socket */ + volatile uint64_t socket_limit[RTE_MAX_NUMA_NODES]; /* limit amount of memory per socket */ }; void eal_reset_internal_config(struct internal_config *internal_cfg);