[RFC] Patch: RAM-based heuristics for ggc-min-heapsize and ggc-min-expand

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Sat Feb 15 16:24:00 GMT 2003


 > From: Richard Earnshaw <rearnsha@arm.com>
 > 
 > > "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
 > > 
 > > >  > From: Zack Weinberg <zack@codesourcery.com>
 > > >  > 
 > > >  > We should take rlimits into account in the heuristics.
 > > >  > zw
 > > >
 > > > How?  Which one?
 > > 
 > > RLIMIT_RSS is the obvious one - that's the limit on resident set size,
 > > i.e. the OS will start paging us if we exceed it.  I'd suggest taking
 > > the minimum of that and the actual physical memory size as the input
 > > to the heuristic.
 > 
 > RLIMIT_RSS would certainly be better than physical memory if it is lower.  
 > Consider that we have x86 machines with 8G of RAM, though clearly a single 
 > process can't access more than 4G (and probably less, since the OS has to 
 > be mapped in somewhere).

That does sound like a good idea.  You mean something like this right
after calling physmem_total() ?

#ifdef RLIMIT_RSS
if (getrlimit (RLIMIT_RSS, &rl) == 0
    && rl.rlim_cur != RLIM_INFINITY
    && rl.rlim_cur < physmem)
  physmem = rl.rlim_cur;
#endif

However solaris2 doesn't define RLIMIT_RSS so I can't test it.  My
access to linux/gnu where I suppose it exists is unreliable and
intermittant.  So I'm going to hold off on this until the first patch
goes in and perhaps provide a follow-on afterwards.  Or maybe one of
you nice gentlemen who has an 8Gb x86 machine could help me. :-)

BTW, the hurdles are now:

1.  One of Geoff or Richard needs to withdraw their objections to the
    implementation approach and I possibly need to rewrite it to live
    in gcc.c instead of cc1 if that's the agreed upon choice (or leave
    it as-is.)

2.  I need to hear back from the FSF on the legal question of
    importing code from textutils into libiberty.

3.  Update physmem.c with code which works better on irix6.

4.  Add documentation.

5.  At some point, add the RLIMIT_RSS code.

I'm asking you all if we could please resolve #1 at least while I'm
waiting for #2.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu



More information about the Gcc-patches mailing list