Re: DSA failed to allocate memory

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Dongming Liu <ldming101(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DSA failed to allocate memory
Date: 2022-03-28 07:53:20
Message-ID: CA+hUKGKvSEgXJyJPmD7tHDy+AwYeFwA+TdX1ferdOSQRswLmFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 28, 2022 at 8:14 PM Dongming Liu <ldming101(at)gmail(dot)com> wrote:
> On Fri, Mar 18, 2022 at 3:30 PM Dongming Liu <ldming101(at)gmail(dot)com> wrote:
>> I'm trying to move segments into appropriate bins in dsa_free().
>> In 0001-Re-bin-segment-when-dsa-memory-is-freed.patch, I extract
>> the re-bin segment logic into a separate function called rebin_segment,
>> call it to move the segment to the appropriate bin when dsa memory is
>> freed. Otherwise, when allocating memory, due to the segment with
>> enough contiguous pages is in a smaller bin, a suitable segment
>> may not be found to allocate memory.
>>
>> Fot test, I port the test_dsa patch from [1] and add an OOM case to
>> test memory allocation until OOM, free and then allocation, compare
>> the number of allocated memory before and after.

Hi Dongming,

Thanks for the report, and for working on the fix. Can you please
create a commitfest entry (if you haven't already)? I plan to look at
this soon, after the code freeze.

Are you proposing that the test_dsa module should be added to the
tree? If so, some trivial observations: "#ifndef
HAVE_INT64_TIMESTAMP" isn't needed anymore (see commit b6aa17e0, which
is in all supported branches), the year should be updated, and we use
size_t instead of Size in new code.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2022-03-28 07:57:59 Re: [HACKERS] WIP aPatch: Pgbench Serialization and deadlock errors
Previous Message Julien Rouhaud 2022-03-28 07:43:41 Re: Allow file inclusion in pg_hba and pg_ident files