Function report |
Source Code:mm\mempool.c |
Create Date:2022-07-28 14:04:42 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:mempool_resize - resize an existing memory pool*@pool: pointer to the memory pool which was allocated via* mempool_create().*@new_min_nr: the new minimum number of elements guaranteed to be* allocated for this pool.* This function shrinks/grows the pool
Proto:int mempool_resize(mempool_t *pool, int new_min_nr)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| mempool_t * | pool | |
| int | new_min_nr |
| 305 | BUG_ON(new_min_nr <= 0) |
| 306 | might_sleep() |
| 308 | spin_lock_irqsave( & lock, flags) |
| 309 | If new_min_nr <= nr of elements at *elements Then |
| 310 | When new_min_nr < Current nr of elements at *elements cycle |
| 311 | element = remove_element(pool) |
| 312 | spin_unlock_irqrestore( & lock, flags) |
| 314 | spin_lock_irqsave( & lock, flags) |
| 317 | Go to out_unlock |
| 319 | spin_unlock_irqrestore( & lock, flags) |
| 322 | new_elements = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc). |
| 324 | If Not new_elements Then Return -ENOMEM |
| 327 | spin_lock_irqsave( & lock, flags) |
| 330 | spin_unlock_irqrestore( & lock, flags) |
| 332 | Go to out |
| 334 | memcpy(new_elements, elements, Current nr of elements at *elements * size of new_elements ) |
| 337 | elements = new_elements |
| 341 | spin_unlock_irqrestore( & lock, flags) |
| 342 | element = alloc(GFP_KERNEL, pool_data) |
| 345 | spin_lock_irqsave( & lock, flags) |
| 347 | add_element(pool, element) |
| 348 | Else |
| 354 | out_unlock : |
| 355 | spin_unlock_irqrestore( & lock, flags) |
| 356 | out : |
| 357 | Return 0 |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |