[v2] locale: Reduce __locale_data padding

Message ID 20261022224128.3473750-1-ashamil435@gmail.com (mailing list archive)
State New
Headers
Series [v2] locale: Reduce __locale_data padding |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

Shamil Abdulaev Oct. 22, 2026, 10:41 p.m. UTC
  Move usage_count next to alloc in struct __locale_data to eliminate
two four-byte alignment gaps on x86-64.  This reduces the fixed-size
header from 56 to 48 bytes while keeping nstrings immediately before
values.

Update the positional initializers for the built-in C locale to match
the new order.  The field types and locale data file format are unchanged.

Signed-off-by: Shamil Abdulaev <ashamil435@gmail.com>
---
Changes in v2:
- Move usage_count instead of nstrings, keeping nstrings next to values
  as suggested by DJ Delorie.

 locale/C-address.c        | 2 +-
 locale/C-collate.c        | 2 +-
 locale/C-ctype.c          | 2 +-
 locale/C-identification.c | 2 +-
 locale/C-measurement.c    | 2 +-
 locale/C-messages.c       | 2 +-
 locale/C-monetary.c       | 2 +-
 locale/C-name.c           | 2 +-
 locale/C-numeric.c        | 2 +-
 locale/C-paper.c          | 2 +-
 locale/C-telephone.c      | 2 +-
 locale/C-time.c           | 2 +-
 locale/localeinfo.h       | 4 ++--
 13 files changed, 14 insertions(+), 14 deletions(-)


base-commit: 9e77a668c94f892f2ce0ad9ef7f6e88525852af3
  

Patch

diff --git a/locale/C-address.c b/locale/C-address.c
index 6827605e2b..067dae89f3 100644
--- a/locale/C-address.c
+++ b/locale/C-address.c
@@ -26,8 +26,8 @@  const struct __locale_data _nl_C_LC_ADDRESS attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL,				/* No cached data.  */
   UNDELETABLE,
+  NULL,				/* No cached data.  */
   0,
   13,
   {
diff --git a/locale/C-collate.c b/locale/C-collate.c
index 2a438e126f..eb8aafb8b6 100644
--- a/locale/C-collate.c
+++ b/locale/C-collate.c
@@ -25,8 +25,8 @@  const struct __locale_data _nl_C_LC_COLLATE attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL,				/* No cached data.  */
   UNDELETABLE,
+  NULL,				/* No cached data.  */
   0,
   19,
   {
diff --git a/locale/C-ctype.c b/locale/C-ctype.c
index 52d205a19c..482ad5418f 100644
--- a/locale/C-ctype.c
+++ b/locale/C-ctype.c
@@ -549,8 +549,8 @@  const struct __locale_data _nl_C_LC_CTYPE attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  (void *) &lc_ctype_data,
   UNDELETABLE,
+  (void *) &lc_ctype_data,
   1,		/* Enable transliteration by default.  */
   NR_FIXED + NR_CLASSES + NR_MAPS,
   {
diff --git a/locale/C-identification.c b/locale/C-identification.c
index 13285f67d1..77b27a02cd 100644
--- a/locale/C-identification.c
+++ b/locale/C-identification.c
@@ -26,8 +26,8 @@  const struct __locale_data _nl_C_LC_IDENTIFICATION attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL,				/* No cached data.  */
   UNDELETABLE,
+  NULL,				/* No cached data.  */
   0,
   16,
   {
diff --git a/locale/C-measurement.c b/locale/C-measurement.c
index a80e3bea50..bc28d40056 100644
--- a/locale/C-measurement.c
+++ b/locale/C-measurement.c
@@ -26,8 +26,8 @@  const struct __locale_data _nl_C_LC_MEASUREMENT attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL,				/* No cached data.  */
   UNDELETABLE,
+  NULL,				/* No cached data.  */
   0,
   2,
   {
diff --git a/locale/C-messages.c b/locale/C-messages.c
index f88dbd12ec..ff7871b025 100644
--- a/locale/C-messages.c
+++ b/locale/C-messages.c
@@ -26,8 +26,8 @@  const struct __locale_data _nl_C_LC_MESSAGES attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL,				/* No cached data.  */
   UNDELETABLE,
+  NULL,				/* No cached data.  */
   0,
   5,
   {
diff --git a/locale/C-monetary.c b/locale/C-monetary.c
index ad689733ee..bb14c11fce 100644
--- a/locale/C-monetary.c
+++ b/locale/C-monetary.c
@@ -27,8 +27,8 @@  const struct __locale_data _nl_C_LC_MONETARY attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL,				/* No cached data.  */
   UNDELETABLE,
+  NULL,				/* No cached data.  */
   0,
   46,
   {
diff --git a/locale/C-name.c b/locale/C-name.c
index e86acba155..49e5559a3c 100644
--- a/locale/C-name.c
+++ b/locale/C-name.c
@@ -26,8 +26,8 @@  const struct __locale_data _nl_C_LC_NAME attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL,				/* No cached data.  */
   UNDELETABLE,
+  NULL,				/* No cached data.  */
   0,
   7,
   {
diff --git a/locale/C-numeric.c b/locale/C-numeric.c
index e821b7a005..8522f12f76 100644
--- a/locale/C-numeric.c
+++ b/locale/C-numeric.c
@@ -23,8 +23,8 @@  const struct __locale_data _nl_C_LC_NUMERIC attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL, 			/* No cached data.  */
   UNDELETABLE,
+  NULL, 			/* No cached data.  */
   0,
   6,
   {
diff --git a/locale/C-paper.c b/locale/C-paper.c
index ce6b10eb1a..02f0923b67 100644
--- a/locale/C-paper.c
+++ b/locale/C-paper.c
@@ -26,8 +26,8 @@  const struct __locale_data _nl_C_LC_PAPER attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL,				/* No cached data.  */
   UNDELETABLE,
+  NULL,				/* No cached data.  */
   0,
   3,
   {
diff --git a/locale/C-telephone.c b/locale/C-telephone.c
index 036742c46e..0eb5d5ea37 100644
--- a/locale/C-telephone.c
+++ b/locale/C-telephone.c
@@ -26,8 +26,8 @@  const struct __locale_data _nl_C_LC_TELEPHONE attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL,				/* No cached data.  */
   UNDELETABLE,
+  NULL,				/* No cached data.  */
   0,
   5,
   {
diff --git a/locale/C-time.c b/locale/C-time.c
index 3eb3f876cf..235da5fcb6 100644
--- a/locale/C-time.c
+++ b/locale/C-time.c
@@ -26,8 +26,8 @@  const struct __locale_data _nl_C_LC_TIME attribute_hidden =
 {
   _nl_C_name,
   NULL, 0, 0,			/* no file mapped */
-  NULL, 			/* No cached data.  */
   UNDELETABLE,
+  NULL, 			/* No cached data.  */
   0,
   159,
   {
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 3109f2e20b..067412a885 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -58,6 +58,8 @@  struct __locale_data
     ld_archive			/* Both point into mmap'd archive regions.  */
   } alloc;
 
+  unsigned int usage_count;	/* Counter for users.  */
+
   /* This provides a slot for category-specific code to cache data
      computed about this locale.  Type of the data pointed to:
 
@@ -67,8 +69,6 @@  struct __locale_data
      This data deallocated at the start of _nl_unload_locale.  */
   void *private;
 
-  unsigned int usage_count;	/* Counter for users.  */
-
   int use_translit;		/* Nonzero if the mb*towv*() and wc*tomb()
 				   functions should use transliteration.  */