DSA on 32 bit systems

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: DSA on 32 bit systems
Date: 2017-07-12 12:34:29
Message-ID: CAEepm=0_CUq2MtiA5yKfCqGnEERm96SjjVj6fmrBmYRCcPKWVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Commit e8fdbd58fe564a29977f4331cd26f9697d76fc40 introduced fallback
atomic u64 support. PG_HAVE_ATOMIC_U64_SUPPORT now always finishes up
defined so it is pointless to test for it in dsa.h. Here's a patch to
remove the obsolete test and comment.

That raises the question of whether we should go further and use a 64
bit dsa_pointer even on 32 bit systems. In a 32 bit dsa_pointer
build, a single dsa_area is limited to 32 segments of up to 128MB in
size (actually the largest power of 2 size it can allocate at once is
64MB due to free page management overhead). The 64 bit version can
handle 1024 segments of up to 1TB, which ought to be enough for
anybody. Having just one build variant without any limits you're
likely to hit is appealing, but using oversized pointers will
presumably slow 32 bit systems down, perhaps especially for client
code that uses dsa_pointer_atomic (though I haven't tested that).

Thought experiment: To allow allocations of 256MB without reducing
the total size available with a pattern of small allocations (~1GB),
we'd have to start larger (4MB) and grow faster (double every time)
due to lack of bits to represent the segment number. That doesn't
seem very friendly to small systems, so maybe it's not a great idea to
change it. Thoughts?

If we keep 32 bit dsa_pointer, I now see that parallel hash should
probably know about this limit so it can abandon its load factor goal
rather than making a doomed allocation request.

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
tell-dsa-that-atomic-u64-is-always-available.patch application/octet-stream 902 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-07-12 12:38:56 Re: idea: custom log_line_prefix components besides application_name
Previous Message Mark Rofail 2017-07-12 12:30:21 Re: GSoC 2017: Foreign Key Arrays