Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
VCL registration handler added to session for polling sessions
[vpp.git]
/
src
/
svm
/
svm.c
diff --git
a/src/svm/svm.c
b/src/svm/svm.c
index
f187fbf
..
16a58fa
100644
(file)
--- a/
src/svm/svm.c
+++ b/
src/svm/svm.c
@@
-76,9
+76,12
@@
svm_get_global_region_base_va ()
unformat_init_clib_file (&input, fd);
while (unformat_check_input (&input) != UNFORMAT_END_OF_INPUT)
{
unformat_init_clib_file (&input, fd);
while (unformat_check_input (&input) != UNFORMAT_END_OF_INPUT)
{
- unformat (&input, "%llx-%llx", &start, &end);
+ if (unformat (&input, "%llx-%llx", &start, &end))
+ end--;
unformat_skip_line (&input);
}
unformat_skip_line (&input);
}
+ unformat_free (&input);
+ close (fd);
count_leading_zeros (bits, end);
bits = 64 - bits;
count_leading_zeros (bits, end);
bits = 64 - bits;
@@
-86,9
+89,6
@@
svm_get_global_region_base_va ()
return ((1ul << bits) / 4) - (2 * SVM_GLOBAL_REGION_SIZE);
else
clib_unix_error ("unexpected va bits '%u'", bits);
return ((1ul << bits) / 4) - (2 * SVM_GLOBAL_REGION_SIZE);
else
clib_unix_error ("unexpected va bits '%u'", bits);
-
- unformat_free (&input);
- close (fd);
#endif
/* default value */
#endif
/* default value */
@@
-1034,7
+1034,7
@@
svm_region_unlink (svm_region_t * rp)
* a new region client showing up at the wrong moment.
*/
void
* a new region client showing up at the wrong moment.
*/
void
-svm_region_unmap
(void *rp_arg
)
+svm_region_unmap
_internal (void *rp_arg, u8 is_client
)
{
int i, mypid = getpid ();
int nclients_left;
{
int i, mypid = getpid ();
int nclients_left;
@@
-1134,7
+1134,12
@@
found:
vec_free (name);
region_unlock (rp);
vec_free (name);
region_unlock (rp);
- svm_region_unlink (rp);
+
+ /* If a client asks for the cleanup, don't unlink the backing
+ * file since we can't tell if it has been recreated. */
+ if (!is_client)
+ svm_region_unlink (rp);
+
munmap ((void *) virtual_base, virtual_size);
region_unlock (root_rp);
svm_pop_heap (oldheap);
munmap ((void *) virtual_base, virtual_size);
region_unlock (root_rp);
svm_pop_heap (oldheap);
@@
-1147,11
+1152,23
@@
found:
munmap ((void *) virtual_base, virtual_size);
}
munmap ((void *) virtual_base, virtual_size);
}
+void
+svm_region_unmap (void *rp_arg)
+{
+ svm_region_unmap_internal (rp_arg, 0 /* is_client */ );
+}
+
+void
+svm_region_unmap_client (void *rp_arg)
+{
+ svm_region_unmap_internal (rp_arg, 1 /* is_client */ );
+}
+
/*
* svm_region_exit
*/
/*
* svm_region_exit
*/
-void
-svm_region_exit
(
)
+
static
void
+svm_region_exit
_internal (u8 is_client
)
{
void *oldheap;
int i, mypid = getpid ();
{
void *oldheap;
int i, mypid = getpid ();
@@
-1191,7
+1208,7
@@
svm_region_exit ()
found:
found:
- if (vec_len (root_rp->client_pids) == 0)
+ if (
!is_client &&
vec_len (root_rp->client_pids) == 0)
svm_region_unlink (root_rp);
region_unlock (root_rp);
svm_region_unlink (root_rp);
region_unlock (root_rp);
@@
-1201,6
+1218,18
@@
found:
munmap ((void *) virtual_base, virtual_size);
}
munmap ((void *) virtual_base, virtual_size);
}
+void
+svm_region_exit (void)
+{
+ svm_region_exit_internal (0 /* is_client */ );
+}
+
+void
+svm_region_exit_client (void)
+{
+ svm_region_exit_internal (1 /* is_client */ );
+}
+
void
svm_client_scan_this_region_nolock (svm_region_t * rp)
{
void
svm_client_scan_this_region_nolock (svm_region_t * rp)
{