pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Allocate freechunks bitmap as part of SlabContext
4+ messages / 1 participants
[nested] [flat]

* pgsql: Allocate freechunks bitmap as part of SlabContext
@ 2020-01-17 14:30 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Tomas Vondra @ 2020-01-17 14:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allocate freechunks bitmap as part of SlabContext

The bitmap used by SlabCheck to cross-check free chunks in a block used
to be allocated for each SlabCheck call, and was never freed. The memory
leak could be fixed by simply adding a pfree call, but it's actually a
bad idea to do any allocations in SlabCheck at all as it assumes the
state of the memory management as a whole is sane.

So instead we allocate the bitmap as part of SlabContext, which means
we don't need to do any allocations in SlabCheck and the bitmap goes
away together with the SlabContext.

Backpatch to 10, where the Slab context was introduced.

Author: Tomas Vondra
Reported-by: Andres Freund
Reviewed-by: Tom Lane
Backpatch-through: 10
Discussion: https://www.postgresql.org/message-id/20200116044119.g45f7pmgz4jmodxj%40alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/543852fd8bf0adc56192aeb25ff83f1a12c30368

Modified Files
--------------
src/backend/utils/mmgr/slab.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Allocate freechunks bitmap as part of SlabContext
@ 2020-01-17 14:31 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Tomas Vondra @ 2020-01-17 14:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allocate freechunks bitmap as part of SlabContext

The bitmap used by SlabCheck to cross-check free chunks in a block used
to be allocated for each SlabCheck call, and was never freed. The memory
leak could be fixed by simply adding a pfree call, but it's actually a
bad idea to do any allocations in SlabCheck at all as it assumes the
state of the memory management as a whole is sane.

So instead we allocate the bitmap as part of SlabContext, which means
we don't need to do any allocations in SlabCheck and the bitmap goes
away together with the SlabContext.

Backpatch to 10, where the Slab context was introduced.

Author: Tomas Vondra
Reported-by: Andres Freund
Reviewed-by: Tom Lane
Backpatch-through: 10
Discussion: https://www.postgresql.org/message-id/20200116044119.g45f7pmgz4jmodxj%40alap3.anarazel.de

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/162c951dfe8f0a894f2832e04aacfc3a0a7bf50c

Modified Files
--------------
src/backend/utils/mmgr/slab.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Allocate freechunks bitmap as part of SlabContext
@ 2020-01-17 14:31 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Tomas Vondra @ 2020-01-17 14:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allocate freechunks bitmap as part of SlabContext

The bitmap used by SlabCheck to cross-check free chunks in a block used
to be allocated for each SlabCheck call, and was never freed. The memory
leak could be fixed by simply adding a pfree call, but it's actually a
bad idea to do any allocations in SlabCheck at all as it assumes the
state of the memory management as a whole is sane.

So instead we allocate the bitmap as part of SlabContext, which means
we don't need to do any allocations in SlabCheck and the bitmap goes
away together with the SlabContext.

Backpatch to 10, where the Slab context was introduced.

Author: Tomas Vondra
Reported-by: Andres Freund
Reviewed-by: Tom Lane
Backpatch-through: 10
Discussion: https://www.postgresql.org/message-id/20200116044119.g45f7pmgz4jmodxj%40alap3.anarazel.de

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8c37e4469d13e34d80b6f561f617bd4bfe339c6c

Modified Files
--------------
src/backend/utils/mmgr/slab.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Allocate freechunks bitmap as part of SlabContext
@ 2020-01-17 14:32 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Tomas Vondra @ 2020-01-17 14:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allocate freechunks bitmap as part of SlabContext

The bitmap used by SlabCheck to cross-check free chunks in a block used
to be allocated for each SlabCheck call, and was never freed. The memory
leak could be fixed by simply adding a pfree call, but it's actually a
bad idea to do any allocations in SlabCheck at all as it assumes the
state of the memory management as a whole is sane.

So instead we allocate the bitmap as part of SlabContext, which means
we don't need to do any allocations in SlabCheck and the bitmap goes
away together with the SlabContext.

Backpatch to 10, where the Slab context was introduced.

Author: Tomas Vondra
Reported-by: Andres Freund
Reviewed-by: Tom Lane
Backpatch-through: 10
Discussion: https://www.postgresql.org/message-id/20200116044119.g45f7pmgz4jmodxj%40alap3.anarazel.de

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a801452c9e3008b473265cc690077244b65635dc

Modified Files
--------------
src/backend/utils/mmgr/slab.c | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2020-01-17 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17 14:30 pgsql: Allocate freechunks bitmap as part of SlabContext Tomas Vondra <tomas.vondra@postgresql.org>
2020-01-17 14:31 pgsql: Allocate freechunks bitmap as part of SlabContext Tomas Vondra <tomas.vondra@postgresql.org>
2020-01-17 14:31 pgsql: Allocate freechunks bitmap as part of SlabContext Tomas Vondra <tomas.vondra@postgresql.org>
2020-01-17 14:32 pgsql: Allocate freechunks bitmap as part of SlabContext Tomas Vondra <tomas.vondra@postgresql.org>

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