Re: [PATCH] Fix crash in int8_avg_combine().

From: Hadi Moshayedi <hadi(at)moshayedi(dot)net>
To: Andres Freund <andres(at)citusdata(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Ozgun Erdogan <ozgun(at)citusdata(dot)com>, Sumedh Pathak <sumedh(at)citusdata(dot)com>
Subject: Re: [PATCH] Fix crash in int8_avg_combine().
Date: 2017-11-27 21:17:09
Message-ID: CAK=1=WpRBFbDofKKDAzgmdQjJq8CBNkwwddFDcp4wxqLS9J6rA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 25, 2017 at 10:47 PM, Andres Freund <andres(at)citusdata(dot)com>
wrote:

> diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h
> > index 869c59dc85..2dc59e89cd 100644
> > --- a/src/include/utils/memutils.h
> > +++ b/src/include/utils/memutils.h
> > @@ -189,7 +189,7 @@ extern MemoryContext SlabContextCreate(MemoryContext
> parent,
> > * Few callers should be interested in this, but tuplesort/tuplestore
> need
> > * to know it.
> > */
> > -#define ALLOCSET_SEPARATE_THRESHOLD 8192
> > +#define ALLOCSET_SEPARATE_THRESHOLD 16384
>
> Huh, what's that about in this context?
>

There is following static assert:

StaticAssertStmt(ALLOC_CHUNK_LIMIT == ALLOCSET_SEPARATE_THRESHOLD, ...)

and ALLOCK_CHUNK_LIMIT is defined as:

#define ALLOC_CHUNK_LIMIT (1 << (ALLOCSET_NUM_FREELISTS-1+ALLOC_MINBITS))

and there is this comment:

"CAUTION: ALLOC_MINBITS must be large enough so that 1<<ALLOC_MINBITS is at
least MAXALIGN, ..."

So I increased ALLOC_MINBITS which resulted in doubling
ALLOCSET_SEPARATE_THRESHOLD.

Thanks,
-- Hadi

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2017-11-27 21:34:31 Re: [HACKERS] Transactions involving multiple postgres foreign servers
Previous Message Hadi Moshayedi 2017-11-27 21:12:25 Re: [PATCH] Fix crash in int8_avg_combine().