public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 4/6] malloc: Rename chunk2rawmem
Date: Tue, 23 Mar 2021 16:43:19 -0400	[thread overview]
Message-ID: <xnzgytiot4.fsf@rhel8.vm> (raw)
In-Reply-To: <39adedfcc466045b1087f037f35ca437991e1c17.1616155129.git.szabolcs.nagy@arm.com> (message from Szabolcs Nagy on Fri, 19 Mar 2021 13:27:10 +0000)

Szabolcs Nagy <szabolcs.nagy@arm.com> writes:
> Replaced tag_at (chunk2rawmem (x)) with chunk2mem_tag (x).
> Renamed chunk2rawmem to chunk2mem.

LGTM.
Reviewed-by: DJ Delorie <dj@redhat.com>

> -      (void)tag_region (chunk2rawmem (p), memsize (p));
> +      (void)tag_region (chunk2mem (p), memsize (p));

Ok.

> -        newmem = tag_at (chunk2rawmem (newp));
> +        newmem = chunk2mem_tag (newp);

Ok.

> -#define chunk2rawmem(p) ((void*)((char*)(p) + CHUNK_HDR_SZ))
> +#define chunk2mem(p) ((void*)((char*)(p) + CHUNK_HDR_SZ))

Ok.

> -/* Convert between user mem pointers and chunk pointers, updating any
> -   memory tags on the pointer to respect the tag value at that
> -   location.  */
> -#define chunk2mem(p) ((void *)tag_at (((char*)(p) + CHUNK_HDR_SZ)))
> +/* Convert a chunk address to a user mem pointer and extract the right tag.  */
> +#define chunk2mem_tag(p) ((void*)tag_at ((char*)(p) + CHUNK_HDR_SZ))
> +
> +/* Convert a user mem pointer to a chunk address and extract the right tag.  */
>  #define mem2chunk(mem) ((mchunkptr)tag_at (((char*)(mem) - CHUNK_HDR_SZ)))

Ok.

>  #define misaligned_chunk(p) \
> -  ((uintptr_t)(MALLOC_ALIGNMENT == CHUNK_HDR_SZ ? (p) : chunk2rawmem (p)) \
> +  ((uintptr_t)(MALLOC_ALIGNMENT == CHUNK_HDR_SZ ? (p) : chunk2mem (p)) \
>     & MALLOC_ALIGN_MASK)

Ok.

> -      assert (aligned_OK (chunk2rawmem (p)));
> +      assert (aligned_OK (chunk2mem (p)));

Ok.

> -      assert (aligned_OK (chunk2rawmem (p)));
> +      assert (aligned_OK (chunk2mem (p)));

Ok.

> -  assert (aligned_OK (chunk2rawmem (p)));
> +  assert (aligned_OK (chunk2mem (p)));

Ok.

> -                  /* For glibc, chunk2rawmem increases the address by
> +                  /* For glibc, chunk2mem increases the address by

Ok.

> -                  assert (((INTERNAL_SIZE_T) chunk2rawmem (mm) & MALLOC_ALIGN_MASK) == 0);
> +                  assert (((INTERNAL_SIZE_T) chunk2mem (mm) & MALLOC_ALIGN_MASK) == 0);

Ok.

> -                front_misalign = (INTERNAL_SIZE_T) chunk2rawmem (mm) & MALLOC_ALIGN_MASK;
> +                front_misalign = (INTERNAL_SIZE_T) chunk2mem (mm) & MALLOC_ALIGN_MASK;

Ok.

> -              return chunk2rawmem (p);
> +              return chunk2mem (p);

Ok.

> -                  front_misalign = (INTERNAL_SIZE_T) chunk2rawmem (brk) & MALLOC_ALIGN_MASK;
> +                  front_misalign = (INTERNAL_SIZE_T) chunk2mem (brk) & MALLOC_ALIGN_MASK;

Ok.

> -                    assert (((unsigned long) chunk2rawmem (brk) & MALLOC_ALIGN_MASK) == 0);
> +                    assert (((unsigned long) chunk2mem (brk) & MALLOC_ALIGN_MASK) == 0);

Ok.

> -                      front_misalign = (INTERNAL_SIZE_T) chunk2rawmem (brk) & MALLOC_ALIGN_MASK;
> +                      front_misalign = (INTERNAL_SIZE_T) chunk2mem (brk) & MALLOC_ALIGN_MASK;

Ok.

> -      return chunk2rawmem (p);
> +      return chunk2mem (p);

Ok.

> -  uintptr_t mem = (uintptr_t) chunk2rawmem (p);
> +  uintptr_t mem = (uintptr_t) chunk2mem (p);

Ok.

> -  uintptr_t mem = (uintptr_t) chunk2rawmem(p);
> +  uintptr_t mem = (uintptr_t) chunk2mem(p);

Ok.

> -  assert (aligned_OK (chunk2rawmem (p)));
> +  assert (aligned_OK (chunk2mem (p)));

Ok.

> -  tcache_entry *e = (tcache_entry *) chunk2rawmem (chunk);
> +  tcache_entry *e = (tcache_entry *) chunk2mem (chunk);

Ok.

> -      (void)tag_region (chunk2rawmem (p), memsize (p));
> +      (void)tag_region (chunk2mem (p), memsize (p));

Ok.

> -	  void *newmem = tag_at (chunk2rawmem (newp));
> +	  void *newmem = chunk2mem_tag (newp);

Ok.

> -	  (void) tag_region (chunk2rawmem (oldp), sz);
> +	  (void) tag_region (chunk2mem (oldp), sz);

Ok.

> -	      void *p = chunk2rawmem (victim);
> +	      void *p = chunk2mem (victim);

Ok.

> -          void *p = chunk2rawmem (victim);
> +          void *p = chunk2mem (victim);

Ok.

> -              void *p = chunk2rawmem (victim);
> +              void *p = chunk2mem (victim);

Ok.

> -              void *p = chunk2rawmem (victim);
> +              void *p = chunk2mem (victim);

Ok.

> -              void *p = chunk2rawmem (victim);
> +              void *p = chunk2mem (victim);

Ok.

> -              void *p = chunk2rawmem (victim);
> +              void *p = chunk2mem (victim);

Ok.

> -          void *p = chunk2rawmem (victim);
> +          void *p = chunk2mem (victim);

Ok.

> -	tcache_entry *e = (tcache_entry *) chunk2rawmem (p);
> +	tcache_entry *e = (tcache_entry *) chunk2mem (p);

Ok.

> -    free_perturb (chunk2rawmem(p), size - CHUNK_HDR_SZ);
> +    free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ);

Ok.

> -    free_perturb (chunk2rawmem(p), size - CHUNK_HDR_SZ);
> +    free_perturb (chunk2mem(p), size - CHUNK_HDR_SZ);

Ok.

> -          return tag_new_usable (chunk2rawmem (oldp));
> +          return tag_new_usable (chunk2mem (oldp));

Ok.

> -	      void *oldmem = chunk2rawmem (oldp);
> +	      void *oldmem = chunk2mem (oldp);

Ok.

> -  return tag_new_usable (chunk2rawmem (newp));
> +  return tag_new_usable (chunk2mem (newp));

Ok.

> -          return chunk2rawmem (newp);
> +          return chunk2mem (newp);

Ok.

> -              (((unsigned long) (chunk2rawmem (p))) % alignment) == 0);
> +              (((unsigned long) (chunk2mem (p))) % alignment) == 0);

Ok.

> -  return chunk2rawmem (p);
> +  return chunk2mem (p);

Ok.

> -                assert ((char *) chunk2rawmem (p) + 2 * CHUNK_HDR_SZ
> +                assert ((char *) chunk2mem (p) + 2 * CHUNK_HDR_SZ

Ok.


  reply	other threads:[~2021-03-23 20:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 13:25 [PATCH 0/6] malloc: more memory tagging optimizations Szabolcs Nagy
2021-03-19 13:26 ` [PATCH 1/6] malloc: Use memsize instead of CHUNK_AVAILABLE_SIZE Szabolcs Nagy
2021-03-23 20:01   ` DJ Delorie
2021-03-19 13:26 ` [PATCH 2/6] malloc: Use different tag after mremap Szabolcs Nagy
2021-03-23 20:03   ` DJ Delorie
2021-03-19 13:26 ` [PATCH 3/6] malloc: Use chunk2rawmem throughout Szabolcs Nagy
2021-03-23 20:25   ` DJ Delorie
2021-03-19 13:27 ` [PATCH 4/6] malloc: Rename chunk2rawmem Szabolcs Nagy
2021-03-23 20:43   ` DJ Delorie [this message]
2021-03-19 13:27 ` [PATCH 5/6] malloc: Remove unnecessary tagging around _mid_memalign Szabolcs Nagy
2021-03-23 20:44   ` DJ Delorie
2021-03-19 13:27 ` [PATCH 6/6] malloc: Ensure mtag code path in checked_request2size is cold Szabolcs Nagy
2021-03-23 20:46   ` DJ Delorie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xnzgytiot4.fsf@rhel8.vm \
    --to=dj@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=szabolcs.nagy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).