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: [PATCH 3/3] Add a fragmentation fallback in ggc-page


On Fri, Oct 21, 2011 at 07:52:50AM +0200, Andi Kleen wrote:
> @@ -776,13 +778,18 @@ alloc_page (unsigned order)
>  	 extras on the freelist.  (Can only do this optimization with
>  	 mmap for backing store.)  */
>        struct page_entry *e, *f = G.free_pages;
> -      int i;
> +      int i, entries;
>  
> -      page = alloc_anon (NULL, G.pagesize * GGC_QUIRE_SIZE);
> +      page = alloc_anon (NULL, G.pagesize * GGC_QUIRE_SIZE, false);
> +      if (page == NULL)
> +     	{
> +	  page = alloc_anon(NULL, G.pagesize, true);
> +          entries = 1;
> +	}
>  
>        /* This loop counts down so that the chain will be in ascending
>  	 memory order.  */
> -      for (i = GGC_QUIRE_SIZE - 1; i >= 1; i--)
> +      for (i = entries - 1; i >= 1; i--)

entries may be uninitialized here.  Plus indentantion is wrong
(missing space between alloc_anon and (, incorrect amount or kind
(tab vs. spaces) of leading whitespace.

	Jakub


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