public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ams at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug ports/16191] New: PAGE_SIZE defined constant on MIPS, but size is configurable
Date: Tue, 19 Nov 2013 14:55:00 -0000	[thread overview]
Message-ID: <bug-16191-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=16191

            Bug ID: 16191
           Summary: PAGE_SIZE defined constant on MIPS, but size is
                    configurable
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ports
          Assignee: unassigned at sourceware dot org
          Reporter: ams at sourceware dot org
                CC: carlos at redhat dot com, roland at gnu dot org

The sys/user.h header defines PAGE_SIZE to a constant (4096), but that figure
is not always accurate; the page size is a kernel configuration option.

  #define PAGE_SHIFT              12
  #define PAGE_SIZE               (1UL << PAGE_SHIFT)
  #define PAGE_MASK               (~(PAGE_SIZE-1))
  #define NBPG                    PAGE_SIZE
  #define UPAGES                  1
  #define HOST_TEXT_START_ADDR    (u.start_code)
  #define HOST_DATA_START_ADDR    (u.start_data)
  #define HOST_STACK_END_ADDR     (u.start_stack + u.u_ssize * NBPG)

A knock-on effect of this bug is that sysdeps/unix/sysv/linux/ifaddrs.c uses an
"optimization" when PAGE_SIZE is constant that means getifaddrs will always
fail when the real page size does not match PAGE_SIZE.

  #ifdef PAGE_SIZE
    /* Help the compiler optimize out the malloc call if PAGE_SIZE
       is constant and smaller or equal to PTHREAD_STACK_MIN/4.  */
    const size_t buf_size = PAGE_SIZE;
  #else
    const size_t buf_size = __getpagesize ();
  #endif

According to Andrew Pinski, the constant PAGE_SIZE is not appropriate on any
MIPS variant, so at least some of the above macros can be removed. Other
architectures appear to remove all of them, but it's not clear that that's
correct on MIPS.

This issue probably applied to other architectures also. Joseph Myers has
mentioned MicroBlaze.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


             reply	other threads:[~2013-11-19 14:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 14:55 ams at sourceware dot org [this message]
2013-11-19 15:55 ` [Bug ports/16191] " schwab@linux-m68k.org
2013-11-19 16:02 ` joseph at codesourcery dot com
2013-11-19 16:13 ` carlos at redhat dot com
2013-11-19 16:45 ` schwab@linux-m68k.org
2013-11-20 17:27 ` ams at sourceware dot org
2013-11-20 17:36 ` joseph at codesourcery dot com
2014-02-11  0:29 ` [Bug libc/16191] [mips] " jsm28 at gcc dot gnu.org
2014-06-13 12:00 ` fweimer at redhat dot com
2015-01-05 13:48 ` cvs-commit at gcc dot gnu.org
2015-02-16 16:23 ` jsm28 at gcc dot gnu.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=bug-16191-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).