Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
9eeb0037
Commit
9eeb0037
authored
Nov 24, 2011
by
Cyrill Gorcunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util: Add K/M/G bytes helpers
Signed-off-by:
Cyrill Gorcunov
<
gorcunov@gmail.com
>
parent
47b7404d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
6 deletions
+21
-6
cr-restore.c
cr-restore.c
+3
-2
restorer.h
include/restorer.h
+4
-3
util.h
include/util.h
+13
-0
util.c
util.c
+1
-1
No files found.
cr-restore.c
View file @
9eeb0037
...
...
@@ -1400,7 +1400,8 @@ static void sigreturn_restore(pid_t pstree_pid, pid_t pid)
restore_thread_vma_len
+=
restore_thread_code_len
;
pr_info
(
"%d: %d threads require %dK of memory
\n
"
,
pid
,
pstree_entry
.
nr_threads
,
restore_thread_vma_len
>>
10
);
pid
,
pstree_entry
.
nr_threads
,
KBYTES
(
restore_thread_vma_len
));
break
;
}
...
...
@@ -1414,7 +1415,7 @@ static void sigreturn_restore(pid_t pstree_pid, pid_t pid)
}
else
{
pr_info
(
"Found bootstrap VMA hint at: %lx (needs ~%dK)
\n
"
,
exec_mem_hint
,
(
restore_task_vma_len
+
restore_thread_vma_len
)
>>
10
);
KBYTES
(
restore_task_vma_len
+
restore_thread_vma_len
)
);
}
/* VMA we need to run task_restore code */
...
...
include/restorer.h
View file @
9eeb0037
...
...
@@ -7,6 +7,7 @@
#include "compiler.h"
#include "types.h"
#include "image.h"
#include "util.h"
#ifndef CONFIG_X86_64
# error Only x86-64 is supported
...
...
@@ -31,9 +32,9 @@ typedef long (*thread_restore_fcall_t) (long cmd, struct thread_restore_args *ar
*/
#define RESTORE_ARGS_SIZE (512)
#define RESTORE_STACK_REDZONE (128)
#define RESTORE_STACK_SIGFRAME (
16 << 10
)
#define RESTORE_STACK_SIZE (
32 << 10
)
#define RESTORE_HEAP_SIZE (
16 << 10
)
#define RESTORE_STACK_SIGFRAME (
KILO(16)
)
#define RESTORE_STACK_SIZE (
KILO(32)
)
#define RESTORE_HEAP_SIZE (
KILO(16)
)
#define RESTORE_ALIGN_STACK(start, size) \
(ALIGN((start) + (size) - sizeof(long), sizeof(long)))
...
...
include/util.h
View file @
9eeb0037
...
...
@@ -17,6 +17,19 @@
extern
void
printk
(
const
char
*
format
,
...);
#define PREF_SHIFT_OP(pref, op, size) ((size) op (pref ##BYTES_SHIFT))
#define KBYTES_SHIFT 10
#define MBYTES_SHIFT 20
#define GBYTES_SHIFT 30
#define KBYTES(size) PREF_SHIFT_OP(K, >>, size)
#define MBYTES(size) PREF_SHIFT_OP(M, >>, size)
#define GBYTES(size) PREF_SHIFT_OP(G, >>, size)
#define KILO(size) PREF_SHIFT_OP(K, <<, size)
#define MEGA(size) PREF_SHIFT_OP(K, <<, size)
#define GIGA(size) PREF_SHIFT_OP(K, <<, size)
#define pr_info(fmt, ...) printk(fmt, ##__VA_ARGS__)
#define pr_err(fmt, ...) printk("Error (%s:%d): " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
#define pr_panic(fmt, ...) printk("PANIC (%s:%d): " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
...
...
util.c
View file @
9eeb0037
...
...
@@ -178,7 +178,7 @@ void printk_vma(struct vma_area *vma_area)
printk
(
"s: %16lx e: %16lx l: %4liK p: %8x f: %8x pg: %8lx "
"vf: %s st: %s spc: %s
\n
"
,
vma_area
->
vma
.
start
,
vma_area
->
vma
.
end
,
vma_area_len
(
vma_area
)
>>
10
,
KBYTES
(
vma_area_len
(
vma_area
))
,
vma_area
->
vma
.
prot
,
vma_area
->
vma
.
flags
,
vma_area
->
vma
.
pgoff
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment