diff options
author | Damjan Marion <damarion@cisco.com> | 2019-01-23 12:50:24 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2019-01-23 12:50:24 +0100 |
commit | 78c0ff758fe85a4e8cd1f4248b84016a0d826752 (patch) | |
tree | 94bee0a51d76a4bbdf8a18f6c9c9977a21909987 /src | |
parent | 33cc5cfd04093d2da781cd3591d0da905873f865 (diff) |
pmalloc: don't iterate if there is no enough free space
Change-Id: I975d46a82e9f884a9cd0ac2bd5f57181695f4124
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vppinfra/pmalloc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c index 41309dd1d99..5662a36939e 100644 --- a/src/vppinfra/pmalloc.c +++ b/src/vppinfra/pmalloc.c @@ -138,6 +138,9 @@ alloc_chunk_from_page (clib_pmalloc_main_t * pm, clib_pmalloc_page_t * pp, pp->n_free_chunks = a->subpages_per_page; } + if (pp->n_free_blocks < n_blocks) + return 0; + alloc_chunk_index = pp->first_chunk_index; next_chunk: |