Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
maestro-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
maestro
maestro-core
Commits
b2657c5d
Commit
b2657c5d
authored
4 years ago
by
Utz-Uwe Haus
Browse files
Options
Downloads
Patches
Plain Diff
add mstro_memlock_finalize function
parent
9b26d7af
Branches
Branches containing commit
No related tags found
2 merge requests
!3
Jsc ci update
,
!2
update JSC-CI branch to devel
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/maestro/i_memlock.h
+6
-0
6 additions, 0 deletions
include/maestro/i_memlock.h
maestro/core.c
+1
-1
1 addition, 1 deletion
maestro/core.c
maestro/memlock.c
+24
-0
24 additions, 0 deletions
maestro/memlock.c
tests/check_memlock.c
+3
-2
3 additions, 2 deletions
tests/check_memlock.c
with
34 additions
and
3 deletions
include/maestro/i_memlock.h
+
6
−
0
View file @
b2657c5d
...
@@ -83,6 +83,12 @@ mstro_memunlock(void* addr, size_t len);
...
@@ -83,6 +83,12 @@ mstro_memunlock(void* addr, size_t len);
mstro_status
mstro_status
mstro_memlock_init
(
size_t
min_required
);
mstro_memlock_init
(
size_t
min_required
);
/**@brief De-Initialize the memlock subsystem
*
*/
mstro_status
mstro_memlock_finalize
(
void
);
/**@} (end of group MSTRO_I_MEMLOCK) */
/**@} (end of group MSTRO_I_MEMLOCK) */
/**@} (end of group MSTRO_Internal) */
/**@} (end of group MSTRO_Internal) */
...
...
This diff is collapsed.
Click to expand it.
maestro/core.c
+
1
−
1
View file @
b2657c5d
...
@@ -371,7 +371,7 @@ mstro_core_finalize(void)
...
@@ -371,7 +371,7 @@ mstro_core_finalize(void)
goto
BAILOUT
;
goto
BAILOUT
;
}
}
status
=
MSTRO_OK
;
status
=
mstro_memlock_finalize
()
;
BAILOUT:
BAILOUT:
return
status
;
return
status
;
...
...
This diff is collapsed.
Click to expand it.
maestro/memlock.c
+
24
−
0
View file @
b2657c5d
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
#include
<pthread.h>
#include
<pthread.h>
#include
<sys/mman.h>
#include
<sys/mman.h>
#include
<errno.h>
#include
<errno.h>
#include
<sys/time.h>
#include
<sys/resource.h>
/* Terminology:
/* Terminology:
*
*
...
@@ -119,6 +121,28 @@ mstro_memlock_init(size_t min_required)
...
@@ -119,6 +121,28 @@ mstro_memlock_init(size_t min_required)
}
}
mstro_status
mstro_memlock_finalize
(
void
)
{
mstro_status
s
=
MSTRO_OK
;
WITH_LOCKED_PAGETABLE
({
if
(
g_locked_pages
)
{
if
(
kh_size
(
g_locked_pages
)
!=
0
)
{
ERR
(
"Table of locked page-sets nonempty: %d live entries
\n
"
,
kh_size
(
g_locked_pages
));
s
=
MSTRO_FAIL
;
}
kh_destroy
(
page_set
,
g_locked_pages
);
}
else
{
ERR
(
"called before init, or called twice
\n
"
);
}
},
BAILOUT
);
BAILOUT:
return
s
;
}
/** check whether @arg page is locked.
/** check whether @arg page is locked.
*
*
* Must be called while holding @ref g_locked_pages_mtx.
* Must be called while holding @ref g_locked_pages_mtx.
...
...
This diff is collapsed.
Click to expand it.
tests/check_memlock.c
+
3
−
2
View file @
b2657c5d
...
@@ -56,6 +56,7 @@ CHEAT_TEST(lock_unlock,
...
@@ -56,6 +56,7 @@ CHEAT_TEST(lock_unlock,
cheat_assert
(
MSTRO_OK
==
mstro_memunlock
(
x
,
8000
));
cheat_assert
(
MSTRO_OK
==
mstro_memunlock
(
x
,
8000
));
free
(
x
);
free
(
x
);
cheat_assert
(
MSTRO_OK
==
mstro_memlock_finalize
());
})
})
...
@@ -78,6 +79,7 @@ CHEAT_TEST(lock_unlock_multi,
...
@@ -78,6 +79,7 @@ CHEAT_TEST(lock_unlock_multi,
cheat_assert
(
MSTRO_FAIL
==
mstro_memunlock
(
x
,
8000
));
cheat_assert
(
MSTRO_FAIL
==
mstro_memunlock
(
x
,
8000
));
free
(
x
);
free
(
x
);
cheat_assert
(
MSTRO_OK
==
mstro_memlock_finalize
());
})
})
CHEAT_TEST
(
lock_overlapping
,
CHEAT_TEST
(
lock_overlapping
,
...
@@ -108,6 +110,5 @@ CHEAT_TEST(lock_overlapping,
...
@@ -108,6 +110,5 @@ CHEAT_TEST(lock_overlapping,
cheat_assert
(
MSTRO_OK
==
mstro_memunlock
(
start3
,
len3
));
cheat_assert
(
MSTRO_OK
==
mstro_memunlock
(
start3
,
len3
));
free
(
x
);
free
(
x
);
cheat_assert
(
MSTRO_OK
==
mstro_memlock_finalize
());
})
})
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment