DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [RFC v2] eal: reduce size of internal config structure
Date: Sun, 10 Mar 2024 12:07:24 -0700	[thread overview]
Message-ID: <20240310190759.305837-1-stephen@networkplumber.org> (raw)
In-Reply-To: <0240310172124.212792-1-stephen@networkplumber.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 <stephen@networkplumber.org>
---
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);
-- 
2.43.0


           reply	other threads:[~2024-03-10 19:08 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <0240310172124.212792-1-stephen@networkplumber.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240310190759.305837-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).