This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2.1][BZ #11087] Use atomic operations to track memory
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 28 Oct 2013 12:02:36 +0530
- Subject: Re: [PATCH v2.1][BZ #11087] Use atomic operations to track memory
- Authentication-results: sourceware.org; auth=none
- References: <20131017114140 dot GA24230 at domone dot podge> <20131018081535 dot GA5679 at domone dot podge> <20131025085352 dot GG23099 at spoyarek dot pnq dot redhat dot com> <20131025180728 dot GC21615 at domone dot podge>
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