This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] a different pch/exec-shield cleanup


Richard Henderson <rth@twiddle.net> writes:

> This seems to work ok.  I'm somewhat partial to breaking out all the
> logic for mapping and whatnot into the hook routines, as it seems to
> be easier to follow that way.
> 
> The suggestion to allocate a ~32M vm hole comes from Ingo Molnar.
> The hint that 1.5G to 2.5G tends to be free on x86 no matter what
> the kernel memory model is comes from Arjan van de Ven.
> 
> I suppose that leaves the question of what to do with mincore.
> Should it get shoved into a Solaris-specific host hook like this,
> or should it stay in ggc-common.c as mmap_mincore_gt_pch_use_address?

Looks good to me.  The x86 memory space hints are helpful.  Definitely
easier to understand what is going on.

You didn't update doc/hostconfig.texi.  Note that I sent a rewrite
this morning, although that rewrite is now partly out of date.

I suspect I managed to put ggc-common.c into a state which is
inappropriate for Solaris.  Mea culpa.  I think your Solaris routine
should look like this--munmap addr before calling mincore.  I moved it
to fix a different problem, and probably introduced a new one.

  if (addr != base)
    {
      size_t page_size = getpagesize ();
      char one_byte;
      size_t i;

     if (addr != (void *) MAP_FAILED)
       munmap (addr, size);

      errno = 0;
      for (i = 0; i < size; i += page_size)
	if (mincore ((char *)base + i, page_size, (void *)&one_byte) == -1
	    && errno == ENOMEM)
	  continue; /* The page is not mapped.  */
	else
	  break;

      if (i >= size)
        addr = mmap (base, size, 
                     PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED,
                     fd, offset);
    }

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]