On 9/26/16 9:10 PM, Tomas Vondra wrote:
Attached is v2 of the patch, updated based on the review. That means:

+ /* make sure the block can store at least one chunk (with 1B for a bitmap)? */
(and the comment below it)

I find the question to be confusing... I think these would be better as

+ /* make sure the block can store at least one chunk (with 1B for a bitmap) */
and
+ /* number of chunks can we fit into a block, including header and bitmap */

I'm also wondering if a 1B freespace bitmap is actually useful. If nothing else, there should probably be a #define for the initial bitmap size.

+       /* otherwise add it to the proper freelist bin */
Looks like something went missing... :)


Should zeroing the block in SlabAlloc be optional like it is with palloc/palloc0?

+       /*
+        * If there are no free chunks in any existing block, create a new block
+        * and put it to the last freelist bucket.
+        */
+       if (set->minFreeCount == 0)
Couldn't there be blocks that have a free count > minFreeCount? (In which case you don't want to just alloc a new block, no?)

Nevermind, after reading further down I understand what's going on. I got confused by "we've decreased nfree for a block with the minimum count" until I got to the part that deals with minFreeCount = 0. I think it'd be helpful if the "we've decreased nfree" comment mentioned that if nfree is 0 we'll look for the correct value after updating the freelists.

+       block->bitmapptr[idx/8] |= (0x01 << (idx % 8));
Did you consider using a pre-defined map of values to avoid the shift? I know I've seen that somewhere in the code...

Patch 2...

Doesn't GenSlabReset() need to actually free something? If the call magically percolates to the other contexts it'd be nice to note that in the comment.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)   mobile: 512-569-9461


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to