From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Tomas Vondra <tv@fuzzy.cz>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-committers <pgsql-committers@postgresql.org>
Subject: Re: pgsql: Generational memory allocator
Date: Sat, 25 Nov 2017 12:13:56 -0800
Message-ID: <20171125201356.2dydqrlf2qktlog6@alap3.anarazel.de> (raw)
In-Reply-To: <20171125200014.qbewtip5oydqsklt@alap3.anarazel.de>
References: <E1eHa4J-0006hI-Q8@gemulon.postgresql.org>
<20171123001649.y2nf7422iay6cw3v@alap3.anarazel.de>
<CANP8+jKoT=Pg5W_3FcKiDf+FMrJhFYacxt_g5E0=tkmb5s8M6g@mail.gmail.com>
<c903f275-2150-fa52-64bf-dca7b53ebf8d@fuzzy.cz>
<16449.1511548313@sss.pgh.pa.us>
<4618.1511573138@sss.pgh.pa.us>
<bf84d940-90d4-de91-19dd-612e011007f4@fuzzy.cz>
<6189.1511587105@sss.pgh.pa.us>
<8991.1511639441@sss.pgh.pa.us>
<20171125200014.qbewtip5oydqsklt@alap3.anarazel.de>
On 2017-11-25 12:00:15 -0800, Andres Freund wrote:
> Hi,
>
> On 2017-11-25 14:50:41 -0500, Tom Lane wrote:
> > I wrote:
> > > Tomas Vondra <tv@fuzzy.cz> writes:
> > >> BTW I also see these failures in hstore:
> >
> > >> ==15168== Source and destination overlap in memcpy(0x5d0fed0, 0x5d0fed0, 40)
> > >> ==15168== at 0x4C2E00C: memcpy@@GLIBC_2.14 (vg_replace_strmem.c:1018)
> > >> ==15168== by 0x15419A06: hstoreUniquePairs (hstore_io.c:343)
> > >> ==15168== by 0x15419EE4: hstore_in (hstore_io.c:416)
> >
> > > Huh ...
> >
> > I tried to duplicate this on my RHEL6 workstation, and failed to,
> > even though adding an assertion easily proves that the hstore
> > regression test does exercise the case. So apparently the answer
> > as to why skink isn't reporting this is just "not all versions of
> > valgrind check it".
>
> I suspect that the issue rather is that the compiler will sometimes
> replace the memcpy() with an in-line member-by-member version. That'll
> not be visible as a memcpy to valgrind.
That's indeed the case. Here's the disassembly from skink, albeit for
v10, because those objects were currently present:
disassemble /s hstoreUniquePairs
...
342 res++;
0x00000000000005c2 <+174>: add $0x28,%rbx
343 memcpy(res, ptr, sizeof(Pairs));
0x00000000000005c6 <+178>: mov (%r12),%rax
0x00000000000005ca <+182>: mov 0x8(%r12),%rdx
0x00000000000005cf <+187>: mov %rax,(%rbx)
0x00000000000005d2 <+190>: mov %rdx,0x8(%rbx)
0x00000000000005d6 <+194>: mov 0x10(%r12),%rax
0x00000000000005db <+199>: mov 0x18(%r12),%rdx
0x00000000000005e0 <+204>: mov %rax,0x10(%rbx)
0x00000000000005e4 <+208>: mov %rdx,0x18(%rbx)
0x00000000000005e8 <+212>: mov 0x20(%r12),%rax
0x00000000000005ed <+217>: mov %rax,0x20(%rbx)
344 }
345
...
Greetings,
Andres Freund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de, tgl@sss.pgh.pa.us, tv@fuzzy.cz, simon@2ndquadrant.com
Subject: Re: pgsql: Generational memory allocator
In-Reply-To: <20171125201356.2dydqrlf2qktlog6@alap3.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox