Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
5570784c
Commit
5570784c
authored
9 years ago
by
Alexandr Lyapunov
Committed by
Konstantin Osipov
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
minor fixes of arena and its comments
parent
17f2bdce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/lib/small/slab_arena.c
+11
-5
11 additions, 5 deletions
src/lib/small/slab_arena.c
src/lib/small/slab_arena.h
+1
-2
1 addition, 2 deletions
src/lib/small/slab_arena.h
src/lib/small/slab_cache.c
+4
-1
4 additions, 1 deletion
src/lib/small/slab_cache.c
src/memory.cc
+1
-1
1 addition, 1 deletion
src/memory.cc
with
17 additions
and
9 deletions
src/lib/small/slab_arena.c
+
11
−
5
View file @
5570784c
...
...
@@ -42,12 +42,13 @@
#define MAP_ANONYMOUS MAP_ANON
#endif
void
static
void
munmap_checked
(
void
*
addr
,
size_t
size
)
{
if
(
munmap
(
addr
,
size
))
{
char
buf
[
64
];
intptr_t
ignore_it
=
(
intptr_t
)
strerror_r
(
errno
,
buf
,
sizeof
(
buf
));
intptr_t
ignore_it
=
(
intptr_t
)
strerror_r
(
errno
,
buf
,
sizeof
(
buf
));
(
void
)
ignore_it
;
fprintf
(
stderr
,
"Error in munmap(%p, %zu): %s
\n
"
,
addr
,
size
,
buf
);
...
...
@@ -76,7 +77,7 @@ mmap_checked(size_t size, size_t align, int flags)
munmap_checked
(
map
,
size
);
/*
* mmap
twice the requested
amount to be able to align
* mmap
enough
amount to be able to align
* the mapped address. This can lead to virtual memory
* fragmentation depending on the kernels allocation
* strategy.
...
...
@@ -187,8 +188,13 @@ slab_map(struct slab_arena *arena)
if
(
used
<=
arena
->
prealloc
)
return
arena
->
arena
+
used
-
arena
->
slab_size
;
return
mmap_checked
(
arena
->
slab_size
,
arena
->
slab_size
,
arena
->
flags
);
ptr
=
mmap_checked
(
arena
->
slab_size
,
arena
->
slab_size
,
arena
->
flags
);
if
(
!
ptr
)
{
__sync_sub_and_fetch
(
&
arena
->
used
,
arena
->
slab_size
);
quota_release
(
arena
->
quota
,
arena
->
slab_size
);
}
return
ptr
;
}
void
...
...
This diff is collapsed.
Click to expand it.
src/lib/small/slab_arena.h
+
1
−
2
View file @
5570784c
...
...
@@ -68,9 +68,8 @@ struct slab_arena {
*/
size_t
prealloc
;
/**
* How much memory in the
preallocated
arena has
* How much memory in the arena has
* already been initialized for slabs.
* @invariant used <= prealloc.
*/
size_t
used
;
/**
...
...
This diff is collapsed.
Click to expand it.
src/lib/small/slab_cache.c
+
4
−
1
View file @
5570784c
...
...
@@ -109,9 +109,12 @@ slab_is_free(struct slab *slab)
static
inline
void
slab_poison
(
struct
slab
*
slab
)
{
static
const
char
poison_char
=
'P'
;
(
void
)
slab
;
#ifndef NDEBUG
const
char
poison_char
=
'P'
;
memset
((
char
*
)
slab
+
slab_sizeof
(),
poison_char
,
slab
->
size
-
slab_sizeof
());
#endif
}
static
inline
void
...
...
This diff is collapsed.
Click to expand it.
src/memory.cc
+
1
−
1
View file @
5570784c
...
...
@@ -37,7 +37,7 @@ void
memory_init
()
{
static
struct
quota
runtime_quota
;
static
const
size_t
SLAB_SIZE
=
4
*
1024
*
1024
;
const
size_t
SLAB_SIZE
=
4
*
1024
*
1024
;
/* default quota initialization */
quota_init
(
&
runtime_quota
,
QUOTA_MAX
);
...
...
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