Re: [PATCH v1 3/5] mem-pool: fill out functionality
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Apr 20, 2018, 23:21 UTC
- Message-ID
- <20180420162136.144ac5529072f22067abb3b9@google.com>
- In-Reply-To
- <20180417163400.3875-5-jamill@microsoft.com>
On Tue, 17 Apr 2018 16:34:42 +0000 Jameson Miller <jamill@microsoft.com> wrote:
Show 13 quoted lines
> @@ -19,8 +19,27 @@ struct mem_pool {
>
> /* The total amount of memory allocated by the pool. */
> size_t pool_alloc;
> +
> + /*
> + * Array of pointers to "custom size" memory allocations.
> + * This is used for "large" memory allocations.
> + * The *_end variables are used to track the range of memory
> + * allocated.
> + */
> + void **custom, **custom_end;
> + int nr, nr_end, alloc, alloc_end;This seems overly complicated - the struct mem_pool already has a linked list of pages, so couldn't you create a custom page and insert it behind the current front page instead whenever you needed a large-size page?
Also, when combining, there could be some wasted space on one of the pages. I'm not sure if that's worth calling out, though.