|
14 | 14 | * Copyright (c) 2006 Voltaire. All rights reserved. |
15 | 15 | * Copyright (c) 2007 Mellanox Technologies. All rights reserved. |
16 | 16 | * Copyright (c) 2010 IBM Corporation. All rights reserved. |
17 | | - * Copyright (c) 2012-2014 NVIDIA Corporation. All rights reserved. |
| 17 | + * Copyright (c) 2012-2015 NVIDIA Corporation. All rights reserved. |
18 | 18 | * Copyright (c) 2015 Los Alamos National Security, LLC. All rights |
19 | 19 | * reserved. |
20 | 20 | * |
@@ -406,12 +406,35 @@ int mca_mpool_rgpusm_register(mca_mpool_base_module_t *mpool, void *addr, |
406 | 406 |
|
407 | 407 | opal_output_verbose(80, mca_mpool_rgpusm_component.output, |
408 | 408 | "RGPUSM: About to insert in rgpusm cache addr=%p, size=%d", addr, (int)size); |
409 | | - while((rc = mpool->rcache->rcache_insert(mpool->rcache, (mca_mpool_base_registration_t *)rgpusm_reg, |
410 | | - mca_mpool_rgpusm_component.rcache_size_limit)) == |
411 | | - OPAL_ERR_TEMP_OUT_OF_RESOURCE) { |
412 | | - opal_output(-1, "No room in the cache - boot one out"); |
413 | | - if (!mca_mpool_rgpusm_deregister_lru(mpool)) { |
414 | | - break; |
| 409 | + rc = mpool->rcache->rcache_insert(mpool->rcache, (mca_mpool_base_registration_t *)rgpusm_reg, |
| 410 | + mca_mpool_rgpusm_component.rcache_size_limit); |
| 411 | + if (OPAL_ERR_TEMP_OUT_OF_RESOURCE == rc) { |
| 412 | + opal_output_verbose(40, mca_mpool_rgpusm_component.output, |
| 413 | + "RGPUSM: No room in the cache - boot the first one out"); |
| 414 | + (void)mca_mpool_rgpusm_deregister_lru(mpool); |
| 415 | + if (mca_mpool_rgpusm_component.empty_cache) { |
| 416 | + int remNum = 1; |
| 417 | + /* Empty out every registration from LRU until it is empty */ |
| 418 | + opal_output_verbose(40, mca_mpool_rgpusm_component.output, |
| 419 | + "RGPUSM: About to delete all the unused entries in the cache"); |
| 420 | + while (mca_mpool_rgpusm_deregister_lru(mpool)) { |
| 421 | + remNum++; |
| 422 | + } |
| 423 | + opal_output_verbose(40, mca_mpool_rgpusm_component.output, |
| 424 | + "RGPUSM: Deleted and deregistered %d entries", remNum); |
| 425 | + rc = mpool->rcache->rcache_insert(mpool->rcache, (mca_mpool_base_registration_t *)rgpusm_reg, |
| 426 | + mca_mpool_rgpusm_component.rcache_size_limit); |
| 427 | + } else { |
| 428 | + /* Check for room after one removal. If not, remove another one until there is space */ |
| 429 | + while((rc = mpool->rcache->rcache_insert(mpool->rcache, (mca_mpool_base_registration_t *)rgpusm_reg, |
| 430 | + mca_mpool_rgpusm_component.rcache_size_limit)) == |
| 431 | + OPAL_ERR_TEMP_OUT_OF_RESOURCE) { |
| 432 | + opal_output_verbose(40, mca_mpool_rgpusm_component.output, |
| 433 | + "RGPUSM: No room in the cache - boot one out"); |
| 434 | + if (!mca_mpool_rgpusm_deregister_lru(mpool)) { |
| 435 | + break; |
| 436 | + } |
| 437 | + } |
415 | 438 | } |
416 | 439 | } |
417 | 440 |
|
|
0 commit comments