Re: PATCH: two slab-like memory allocators
| От | Jim Nasby | 
|---|---|
| Тема | Re: PATCH: two slab-like memory allocators | 
| Дата | |
| Msg-id | b5d04d86-5a89-457c-e82f-c52b8ebc6be6@BlueTreble.com обсуждение исходный текст | 
| Ответ на | Re: PATCH: two slab-like memory allocators (Tomas Vondra <tomas.vondra@2ndquadrant.com>) | 
| Список | pgsql-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
		
	В списке pgsql-hackers по дате отправления: