From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9137 invoked by alias); 17 Apr 2014 17:18:11 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 9122 invoked by uid 89); 17 Apr 2014 17:18:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 17 Apr 2014 17:18:08 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 79F455423CE; Thu, 17 Apr 2014 19:18:05 +0200 (CEST) Date: Thu, 17 Apr 2014 17:29:00 -0000 From: Jan Hubicka To: Richard Biener Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: Avoid unnecesary GGC runs during LTO Message-ID: <20140417171805.GB4131@kam.mff.cuni.cz> References: <20140411060757.GI12814@kam.mff.cuni.cz> <20140411191358.GC20526@kam.mff.cuni.cz> <20140417160313.GB18268@kam.mff.cuni.cz> <662c8f9d-e99d-488f-8593-b301db3542f0@email.android.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <662c8f9d-e99d-488f-8593-b301db3542f0@email.android.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-04/txt/msg01033.txt.bz2 > On April 17, 2014 6:03:13 PM CEST, Jan Hubicka wrote: > >> > > + > >> > > + /* At this stage we know that majority of GGC memory is > >reachable. > >> > > + Growing the limits prevents unnecesary invocation of GGC. > >*/ > >> > > + ggc_grow (); > >> > > ggc_collect (); > >> > > >> > Isn't the collect here pointless? I see not in ENABLE_CHECKING, > >but > >> > shouldn't this be abstracted away, thus call ggc_collect from > >ggc_grow? > >> > Or maybe rather even for ENABLE_CHECKING adjust G.allocated_last_gc > >> > and simply drop the ggc_collect above (). > >> > >> I am fine with both. I basically decided to keep the explicit > >ggc_collect() to > >> make it clear (from lto.c source code) that we are GGC safe at this > >point and > >> to have way to double check that we do not produce too much of > >garbage with > >> checking disabled. (so with -Q I will see how much it is collected at > >that place). > >> > >> We can embed it into ggc_grow and document that w/o checking it is > >equivalent > >> to ggc_cooect. > >> > > >> > Anyway, this is sth for stage1 at this point. > >> > >> OK, > >> Honza > > > >Ping... > >the patches saves 33 GGC runs during libxul.so link, that is not that > >bad ;) > > What is the updated patch you propose? I was trying to explain, why I kept explicit ggc_collect just after ggc_grow: I want to make it clear that we are ggc safe at that point. I also want to see the ggc run happening w/o checking to have -Q report how much of garbage we see at this stage so I can keep eye on it. I can hide ENABLE_CHECKING ggc_collect call in ggc_grow and update documentation if your preffer. Honza > > Richard > > >Honza > >> > > >> > Thanks, > >> > Richard. > >> > > >> > > /* Set the hooks so that all of the ipa passes can read in > >their data. */ > >> > > Index: ggc-none.c > >> > > > >=================================================================== > >> > > --- ggc-none.c (revision 209170) > >> > > +++ ggc-none.c (working copy) > >> > > @@ -63,3 +63,8 @@ ggc_free (void *p) > >> > > { > >> > > free (p); > >> > > } > >> > > + > >> > > +void > >> > > +ggc_grow (void) > >> > > +{ > >> > > +} > >> > > Index: ggc-page.c > >> > > > >=================================================================== > >> > > --- ggc-page.c (revision 209170) > >> > > +++ ggc-page.c (working copy) > >> > > @@ -2095,6 +2095,19 @@ ggc_collect (void) > >> > > fprintf (G.debug_file, "END COLLECTING\n"); > >> > > } > >> > > > >> > > +/* Assume that all GGC memory is reachable and grow the limits > >for next collection. */ > >> > > + > >> > > +void > >> > > +ggc_grow (void) > >> > > +{ > >> > > +#ifndef ENABLE_CHECKING > >> > > + G.allocated_last_gc = MAX (G.allocated_last_gc, > >> > > + G.allocated); > >> > > +#endif > >> > > + if (!quiet_flag) > >> > > + fprintf (stderr, " {GC start %luk} ", (unsigned long) > >G.allocated / 1024); > >> > > +} > >> > > + > >> > > /* Print allocation statistics. */ > >> > > #define SCALE(x) ((unsigned long) ((x) < 1024*10 \ > >> > > ? (x) \ > >> > > > >> > > > >> > > >> > -- > >> > Richard Biener > >> > SUSE / SUSE Labs > >> > SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 > >> > GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer >