Created
September 5, 2019 09:07
-
-
Save ethercflow/58f81189ed6e760b99a78f48484eb60b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <linux/init.h> | |
| #include <linux/module.h> | |
| #include <linux/slab.h> | |
| #define N 100000 | |
| #define ORDER 2 * 2 * 2 | |
| static char *mems[N_MEM]; | |
| static int | |
| frag_init(void) | |
| { | |
| size_t i; | |
| for (i = 0; i < N; i++) | |
| mems[i] = kzalloc(4096 * order, GFP_KERNEL); | |
| return 0; | |
| } | |
| static void | |
| frag_exit(void) | |
| { | |
| size_t i; | |
| for (i = 0; i < N_MEM; i += 2) | |
| kfree(mems[i]); | |
| } | |
| module_init(frag_init); | |
| module_exit(frag_exit); | |
| MODULE_LICENSE("GPL"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment