pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Petr Jelinek <petr@2ndquadrant.com>
To: pgsql-hackers@postgreSQL.org
Subject: Re: PATCH: two slab-like memory allocators
Date: Tue, 25 Oct 2016 17:54:47 -0500
Message-ID: <b5d04d86-5a89-457c-e82f-c52b8ebc6be6@BlueTreble.com> (raw)
In-Reply-To: <e400bfa9-bec6-0760-4e92-6416c605a001@2ndquadrant.com>
References: <d15dff83-0b37-28ed-0809-95a5cc7292ad@2ndquadrant.com>
	<c5653004-fe91-5a13-409c-db9f34642b0c@2ndquadrant.com>
	<68b837a3-ce55-f9a2-f685-9eafac536f21@2ndquadrant.com>
	<885540a7-ac72-5a21-6dae-a4d5b50672da@2ndquadrant.com>
	<03110c11-ea72-7b4d-027d-6f19eb300b2a@2ndquadrant.com>
	<e2f2e9ac-e13b-5d1b-b3c1-1799f86024bc@BlueTreble.com>
	<e400bfa9-bec6-0760-4e92-6416c605a001@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 10/1/16 7:34 PM, Tomas Vondra wrote:
>> +    /* otherwise add it to the proper freelist bin */
>> Looks like something went missing... :)
>>
>
> Ummm? The patch contains this:
>
> +    /* otherwise add it to the proper freelist bin */
> +    if (set->freelist[block->nfree])
> +        set->freelist[block->nfree]->prev = block;
> +
> +    block->next = set->freelist[block->nfree];
> +    set->freelist[block->nfree] = block;
>
> Which does exactly the thing it should do. Or what is missing?

What's confusing is the "otherwise" right at the beginning of the function:

+static void
+add_to_freelist(Slab set, SlabBlock block)
+{
+	/* otherwise add it to the proper freelist bin */
+	if (set->freelist[block->nfree])
+		set->freelist[block->nfree]->prev = block;
+
+	block->next = set->freelist[block->nfree];
+	set->freelist[block->nfree] = block;
+}

Otherwise what? What's the other option?


(Haven't looked at the newer patch, so maybe this isn't an issue anymore.)
-- 
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



view thread (97+ messages)  latest in thread

Message-ID: <b5d04d86-5a89-457c-e82f-c52b8ebc6be6@BlueTreble.com>
Permalink:  ../b5d04d86-5a89-457c-e82f-c52b8ebc6be6@BlueTreble.com/
Also on:    postgresql.org/message-id/b5d04d86-5a89-457c-e82f-c52b8ebc6be6@BlueTreble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: Jim.Nasby@BlueTreble.com, tomas.vondra@2ndquadrant.com, petr@2ndquadrant.com
  Subject: Re: PATCH: two slab-like memory allocators
  In-Reply-To: <b5d04d86-5a89-457c-e82f-c52b8ebc6be6@BlueTreble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox