Commit | Line | Data |
---|---|---|
fb5bbc21 | 1 | /* $Id: mmpool.c,v 1.21 2004/05/23 13:41:46 mmondor Exp $ */ |
7a56f31f MM |
2 | |
3 | /* | |
d4aaa170 | 4 | * Copyright (C) 2001-2004, Matthew Mondor |
7a56f31f MM |
5 | * All rights reserved. |
6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * 3. All advertising materials mentioning features or use of this software | |
16 | * must display the following acknowledgement: | |
d4aaa170 | 17 | * This product includes software developed by Matthew Mondor. |
7a56f31f MM |
18 | * 4. The name of Matthew Mondor may not be used to endorse or promote |
19 | * products derived from this software without specific prior written | |
20 | * permission. | |
d4aaa170 MM |
21 | * 5. Redistribution of source code may not be released under the terms of |
22 | * any GNU Public License derivate. | |
7a56f31f MM |
23 | * |
24 | * THIS SOFTWARE IS PROVIDED BY MATTHEW MONDOR ``AS IS'' AND ANY EXPRESS OR | |
25 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
26 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
27 | * IN NO EVENT SHALL MATTHEW MONDOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
28 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
29 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |
30 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
31 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
33 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
34 | */ | |
35 | ||
36 | ||
37 | ||
38 | ||
39 | #include <sys/types.h> | |
40 | #include <stdlib.h> | |
ed396790 | 41 | #include <syslog.h> |
7a56f31f MM |
42 | |
43 | #include <mmtypes.h> | |
44 | #include <mmstring.h> | |
45 | #include <mmlist.h> | |
46 | #include <mmpool.h> | |
2556ec01 | 47 | #include <mmlog.h> |
7a56f31f MM |
48 | |
49 | ||
50 | ||
51 | ||
d4aaa170 | 52 | MMCOPYRIGHT("@(#) Copyright (c) 2001-2004\n\ |
7a56f31f | 53 | \tMatthew Mondor. All rights reserved.\n"); |
fb5bbc21 | 54 | MMRCSID("$Id: mmpool.c,v 1.21 2004/05/23 13:41:46 mmondor Exp $"); |
7a56f31f MM |
55 | |
56 | ||
57 | ||
343b3a6c MM |
58 | /* DEFINITIONS */ |
59 | ||
60 | #define BPAGE_SIZE ((size_t)OALIGN_CEIL(sizeof(bpage_t), long)) | |
61 | ||
ed396790 MM |
62 | /* Define MMPOOLDEBUG and DEBUG for extremely verbose diagnostics */ |
63 | #ifdef MMPOOLDEBUG | |
64 | #define POOL_DEBUG(s...) DPRINTF(##s) | |
65 | #else | |
a95888ea | 66 | #define POOL_DEBUG(s...) ; |
ed396790 MM |
67 | #endif |
68 | ||
343b3a6c MM |
69 | |
70 | ||
71 | /* STATIC FUNCTION PROTOTYPES */ | |
72 | ||
73 | static bpage_t *pool_page_create(const char *, pool_t *); | |
74 | static bpage_t *pool_page_destroy(bpage_t *); | |
75 | ||
76 | ||
77 | ||
78 | /* STATIC FUNCTIONS */ | |
79 | ||
80 | /* Creates a new page of objects, and calls the constructor function for each | |
81 | * object of the new page if needed. Returns NULL on failure, or the new | |
82 | * bpage_t pointer on success. | |
83 | */ | |
84 | static bpage_t *pool_page_create(const char *func, pool_t *pool) | |
85 | { | |
86 | register size_t nodesize = pool->nodesize; | |
87 | register u_int8_t *ptr, *toptr; | |
88 | register bpage_t *page; | |
89 | register list_t *list; | |
90 | ||
91 | if ((page = pool->malloc(pool->pagesize)) == NULL) { | |
221efeb4 MM |
92 | syslog(LOG_NOTICE, |
93 | "%s - Out of memory allocating page for pool_t (%s)", | |
94 | func, pool->label); | |
343b3a6c MM |
95 | return NULL; |
96 | } | |
97 | ||
98 | /* Initialize bpage_t */ | |
99 | page->magic = MAGIC_PAGE; | |
100 | page->pool = pool; | |
101 | DLIST_INIT(&page->objects); | |
102 | ||
103 | /* Create all objects of that bpage_t, inserting them into it's list_t. | |
104 | * If any object creation fails (it's optional construtor function can | |
105 | * fail), destroy the page and return NULL. | |
106 | */ | |
107 | if (pool->create != NULL) { | |
108 | for (ptr = toptr = (u_int8_t *)page, ptr += BPAGE_SIZE, | |
109 | toptr += pool->pagesize, list = &page->objects; | |
110 | ptr + nodesize < toptr; ptr += nodesize) { | |
111 | ((pnode_t *)ptr)->magic = 0; | |
112 | ((pnode_t *)ptr)->page = page; | |
113 | if (!pool->create((pnode_t *)ptr)) { | |
ed396790 | 114 | syslog(LOG_NOTICE, "%s - Page object constructor function " |
221efeb4 MM |
115 | "returned error for pool_t (%s)", |
116 | func, pool->label); | |
343b3a6c MM |
117 | return pool_page_destroy(page); |
118 | } | |
119 | DLIST_APPEND(list, (node_t *)ptr); | |
120 | } | |
121 | } else { | |
122 | for (ptr = toptr = (u_int8_t *)page, ptr += BPAGE_SIZE, | |
123 | toptr += pool->pagesize, list = &page->objects; | |
124 | ptr + nodesize < toptr; ptr += nodesize) { | |
125 | ((pnode_t *)ptr)->magic = 0; | |
126 | ((pnode_t *)ptr)->page = page; | |
127 | DLIST_APPEND(list, (node_t *)ptr); | |
128 | } | |
129 | } | |
130 | ||
131 | return page; | |
132 | } | |
133 | ||
134 | /* Destroys a page previously created using pool_page_create(), calling the | |
135 | * destructor function for each object of the page if necessary. Returns NULL. | |
136 | */ | |
137 | static bpage_t *pool_page_destroy(bpage_t *page) | |
138 | { | |
139 | register pnode_t *pnode; | |
140 | register void (*destroy)(pnode_t *); | |
141 | ||
142 | if ((destroy = (page->pool->destroy)) != NULL) { | |
143 | /* We need to destroy all objects */ | |
144 | DLIST_FOREACH(&page->objects, pnode) | |
145 | destroy(pnode); | |
146 | } | |
147 | ||
148 | page->pool->free(page); | |
149 | ||
150 | return NULL; | |
151 | } | |
152 | ||
153 | ||
154 | ||
155 | /* PUBLIC FUNCTIONS */ | |
7a56f31f | 156 | |
ed581bf0 MM |
157 | /* Initializes a memory pool for efficient management of fixed sized nodes. |
158 | * returns TRUE on success or FALSE on failure. | |
159 | */ | |
ed396790 | 160 | bool pool_init(pool_t *pool, const char *label, void *(*mallocfunc)(size_t), |
343b3a6c MM |
161 | void (*freefunc)(void *), bool (*create)(pnode_t *), |
162 | void (*destroy)(pnode_t *), size_t nodesize, u_int32_t nodesperpage, | |
7a56f31f MM |
163 | u_int32_t minpages, u_int32_t maxpages) |
164 | { | |
165 | bool ok = FALSE; | |
166 | ||
fb5bbc21 MM |
167 | DIFN (POOL_VALID(pool)) { |
168 | DPRINTF("pool_init", "Pool already initialized (%p = %s)", | |
169 | pool, pool->label); | |
170 | return FALSE; | |
171 | } | |
172 | ||
ed396790 | 173 | DIF (pool != NULL && mallocfunc != NULL && freefunc != NULL && |
343b3a6c MM |
174 | ((create != NULL && destroy != NULL) || |
175 | (void *)create == (void *)destroy) && | |
7a56f31f | 176 | nodesize != 0 && nodesperpage > 0) { |
7a56f31f | 177 | register size_t ns = (size_t)OALIGN_CEIL(nodesize, long); |
343b3a6c | 178 | register size_t ps = (BPAGE_SIZE + ((nodesperpage + 1) * ns)); |
7a56f31f MM |
179 | |
180 | pool->magic = 0; | |
ed396790 | 181 | pool->label = label; |
7a56f31f MM |
182 | pool->malloc = mallocfunc; |
183 | pool->free = freefunc; | |
343b3a6c MM |
184 | pool->create = create; |
185 | pool->destroy = destroy; | |
7a56f31f MM |
186 | pool->nodesize = ns; |
187 | pool->minpages = minpages; | |
188 | pool->maxpages = maxpages; | |
189 | pool->nodesperpage = nodesperpage; | |
190 | pool->pagesize = ps; | |
191 | pool->avgtotal = pool->avgcnt = minpages; | |
d2558e27 MM |
192 | DLIST_INIT(&pool->pages); |
193 | DLIST_INIT(&pool->fpages); | |
343b3a6c MM |
194 | DLIST_INIT(&pool->epages); |
195 | ||
196 | /* Allocate minimum number of pages, if needed. We insert them into | |
197 | * the empty pages list, but minpages will be honored as such to | |
198 | * never free pages below it. | |
199 | */ | |
7a56f31f MM |
200 | for (; minpages > 0; minpages--) { |
201 | register bpage_t *p; | |
202 | ||
343b3a6c | 203 | if ((p = pool_page_create("pool_init", pool)) == NULL) |
7a56f31f | 204 | break; |
343b3a6c | 205 | DLIST_APPEND(&pool->epages, (node_t *)p); |
7a56f31f | 206 | } |
343b3a6c MM |
207 | |
208 | /* Validate this pool */ | |
7a56f31f | 209 | pool->magic = MAGIC_POOL; |
343b3a6c MM |
210 | |
211 | /* Have we failed to allocate any needed pages? If so, destroy pool | |
212 | * and return FALSE. | |
213 | */ | |
7a56f31f MM |
214 | if (minpages == 0) |
215 | ok = TRUE; | |
343b3a6c MM |
216 | else if (minpages < pool->minpages) |
217 | (void) pool_destroy(pool); | |
218 | ||
7a56f31f | 219 | } else |
460b991b | 220 | DPRINTF("pool_init", "Invalid parameters"); |
7a56f31f | 221 | |
ed396790 MM |
222 | if (ok) |
223 | POOL_DEBUG("pool_init", "(%p = %s) initialized", pool, pool->label); | |
224 | ||
7a56f31f MM |
225 | return ok; |
226 | } | |
227 | ||
228 | ||
ed581bf0 MM |
229 | /* Destroys a pool which previously has been created by pool_init(), and frees |
230 | * any resources it uses (all the nodes it created become invalid). | |
231 | * Returns TRUE on success, or FALSE if the pool pointer is invalid. | |
232 | */ | |
7a56f31f MM |
233 | bool pool_destroy(pool_t *pool) |
234 | { | |
235 | bool ok = FALSE; | |
236 | ||
343b3a6c | 237 | /* Make sure pool_t is valid */ |
ed396790 | 238 | DIF (POOL_VALID(pool)) { |
343b3a6c | 239 | register bpage_t *p, *t; |
7a56f31f | 240 | |
ed396790 MM |
241 | POOL_DEBUG("pool_destroy", "(%p = %s) destroying", pool, pool->label); |
242 | ||
343b3a6c | 243 | /* Destroy all pages of all lists */ |
d2558e27 MM |
244 | for (p = DLIST_TOP(&pool->pages); p != NULL; p = t) { |
245 | t = DLIST_NEXT(p); | |
ed396790 | 246 | (void) pool_page_destroy(p); |
7a56f31f | 247 | } |
d2558e27 MM |
248 | for (p = DLIST_TOP(&pool->fpages); p != NULL; p = t) { |
249 | t = DLIST_NEXT(p); | |
ed396790 | 250 | (void) pool_page_destroy(p); |
343b3a6c MM |
251 | } |
252 | for (p = DLIST_TOP(&pool->epages); p != NULL; p = t) { | |
253 | t = DLIST_NEXT(p); | |
ed396790 | 254 | (void) pool_page_destroy(p); |
7a56f31f | 255 | } |
343b3a6c MM |
256 | |
257 | /* Invalidate pool_t */ | |
7a56f31f | 258 | pool->magic = 0; |
343b3a6c | 259 | |
7a56f31f MM |
260 | ok = TRUE; |
261 | } else | |
460b991b | 262 | DPRINTF("pool_destroy", "Invalid pool_t pointer (%p)", pool); |
7a56f31f MM |
263 | |
264 | return ok; | |
265 | } | |
266 | ||
267 | ||
ed581bf0 MM |
268 | /* Allows to very efficiently allocate a single node from the specified pool, |
269 | * optionally initializing it's memory to zeros. Returns the newly allocated | |
270 | * node pointer on success, or NULL on error. | |
271 | */ | |
7a56f31f MM |
272 | pnode_t *pool_alloc(pool_t *pool, bool zero) |
273 | { | |
274 | pnode_t *pnode = NULL; | |
275 | ||
ed396790 | 276 | DIF (POOL_VALID(pool)) { |
221efeb4 | 277 | DIF (!zero || pool->create == NULL) { |
343b3a6c MM |
278 | register bpage_t *page; |
279 | ||
280 | /* Are there any partially used pages? */ | |
281 | if ((page = DLIST_TOP(&pool->pages)) == NULL) { | |
282 | /* No, we thus attempt to move a page from our empty pages | |
283 | * cache back into our usable pages list. The order of the | |
284 | * usable page list becomes irrelevant at DLIST_SWAP() since | |
285 | * it will be the only node. | |
286 | */ | |
ed396790 MM |
287 | POOL_DEBUG("pool_alloc", "(%p = %s) No usable page", |
288 | pool, pool->label); | |
343b3a6c | 289 | if ((page = DLIST_TOP(&pool->epages)) == NULL) { |
8a4bbac3 MM |
290 | /* No more free pages in our cache neither. If maxpages is |
291 | * set and not yet reached, we need to create a new page. | |
292 | * If we can't, return NULL for error. | |
343b3a6c | 293 | */ |
ed396790 MM |
294 | POOL_DEBUG("pool_alloc", |
295 | "(%p = %s) No empty page", pool, pool->label); | |
8a4bbac3 | 296 | if (pool->maxpages == 0 || |
ed396790 MM |
297 | DLIST_NODES(&pool->fpages) < pool->maxpages) { |
298 | POOL_DEBUG("pool_alloc", | |
299 | "(%p = %s) Creating new usable page", | |
300 | pool, pool->label); | |
8a4bbac3 MM |
301 | if ((page = pool_page_create("pool_alloc", pool)) |
302 | == NULL) | |
303 | return NULL; | |
304 | DLIST_APPEND(&pool->pages, (node_t *)page); | |
305 | } else | |
343b3a6c | 306 | return NULL; |
ed396790 MM |
307 | } else { |
308 | POOL_DEBUG("pool_alloc", "(%p = %s) swapping page " | |
309 | "(%p) from empty to usable", | |
310 | pool, pool->label, page); | |
343b3a6c MM |
311 | DLIST_SWAP(&pool->pages, &pool->epages, (node_t *)page, |
312 | FALSE); | |
ed396790 MM |
313 | } |
314 | } else { | |
315 | POOL_DEBUG("pool_alloc", | |
316 | "(%p = %s) Allocating from usable page", | |
317 | pool, pool->label); | |
343b3a6c | 318 | } |
7a56f31f | 319 | |
343b3a6c MM |
320 | /* <page> now points to a page we know we can at least get a free |
321 | * object node from. Obtain one and unlink it. | |
322 | */ | |
323 | pnode = DLIST_TOP(&page->objects); | |
324 | DLIST_UNLINK(&page->objects, (node_t *)pnode); | |
325 | ||
326 | /* Have we obtained the last available object from this page? | |
327 | * If so, move the page to the full pages list. The order of the | |
328 | * full pages list nodes is irrelevant, since we don't know which | |
329 | * of those pages are more likely to be swapped to the usable | |
330 | * pages list first, and we won't run through that list, except at | |
331 | * pool_destroy(). | |
332 | */ | |
ed396790 MM |
333 | if (DLIST_NODES(&page->objects) == 0) { |
334 | POOL_DEBUG("pool_alloc", "(%p = %s) swapping page (%p) " | |
335 | "from usable to full list", | |
336 | pool, pool->label, page); | |
343b3a6c MM |
337 | DLIST_SWAP(&pool->fpages, &pool->pages, (node_t *)page, |
338 | FALSE); | |
ed396790 | 339 | } |
7a56f31f | 340 | |
343b3a6c MM |
341 | /* If requested, zero object. This is stupid if a constructor and |
342 | * destructor are used, but can be useful otherwise. | |
7a56f31f | 343 | */ |
343b3a6c MM |
344 | if (zero) { |
345 | page = pnode->page; | |
346 | mm_memclr(pnode, pool->nodesize); | |
347 | pnode->page = page; | |
f36e2a66 | 348 | } |
343b3a6c MM |
349 | |
350 | /* Mark this node as a valid allocated object */ | |
351 | pnode->magic = MAGIC_PNODE; | |
ed396790 MM |
352 | |
353 | POOL_DEBUG("pool_alloc", | |
354 | "(%p = %s) got object (%p) from page (%p)", | |
355 | pool, pool->label, pnode, page); | |
356 | ||
343b3a6c MM |
357 | } else |
358 | DPRINTF("pool_alloc", | |
221efeb4 MM |
359 | "Will not zero a constructed object of pool (%s)", |
360 | pool->label); | |
7a56f31f | 361 | } else |
460b991b | 362 | DPRINTF("pool_alloc", "Invalid pool_t pointer (%p)", pool); |
7a56f31f MM |
363 | |
364 | return pnode; | |
365 | } | |
366 | ||
367 | ||
ed581bf0 MM |
368 | /* Efficiently frees the specified node back to the pool it was allocated from. |
369 | * Returns NULL. Uses heuristics keeping statistics to determine when to | |
370 | * actually shrink the memory blocks internally used by the pool, so that | |
371 | * frequently growing and shrinking pools will remain large for scalability. | |
9316d0ce MM |
372 | * This also makes a big difference when constructors and destructors are used |
373 | * and need to perform a significant amount of code. | |
ed581bf0 | 374 | */ |
7a56f31f MM |
375 | pnode_t *pool_free(pnode_t *pnode) |
376 | { | |
ed396790 | 377 | DIF (PNODE_VALID(pnode)) { |
343b3a6c MM |
378 | register bpage_t *page = pnode->page; |
379 | register pool_t *pool = page->pool; | |
380 | register u_int32_t count; | |
7a56f31f | 381 | |
ed396790 MM |
382 | POOL_DEBUG("pool_free", |
383 | "(%p = %s) freeing object (%p) from page (%p)", | |
384 | pool, pool->label, pnode, page); | |
385 | ||
343b3a6c | 386 | /* Invalidate object */ |
7a56f31f | 387 | pnode->magic = 0; |
343b3a6c MM |
388 | |
389 | /* Record how many nodes there currently are in our page's object | |
390 | * list, to be used later on | |
391 | */ | |
392 | count = DLIST_NODES(&page->objects); | |
393 | ||
394 | /* Add node back to it's page's object list. Insert it so that we | |
395 | * favor reuse of recently used objects soon. | |
396 | */ | |
397 | DLIST_INSERT(&page->objects, (node_t *)pnode); | |
398 | ||
399 | /* Was this page full before we inserted our node? If so, page is in | |
400 | * full pages list. Move it to the usable pages list. Insert it to | |
ed396790 MM |
401 | * favor reuse of recently used pages soon (this page will soon return |
402 | * back to the full pages list). | |
343b3a6c | 403 | */ |
ed396790 MM |
404 | if (count == 0) { |
405 | POOL_DEBUG("pool_free", | |
406 | "(%p = %s) swapping page (%p) from full to usable list", | |
407 | pool, pool->label, page); | |
343b3a6c | 408 | DLIST_SWAP(&pool->pages, &pool->fpages, (node_t *)page, TRUE); |
ed396790 | 409 | } else { |
343b3a6c MM |
410 | /* Did we cause our node insertion to totally free back the page? |
411 | * If so, the page is on the usable free list, but move it back to | |
412 | * the empty pages list. Insert it to favor reuse of recently used | |
ed396790 MM |
413 | * pages soon (this page will be the first to used again when |
414 | * the usable pages list needs pages). | |
343b3a6c | 415 | */ |
ed396790 MM |
416 | if (++count == pool->nodesperpage) { |
417 | POOL_DEBUG("pool_free", "(%p = %s) swapping page (%p) " | |
418 | "from usable to empty list", | |
419 | pool, pool->label, page); | |
343b3a6c | 420 | DLIST_SWAP(&pool->epages, &pool->pages, (node_t *)page, TRUE); |
ed396790 | 421 | } |
343b3a6c MM |
422 | } |
423 | ||
7a56f31f MM |
424 | if ((pool->minpages < pool->maxpages) || |
425 | (pool->minpages == 0 && pool->maxpages == 0)) { | |
343b3a6c | 426 | register int exceeding; |
7a56f31f | 427 | |
343b3a6c MM |
428 | /* This pool_t is allowed to shrink. Maintain average pages usage |
429 | * to prevent destroying our pages in the empty pages list unless | |
430 | * we should. | |
7a56f31f | 431 | */ |
343b3a6c MM |
432 | count = DLIST_NODES(&pool->pages) + DLIST_NODES(&pool->fpages); |
433 | pool->avgtotal += count; | |
7a56f31f | 434 | pool->avgcnt++; |
ed396790 | 435 | |
e51f4fd7 MM |
436 | /* Using *8 here means that pool_free() needs to at least be |
437 | * called to release as much objects as can fit into eight full | |
ed396790 MM |
438 | * pages in order to execute the following block. But of course, |
439 | * this does not mean that three pages will recently have been | |
440 | * freed, since allocations probably also occured meanwhile. | |
441 | */ | |
e51f4fd7 | 442 | if (pool->avgcnt > pool->nodesperpage * 8) { |
ed396790 MM |
443 | /* Do statistics suggest that we should shrink the pool? |
444 | * If so, free pages from our empty pages cache back to the | |
cf6bb6fb MM |
445 | * system, destroying their objects if necessary. We'll make |
446 | * sure to at least leave a one page hysterisis for better | |
447 | * performance. | |
ed396790 MM |
448 | */ |
449 | if ((exceeding = (count + DLIST_NODES(&pool->epages) - 1) - | |
450 | (pool->avgtotal / pool->avgcnt)) > 0) { | |
451 | register list_t *epages = &pool->epages; | |
452 | ||
453 | POOL_DEBUG("pool_alloc()", | |
454 | "(%p = %s) Destroying %d exceeding pages", | |
455 | pool, pool->label, exceeding); | |
456 | ||
457 | /* Preferably free pages which haven't been used | |
458 | * recently | |
459 | */ | |
460 | for (; exceeding > 0 && | |
461 | (page = DLIST_BOTTOM(epages)) != NULL; | |
462 | exceeding--) { | |
463 | POOL_DEBUG("pool_free", | |
464 | "(%p = %s) destroying page (%p)", | |
465 | pool, pool->label, page); | |
466 | DLIST_UNLINK(epages, (node_t *)page); | |
467 | (void) pool_page_destroy(page); | |
468 | } | |
469 | } | |
470 | /* Reset statistics */ | |
7a56f31f | 471 | pool->avgcnt = 1; |
343b3a6c | 472 | pool->avgtotal = count; |
7a56f31f | 473 | } |
7a56f31f MM |
474 | } |
475 | } else | |
460b991b | 476 | DPRINTF("pool_free", "Invalid pnode_t pointer (%p)", pnode); |
7a56f31f MM |
477 | |
478 | return NULL; | |
479 | } |