Re: Oversight in slab.c SlabContextCreate(), initial memory allocation size is not populated to context->mem_allocated

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: tomas(dot)vondra(at)enterprisedb(dot)com
Cc: nathandbossart(at)gmail(dot)com, tgl(at)sss(dot)pgh(dot)pa(dot)us, reid(dot)thompson(at)crunchydata(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Oversight in slab.c SlabContextCreate(), initial memory allocation size is not populated to context->mem_allocated
Date: 2022-08-01 07:57:44
Message-ID: 20220801.165744.517561753479500363.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Fri, 29 Jul 2022 21:16:51 +0200, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> wrote in
> I don't think this can make meaningful difference - as you mention, we
> only really use this to decide when to spill to disk etc. So maybe
> you'll spill a bit sooner, but the work_mem is pretty crude threshold
> anyway, people don't tune it to an exact byte value (which would be
> pretty futile anyway).

From another perspective.. SlabStats includes the header size into
its total size. So it reports a different total size from
MemoryContextMemAllocated() (For example, 594 bytes vs 0). Since this
is an inconsistency within slab.c, no users will notice that
difference in the field.

> OTOH it does seem like an oversight, or at least an inconsistency with
> the two other contexts, so if anyone feels like tweaking it ...

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2022-08-01 08:02:21 Re: Handle infinite recursion in logical replication setup
Previous Message Dong Wook Lee 2022-08-01 06:27:54 Re: Add test of pg_prewarm extenion