2 *------------------------------------------------------------------
3 * svm.c - shared VM allocation, mmap(...MAP_FIXED...)
6 * Copyright (c) 2009 Cisco and/or its affiliates.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at:
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *------------------------------------------------------------------
23 #include <sys/types.h>
26 #include <netinet/in.h>
33 #include <vppinfra/clib.h>
34 #include <vppinfra/vec.h>
35 #include <vppinfra/hash.h>
36 #include <vppinfra/bitmap.h>
37 #include <vppinfra/fifo.h>
38 #include <vppinfra/time.h>
39 #include <vppinfra/mheap.h>
40 #include <vppinfra/heap.h>
41 #include <vppinfra/pool.h>
42 #include <vppinfra/format.h>
46 static svm_region_t *root_rp;
47 static int root_rp_refcount;
50 static pthread_mutex_t *mutexes_held [MAXLOCK];
53 svm_region_t *svm_get_root_rp (void)
60 static void region_lock(svm_region_t *rp, int tag)
62 pthread_mutex_lock(&rp->mutex);
64 rp->mutex_owner_pid = getpid();
65 rp->mutex_owner_tag = tag;
67 ASSERT(nheld < MAXLOCK);
69 * Keep score of held mutexes so we can try to exit
70 * cleanly if the world comes to an end at the worst possible
73 mutexes_held [nheld++] = &rp->mutex;
76 static void region_unlock(svm_region_t *rp)
80 rp->mutex_owner_pid = 0;
81 rp->mutex_owner_tag = 0;
84 for (i = nheld-1; i >= 0; i--) {
85 if (mutexes_held[i] == &rp->mutex) {
86 for (j = i; j < MAXLOCK-1; j++)
87 mutexes_held[j] = mutexes_held[j+1];
95 CLIB_MEMORY_BARRIER();
96 pthread_mutex_unlock(&rp->mutex);
100 static u8 * format_svm_flags (u8 * s, va_list * args)
102 uword f = va_arg (*args, uword);
104 if (f & SVM_FLAGS_MHEAP)
105 s = format (s, "MHEAP ");
106 if (f & SVM_FLAGS_FILE)
107 s = format (s, "FILE ");
108 if (f & SVM_FLAGS_NODATA)
109 s = format (s, "NODATA ");
110 if (f & SVM_FLAGS_NEED_DATA_INIT)
111 s = format (s, "INIT ");
116 static u8 * format_svm_size (u8 * s, va_list * args)
118 uword size = va_arg (*args, uword);
120 if (size >= (1<<20)) {
121 s = format (s, "(%d mb)", size >> 20);
122 } else if (size >= (1<<10)) {
123 s = format (s, "(%d kb)", size >> 10);
125 s = format (s, "(%d bytes)", size);
130 u8 * format_svm_region (u8 * s, va_list * args)
132 svm_region_t *rp = va_arg (*args, svm_region_t *);
133 int verbose = va_arg (*args, int);
137 s = format (s, "%s: base va 0x%x size 0x%x %U\n",
138 rp->region_name, rp->virtual_base,
139 rp->virtual_size, format_svm_size, rp->virtual_size);
140 s = format (s, " user_ctx 0x%x, bitmap_size %d\n",
141 rp->user_ctx, rp->bitmap_size);
144 s = format (s, " flags: 0x%x %U\n", rp->flags,
145 format_svm_flags, rp->flags);
147 " region_heap 0x%x data_base 0x%x data_heap 0x%x\n",
148 rp->region_heap, rp->data_base, rp->data_heap);
151 s = format (s, " %d clients, pids: ",
152 vec_len(rp->client_pids));
154 for (i = 0; i < vec_len(rp->client_pids); i++)
155 s = format (s, "%d ", rp->client_pids[i]);
157 s = format (s, "\n");
162 s = format (s, " VM in use: ");
164 for (i = 0; i < rp->bitmap_size; i++) {
165 if (clib_bitmap_get_no_check (rp->bitmap, i) != 0) {
167 hi = lo = rp->virtual_base + i*MMAP_PAGESIZE;
169 hi = rp->virtual_base + i*MMAP_PAGESIZE;
173 hi = rp->virtual_base + i*MMAP_PAGESIZE -1;
174 s = format (s, " 0x%x - 0x%x (%dk)\n", lo, hi,
180 s = format (s, " rgn heap stats: %U", format_mheap,
182 if ((rp->flags & SVM_FLAGS_MHEAP) && rp->data_heap) {
183 s = format (s, "\n data heap stats: %U", format_mheap,
186 s = format (s, "\n");
194 * Round to a pagesize multiple, presumably 4k works
196 static unsigned int rnd_pagesize(unsigned int size)
200 rv = (size + (MMAP_PAGESIZE-1)) & ~(MMAP_PAGESIZE-1);
205 * svm_data_region_setup
207 static int svm_data_region_create (svm_map_region_args_t *a,
214 map_size = rp->virtual_size - (MMAP_PAGESIZE + SVM_PVT_MHEAP_SIZE);
216 if (a->flags & SVM_FLAGS_FILE) {
219 fd = open (a->backing_file, O_RDWR | O_CREAT, 0777);
222 clib_unix_warning ("open");
226 if (fstat(fd, &statb) < 0) {
227 clib_unix_warning("fstat");
231 if (statb.st_mode & S_IFREG) {
232 if (statb.st_size == 0) {
233 lseek(fd, map_size, SEEK_SET);
234 if (write(fd, &junk, 1) != 1)
235 clib_unix_warning ("set region size");
237 map_size = rnd_pagesize (statb.st_size);
240 map_size = a->backing_mmap_size;
243 ASSERT(map_size <= rp->virtual_size -
244 (MMAP_PAGESIZE + SVM_PVT_MHEAP_SIZE));
246 if (mmap (rp->data_base, map_size, PROT_READ | PROT_WRITE,
247 MAP_SHARED | MAP_FIXED, fd, 0) == MAP_FAILED) {
248 clib_unix_warning("mmap");
252 rp->backing_file = (char *) format(0, "%s\0", a->backing_file);
253 rp->flags |= SVM_FLAGS_FILE;
256 if (a->flags & SVM_FLAGS_MHEAP) {
258 mheap_alloc_with_flags ((void *)(rp->data_base), map_size,
259 MHEAP_FLAG_DISABLE_VM);
260 rp->flags |= SVM_FLAGS_MHEAP;
265 static int svm_data_region_map (svm_map_region_args_t *a,
273 map_size = rp->virtual_size - (MMAP_PAGESIZE + SVM_PVT_MHEAP_SIZE);
275 if (a->flags & SVM_FLAGS_FILE) {
277 fd = open (a->backing_file, O_RDWR, 0777);
280 clib_unix_warning ("open");
284 if (fstat(fd, &statb) < 0) {
285 clib_unix_warning("fstat");
289 if (statb.st_mode & S_IFREG) {
290 if (statb.st_size == 0) {
291 lseek(fd, map_size, SEEK_SET);
292 if (write(fd, &junk, 1) != 1)
293 clib_unix_warning ("set region size");
295 map_size = rnd_pagesize (statb.st_size);
298 map_size = a->backing_mmap_size;
301 ASSERT(map_size <= rp->virtual_size
302 - (MMAP_PAGESIZE + SVM_PVT_MHEAP_SIZE));
304 if (mmap (rp->data_base, map_size, PROT_READ | PROT_WRITE,
305 MAP_SHARED | MAP_FIXED, fd, 0) == MAP_FAILED) {
306 clib_unix_warning("mmap");
314 u8 *shm_name_from_svm_map_region_args (svm_map_region_args_t *a)
320 int root_path_offset = 0;
324 /* Tolerate present or absent slashes */
325 if (a->root_path[0] == '/')
328 /* create the root_path under /dev/shm
329 iterate through path creating directories */
331 path = format (0, "/dev/shm/%s%c", &a->root_path[root_path_offset], 0);
332 split_point = path+1;
333 vec_add1(mkdir_arg, '-');
335 while (*split_point) {
336 while (*split_point && *split_point != '/') {
337 vec_add1 (mkdir_arg, *split_point);
340 vec_add1 (mkdir_arg, 0);
342 /* ready to descend another level */
343 mkdir_arg[vec_len(mkdir_arg)-1] = '-';
349 if (a->name[0] == '/')
352 shm_name = format (0, "/%s-%s%c", a->root_path,
353 &a->name[name_offset], 0);
356 shm_name = format (0, "%s%c", a->name, 0);
363 void *svm_map_region (svm_map_region_args_t *a)
367 pthread_mutexattr_t attr;
368 pthread_condattr_t cattr;
375 int nbits, words, bit;
376 int pid_holding_region_lock;
378 int dead_region_recovery = 0;
381 struct timespec ts, tsrem;
384 clib_warning ("[%d] map region %s", getpid(), a->name);
386 ASSERT((a->size & ~(MMAP_PAGESIZE-1)) == a->size);
389 shm_name = shm_name_from_svm_map_region_args (a);
391 svm_fd = shm_open((char *) shm_name, O_RDWR | O_CREAT | O_EXCL, 0777);
397 lseek(svm_fd, a->size, SEEK_SET);
398 if (write(svm_fd, &junk, 1) != 1)
399 clib_warning ("set region size");
401 rp = mmap((void *)a->baseva, a->size,
402 PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, svm_fd, 0);
404 if (rp == (svm_region_t *) MAP_FAILED) {
405 clib_unix_warning ("mmap create");
409 memset(rp, 0, sizeof(*rp));
411 if (pthread_mutexattr_init(&attr))
412 clib_unix_warning("mutexattr_init");
414 if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
415 clib_unix_warning("mutexattr_setpshared");
417 if (pthread_mutex_init(&rp->mutex, &attr))
418 clib_unix_warning("mutex_init");
420 if (pthread_mutexattr_destroy(&attr))
421 clib_unix_warning("mutexattr_destroy");
423 if (pthread_condattr_init(&cattr))
424 clib_unix_warning("condattr_init");
426 if (pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED))
427 clib_unix_warning("condattr_setpshared");
429 if (pthread_cond_init(&rp->condvar, &cattr))
430 clib_unix_warning("cond_init");
432 if(pthread_condattr_destroy(&cattr))
433 clib_unix_warning("condattr_destroy");
437 rp->virtual_base = a->baseva;
438 rp->virtual_size = a->size;
441 mheap_alloc_with_flags ((void *)(a->baseva+MMAP_PAGESIZE),
443 MHEAP_FLAG_DISABLE_VM);
444 oldheap = svm_push_pvt_heap(rp);
446 rp->region_name = (char *)format (0, "%s%c", a->name, 0);
447 vec_add1(rp->client_pids, getpid());
449 nbits = rp->virtual_size / MMAP_PAGESIZE;
452 rp->bitmap_size = nbits;
453 words = (nbits + BITS(uword)-1) / BITS(uword);
454 vec_validate (rp->bitmap, words-1);
456 overhead_space = MMAP_PAGESIZE /* header */ +
460 data_base = (uword)rp->virtual_base;
462 if (a->flags & SVM_FLAGS_NODATA)
463 rp->flags |= SVM_FLAGS_NEED_DATA_INIT;
466 clib_bitmap_set_no_check (rp->bitmap, bit, 1);
468 overhead_space -= MMAP_PAGESIZE;
469 data_base += MMAP_PAGESIZE;
470 } while (overhead_space > 0);
472 rp->data_base = (void *)data_base;
475 * Note: although the POSIX spec guarantees that only one
476 * process enters this block, we have to play games
477 * to hold off clients until e.g. the mutex is ready
479 rp->version = SVM_VERSION;
481 /* setup the data portion of the region */
483 rv = svm_data_region_create (a, rp);
485 clib_warning ("data_region_create: %d", rv);
490 svm_pop_heap(oldheap);
492 return ((void *) rp);
494 svm_fd = shm_open((char *)shm_name, O_RDWR, 0777);
499 perror("svm_region_map(mmap open)");
505 if (0 != fstat(svm_fd, &stat)) {
506 clib_warning("fstat failed: %d", errno);
509 if (stat.st_size > 0) {
512 if (0 == time_left) {
513 clib_warning("waiting for resize of shm file timed out");
517 ts.tv_nsec = 100000000;
518 while (nanosleep(&ts, &tsrem) < 0)
523 rp = mmap(0, MMAP_PAGESIZE,
524 PROT_READ | PROT_WRITE, MAP_SHARED, svm_fd, 0);
526 if (rp == (svm_region_t *) MAP_FAILED) {
528 clib_warning("mmap");
532 * We lost the footrace to create this region; make sure
533 * the winner has crossed the finish line.
535 while (rp->version == 0 && deadman++ < 5) {
542 if (rp->version == 0) {
545 clib_warning("rp->version %d not %d", rp->version,
549 /* Remap now that the region has been placed */
550 a->baseva = rp->virtual_base;
551 a->size = rp->virtual_size;
552 munmap(rp, MMAP_PAGESIZE);
554 rp = (void *) mmap ((void *)a->baseva, a->size,
555 PROT_READ | PROT_WRITE,
556 MAP_SHARED | MAP_FIXED, svm_fd, 0);
557 if ((uword)rp == (uword)MAP_FAILED) {
558 clib_unix_warning ("mmap");
562 if ((uword) rp != rp->virtual_base) {
563 clib_warning("mmap botch");
567 * Try to fix the region mutex if it is held by
570 pid_holding_region_lock = rp->mutex_owner_pid;
571 if (pid_holding_region_lock &&
572 kill (pid_holding_region_lock, 0) < 0) {
574 "region %s mutex held by dead pid %d, tag %d, force unlock",
575 rp->region_name, pid_holding_region_lock, rp->mutex_owner_tag);
576 /* owner pid is nonexistent */
577 rp->mutex.__data.__owner = 0;
578 rp->mutex.__data.__lock = 0;
579 dead_region_recovery = 1;
582 if (dead_region_recovery)
583 clib_warning ("recovery: attempt to re-lock region");
586 oldheap = svm_push_pvt_heap (rp);
587 vec_add1(rp->client_pids, getpid());
589 if (dead_region_recovery)
590 clib_warning ("recovery: attempt svm_data_region_map");
592 rv = svm_data_region_map (a, rp);
594 clib_warning ("data_region_map: %d", rv);
597 if (dead_region_recovery)
598 clib_warning ("unlock and continue");
602 svm_pop_heap(oldheap);
604 return ((void *) rp);
607 return 0; /* NOTREACHED */
610 static void svm_mutex_cleanup (void)
613 for (i = 0; i < nheld; i++) {
614 pthread_mutex_unlock (mutexes_held[i]);
618 static void svm_region_init_internal (char *root_path)
621 svm_map_region_args_t *a=0;
622 u64 ticks = clib_cpu_time_now();
623 uword randomize_baseva;
625 /* guard against klutz calls */
630 atexit(svm_mutex_cleanup);
632 /* Randomize the shared-VM base at init time */
633 if (MMAP_PAGESIZE <= (4<<10))
634 randomize_baseva = (ticks & 15) * MMAP_PAGESIZE;
636 randomize_baseva = (ticks & 3) * MMAP_PAGESIZE;
639 a->root_path = root_path;
640 a->name = SVM_GLOBAL_REGION_NAME;
641 a->baseva = SVM_GLOBAL_REGION_BASEVA + randomize_baseva;
642 a->size = SVM_GLOBAL_REGION_SIZE;
643 a->flags = SVM_FLAGS_NODATA;
645 rp = svm_map_region (a);
650 /* Set up the main region data structures */
651 if (rp->flags & SVM_FLAGS_NEED_DATA_INIT) {
652 svm_main_region_t *mp = 0;
655 rp->flags &= ~(SVM_FLAGS_NEED_DATA_INIT);
657 oldheap = svm_push_pvt_heap (rp);
658 vec_validate (mp, 0);
659 mp->name_hash = hash_create_string (0, sizeof(uword));
660 mp->root_path = root_path
661 ? format (0, "%s%c", root_path, 0) : 0 ;
663 svm_pop_heap (oldheap);
670 void svm_region_init (void)
672 svm_region_init_internal (0);
675 void svm_region_init_chroot (char *root_path)
677 svm_region_init_internal (root_path);
680 void *svm_region_find_or_create (svm_map_region_args_t *a)
682 svm_main_region_t *mp;
689 svm_subregion_t *subp;
693 a->size += MMAP_PAGESIZE + SVM_PVT_MHEAP_SIZE;
694 a->size = rnd_pagesize(a->size);
696 region_lock (root_rp, 4);
697 oldheap = svm_push_pvt_heap(root_rp);
698 mp = root_rp->data_base;
702 /* Map the named region from the correct chroot environment */
703 a->root_path = (char *) mp->root_path;
706 * See if this region is already known. If it is, we're
709 p = hash_get_mem (mp->name_hash, a->name);
712 rp = svm_map_region (a);
713 region_unlock(root_rp);
714 svm_pop_heap (oldheap);
718 /* Create the region. */
719 ASSERT((a->size & ~(MMAP_PAGESIZE-1)) == a->size);
721 need_nbits = a->size / MMAP_PAGESIZE;
723 index = 1; /* $$$ fixme, figure out how many bit to really skip */
726 * Scan the virtual space allocation bitmap, looking for a large
730 if (clib_bitmap_get_no_check(root_rp->bitmap, index) == 0) {
731 for (i = 0; i < (need_nbits-1); i++) {
732 if (clib_bitmap_get_no_check(root_rp->bitmap,
742 } while (index < root_rp->bitmap_size);
744 /* Completely out of VM? */
745 if (index >= root_rp->bitmap_size) {
746 clib_warning("region %s: not enough VM to allocate 0x%x",
747 root_rp->region_name, a->size);
748 svm_pop_heap (oldheap);
749 region_unlock (root_rp);
754 * Mark virtual space allocated
757 clib_warning ("set %d bits at index %d", need_nbits, index);
760 for (i = 0; i < need_nbits; i++) {
761 clib_bitmap_set_no_check (root_rp->bitmap, index+i, 1);
764 /* Place this region where it goes... */
765 a->baseva = root_rp->virtual_base + index*MMAP_PAGESIZE;
767 rp = svm_map_region (a);
769 pool_get (mp->subregions, subp);
770 name = format (0, "%s%c", a->name, 0);
771 subp->subregion_name = name;
773 hash_set_mem (mp->name_hash, name, subp - mp->subregions);
775 svm_pop_heap (oldheap);
777 region_unlock (root_rp);
785 * Let go of the indicated region. If the calling process
786 * is the last customer, throw it away completely.
787 * The root region mutex guarantees atomicity with respect to
788 * a new region client showing up at the wrong moment.
790 void svm_region_unmap (void *rp_arg)
792 int i, mypid = getpid();
795 uword virtual_base, virtual_size;
796 svm_region_t *rp = rp_arg;
800 * If we take a signal while holding one or more shared-memory
801 * mutexes, we may end up back here from an otherwise
802 * benign exit handler. Bail out to avoid a recursive
812 clib_warning ("[%d] unmap region %s", getpid(), rp->region_name);
814 region_lock (root_rp, 5);
817 oldheap = svm_push_pvt_heap (rp); /* nb vec_delete() in the loop */
819 /* Remove the caller from the list of mappers */
820 for (i = 0; i < vec_len(rp->client_pids); i++) {
821 if (rp->client_pids[i] == mypid) {
822 vec_delete (rp->client_pids, 1, i);
826 clib_warning("pid %d AWOL", mypid);
830 svm_pop_heap (oldheap);
832 nclients_left = vec_len(rp->client_pids);
833 virtual_base = rp->virtual_base;
834 virtual_size = rp->virtual_size;
836 if (nclients_left == 0) {
838 svm_main_region_t *mp;
840 svm_subregion_t *subp;
842 /* Kill the region, last guy on his way out */
844 oldheap = svm_push_pvt_heap (root_rp);
845 name = vec_dup (rp->region_name);
847 virtual_base = rp->virtual_base;
848 virtual_size = rp->virtual_size;
850 /* Figure out which bits to clear in the root region bitmap */
851 index = (virtual_base - root_rp->virtual_base)
854 nbits = (virtual_size + MMAP_PAGESIZE - 1)
858 clib_warning ("clear %d bits at index %d", nbits, index);
860 /* Give back the allocated VM */
861 for (i = 0; i < nbits; i++) {
862 clib_bitmap_set_no_check (root_rp->bitmap, index+i, 0);
865 mp = root_rp->data_base;
867 p = hash_get_mem (mp->name_hash, name);
869 /* Better never happen ... */
872 region_unlock (root_rp);
873 svm_pop_heap (oldheap);
874 clib_warning ("Region name '%s' not found?", name);
878 /* Remove from the root region subregion pool */
879 subp = mp->subregions + p[0];
880 pool_put (mp->subregions, subp);
882 hash_unset_mem (mp->name_hash, name);
887 shm_unlink(rp->region_name);
888 munmap ((void *)virtual_base, virtual_size);
889 region_unlock (root_rp);
890 svm_pop_heap (oldheap);
895 region_unlock(root_rp);
897 munmap ((void *)virtual_base, virtual_size);
902 * There is no clean way to unlink the
903 * root region when all clients go away,
904 * so remove the pid entry and call it a day.
906 void svm_region_exit ()
909 int i, mypid = getpid();
910 uword virtual_base, virtual_size;
912 /* It felt so nice we did it twice... */
916 if (--root_rp_refcount > 0)
920 * If we take a signal while holding one or more shared-memory
921 * mutexes, we may end up back here from an otherwise
922 * benign exit handler. Bail out to avoid a recursive
928 region_lock(root_rp, 7);
929 oldheap = svm_push_pvt_heap (root_rp);
931 virtual_base = root_rp->virtual_base;
932 virtual_size = root_rp->virtual_size;
934 for (i = 0; i < vec_len(root_rp->client_pids); i++) {
935 if (root_rp->client_pids[i] == mypid) {
936 vec_delete (root_rp->client_pids, 1, i);
940 clib_warning("pid %d AWOL", mypid);
944 region_unlock(root_rp);
945 svm_pop_heap (oldheap);
948 munmap ((void *)virtual_base, virtual_size);
951 void svm_client_scan_this_region_nolock (svm_region_t *rp)
954 int mypid = getpid();
957 for (j = 0; j < vec_len(rp->client_pids); j++) {
958 if (mypid == rp->client_pids[j])
960 if (rp->client_pids[j] && (kill (rp->client_pids[j], 0) < 0)) {
961 clib_warning ("%s: cleanup ghost pid %d",
962 rp->region_name, rp->client_pids[j]);
963 /* nb: client vec in rp->region_heap */
964 oldheap = svm_push_pvt_heap (rp);
965 vec_delete (rp->client_pids, 1, j);
967 svm_pop_heap (oldheap);
974 * Scan svm regions for dead clients
976 void svm_client_scan(char *root_path)
979 svm_main_region_t *mp;
980 svm_map_region_args_t *a = 0;
981 svm_region_t *root_rp;
983 svm_subregion_t *subp;
987 int mypid = getpid();
991 svm_region_init_chroot(root_path);
993 root_rp = svm_get_root_rp();
995 pthread_mutex_lock (&root_rp->mutex);
997 mp = root_rp->data_base;
999 for (j = 0; j < vec_len (root_rp->client_pids); j++) {
1000 if (mypid == root_rp->client_pids[j])
1002 if (root_rp->client_pids[j]
1003 && (kill (root_rp->client_pids[j], 0) < 0)) {
1004 clib_warning ("%s: cleanup ghost pid %d",
1005 root_rp->region_name, root_rp->client_pids[j]);
1006 /* nb: client vec in root_rp->region_heap */
1007 oldheap = svm_push_pvt_heap (root_rp);
1008 vec_delete (root_rp->client_pids, 1, j);
1010 svm_pop_heap (oldheap);
1015 * Snapshoot names, can't hold root rp mutex across
1018 pool_foreach (subp, mp->subregions, ({
1019 name = vec_dup (subp->subregion_name);
1020 vec_add1(svm_names, name);
1023 pthread_mutex_unlock (&root_rp->mutex);
1025 for (i = 0; i < vec_len(svm_names); i++) {
1027 a->root_path = root_path;
1028 a->name = (char *) svm_names[i];
1029 rp = svm_region_find_or_create (a);
1031 pthread_mutex_lock (&rp->mutex);
1033 svm_client_scan_this_region_nolock (rp);
1035 pthread_mutex_unlock (&rp->mutex);
1036 svm_region_unmap (rp);
1037 vec_free(svm_names[i]);
1041 vec_free(svm_names);