locale files and page size

Joseph S. Myers joseph@codesourcery.com
Fri Sep 27 00:22:00 GMT 2013


On Tue, 24 Sep 2013, Roland McGrath wrote:

> It would be great to see someone do that analysis and produce some
> interesting data.  But that's a lot of work for a pretty small issue.
> We know that the most common affected configurations (i.e. ILP32 with
> 4k pages) will be unchanged by just hard-coding the in-file alignment
> to 4k in localedef.  So I would not object to doing that in the
> absence of actual analysis.

This patch does just that, using constant 4096 as page size.  Tested
x86_64 and x86.

2013-09-26  Joseph Myers  <joseph@codesourcery.com>

	* locale/programs/locarchive.c (add_locale): Use constant 4096 for
	page size instead of calling getpagesize.

diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index 13dba0f..ba164a4 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -838,7 +838,10 @@ add_locale (struct locarhandle *ah,
   off64_t lastoffset;
   char *ptr;
   struct locale_category_data *size_order[__LC_LAST];
-  const size_t pagesz = getpagesize ();
+  /* Page size alignment is a minor optimization for locality; use a
+     common value here rather than making the localedef output depend
+     on the page size of the system on which localedef is run.  */
+  const size_t pagesz = 4096;
   int small_mask;
 
   head = ah->addr;

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list