Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch9/oom_killer_try cmdline argument force_page_fault = 0 issue #9

Open
eibisidi opened this issue Nov 12, 2024 · 0 comments
Open

ch9/oom_killer_try cmdline argument force_page_fault = 0 issue #9

eibisidi opened this issue Nov 12, 2024 · 0 comments

Comments

@eibisidi
Copy link

Hi!
On my raspiberry pi , force_page_fault = 0 will still trigger minor page fault.
image
dmesg output:
image
I think calling sbrk() directly would be better for illustration purpose:

--- a/ch9/oom_killer_try/oom_killer_try.c
+++ b/ch9/oom_killer_try/oom_killer_try.c
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
        printf("%s: PID %d (verbose mode: %s)\n",
                argv[0], getpid(), (verbose==1?"on":"off"));
        do {
-               p = (char *)malloc(BLK);
+               p = sbrk(BLK);
                if (!p) {
                        fprintf(stderr, "%s: loop #%d: malloc failure.\n",

If we call sbrk() instead, minor fault won't happen if force_page_fault = 0:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant