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 v2.1][BZ #11087] Use atomic operations to track memory


On Fri, Oct 25, 2013 at 08:07:28PM +0200, OndÅej BÃlka wrote:
> @@ -2822,10 +2821,10 @@ mremap_chunk(mchunkptr p, size_t new_size)
>    assert((p->prev_size == offset));
>    set_head(p, (new_size - offset)|IS_MMAPPED);
>  
> -  mp_.mmapped_mem -= size + offset;
> -  mp_.mmapped_mem += new_size;
> -  if ((unsigned long)mp_.mmapped_mem > (unsigned long)mp_.max_mmapped_mem)
> -    mp_.max_mmapped_mem = mp_.mmapped_mem;
> +  INTERNAL_SIZE_T new;
> +  new = atomic_exchange_and_add (&mp_.mmapped_mem, new_size - size - offset) +
> +  + new_size - size - offset;
> +  atomic_max (&mp_.max_mmapped_mem, new);
>    return p;
>  }
>  

You have an extra plus sign there.  Also, the formatting is wrong.

Siddhesh


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