This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] Don't fall back to mmap if the original arena is not corrupt


On 19 Aug 2015 14:32, Siddhesh Poyarekar wrote:
> The new logic to find an uncontended non-corrupt arena misses a case
> where the current arena is contended, but is not corrupt.  In the
> degenerate case, this is the only arena.  In both cases, the logic
> falls back to using mmap despite there being an available arena.
> 
> Attached patch by Josef Bacik makes sure that all arenas are indeed
> corrupt before falling back to malloc.  Verified on x86_64.

verified how ?

> --- a/malloc/arena.c
> +++ b/malloc/arena.c
> @@ -823,16 +823,21 @@ reused_arena (mstate avoid_arena)
>  
>    /* Make sure that the arena we get is not corrupted.  */
>    mstate begin = result;
> +  bool looped = false;
> +
>    while (arena_is_corrupt (result) || result == avoid_arena)
>      {
>        result = result->next;
>        if (result == begin)
> -	break;
> +	{
> +	  looped = true;
> +	  break;
> +	}
>      }
>  
>    /* We could not find any arena that was either not corrupted or not the one
>       we wanted to avoid.  */
> -  if (result == begin || result == avoid_arena)
> +  if (looped)
>      return NULL;

doesn't this comment explicitly say you don't want to use the avoid arena ?
doesn't it need updating now with this change in logic ?
-mike

Attachment: signature.asc
Description: Digital signature


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