Re: DSA failed to allocate memory

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Dongming Liu <ldming101(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DSA failed to allocate memory
Date: 2022-01-24 17:20:02
Message-ID: CA+TgmobzHdsJ1RJHXWd=os2NhcuZhkGTruAffV9cCH207=g1hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 24, 2022 at 4:59 AM Dongming Liu <ldming101(at)gmail(dot)com> wrote:
> Maybe we can use one of the following methods to fix it:
> 1. re-bin segment to suitable segment index when called dsa_free
> 2. get_best_segment search all bins

(2) is definitely the wrong idea. The comments say:

/*
* What is the lowest bin that holds segments that *might* have n contiguous
* free pages? There is no point in looking in segments in lower bins; they
* definitely can't service a request for n free pages.
*/
#define contiguous_pages_to_segment_bin(n) Min(fls(n), DSA_NUM_SEGMENT_BINS - 1)

So it's OK for a segment to be in a bin that suggests that it has more
consecutive free pages than it really does. But it's NOT ok for a
segment to be in a bin that suggests it has fewer consecutive pages
than it really does. If dsa_free() is putting things back into the
wrong place, that's what we need to fix.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2022-01-24 17:30:18 Re: preserving db/ts/relfilenode OIDs across pg_upgrade (was Re: storing an explicit nonce)
Previous Message Anton A. Melnikov 2022-01-24 17:16:06 Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements