On 15 June 2015 at 07:43, Jeff Davis <pg...@j-davis.com> wrote: > > * There was a slowdown reported of around 1-3% (depending on the exact > version of the patch) on an IBM power machine when doing an index > rebuild. The results were fairly noisy for me, but it seemed to hold up. > See http://www.postgresql.org/message-id/CA > +Tgmobnu7XEn1gRdXnFo37P79bF=qLt46=37ajp3cro9db...@mail.gmail.com
Hi Jeff, I've been looking over the code and reason the previous emails about this patch. I don't yet understand if the reported slowdown is from the increase in struct size or from the additional work being done in palloc() calls, however, on reading the code I did notice an existing redundant NULL check in AllocSetAlloc() right where you put you're extra accounting code. The attached patch should apply on top of your patch and removes the extra NULL check. Perhaps if some over the overhead is the extra instructions then this can help get us back to where we were before. Regards David Rowley -- David Rowley http://www.2ndQuadrant.com/ <http://www.2ndquadrant.com/> PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index 3c5d651..ae733d8 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -860,17 +860,16 @@ AllocSetAlloc(MemoryContext context, Size size) * We could be asking for pretty big blocks here, so cope if malloc * fails. But give up if there's less than a meg or so available... */ - while (block == NULL && blksize > 1024 * 1024) + while (block == NULL) { blksize >>= 1; - if (blksize < required_size) - break; + + /* has the block size gotten too small? */ + if (blksize < required_size || blksize <= 1024 * 1024) + return NULL; block = (AllocBlock) malloc(blksize); } - if (block == NULL) - return NULL; - context->mem_allocated += blksize; block->aset = set;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers