Skip to content

ch9/oom_killer_try cmdline argument force_page_fault = 0 issue #9

@eibisidi

Description

@eibisidi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions