Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
5db263ce
Commit
5db263ce
authored
Oct 04, 2022
by
Jonas Kaufmann
Browse files
fix farmem module not draining all memory
parent
7c994f2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
images/farmem/farmem_main.c
images/farmem/farmem_main.c
+8
-1
No files found.
images/farmem/farmem_main.c
View file @
5db263ce
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include<linux/kernel.h>
#include<linux/kernel.h>
#include <linux/memory_hotplug.h>
#include <linux/memory_hotplug.h>
#include <linux/vmalloc.h>
#include <linux/vmalloc.h>
#include <linux/pfn_t.h>
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_AUTHOR
(
"Antoine Kaufmann"
);
MODULE_AUTHOR
(
"Antoine Kaufmann"
);
...
@@ -41,7 +42,9 @@ static void do_drain_node(int nid)
...
@@ -41,7 +42,9 @@ static void do_drain_node(int nid)
0
);
0
);
if
(
p
)
if
(
p
)
eaten
+=
PAGE_SIZE
;
eaten
+=
PAGE_SIZE
;
}
while
(
p
);
}
/* Local memory is drained before farmem, therefore the following works. Tested on kernel 5.15.69.*/
while
(
p
&&
pfn_t_to_phys
(
page_to_pfn_t
(
p
))
<
base_addr
);
printk
(
KERN_INFO
"drained %lu bytes
\n
"
,
eaten
);
printk
(
KERN_INFO
"drained %lu bytes
\n
"
,
eaten
);
}
}
...
@@ -69,6 +72,10 @@ static int __init farmem_mod_init(void)
...
@@ -69,6 +72,10 @@ static int __init farmem_mod_init(void)
}
}
node_set_online
(
nnid
);
node_set_online
(
nnid
);
/* Some local memory still remains usable, drain again to get it all. */
if
(
drain_node
)
do_drain_node
(
nnid
);
return
0
;
return
0
;
}
}
...
...
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