Re: [PATCH] mm/util.c: Add error logs for commitment overflow

From: Matthew Wilcox
Date: Fri Oct 02 2020 - 08:11:42 EST


On Fri, Oct 02, 2020 at 05:27:41PM +0530, Pintu Kumar wrote:
> This is the output we can see on a 256MB system and with a simple malloc
> and fork program.
>
> [root@ ~]# cat /proc/meminfo
> MemTotal: 249520 kB ==> 243MB
> MemFree: 179100 kB
>
> PPID PID USER RSS VSZ STAT ARGS
> 150 164 root 1440 250580 S ./consume-and-fork.out 243
>
> __vm_enough_memory: commitment overflow: ppid:150, pid:164, pages:62451
> fork failed[count:0]: Cannot allocate memory

I don't think the __func__ is particularly useful information. I would
also expect the name of the process to be more interesting than the PID.
And why is the ppid useful?

Wouldn't this message be more useful?

fork: Would overcommit system (pid:162 name:./consume-and-fork.out)

ie put it in dup_mmap() and use current->comm

> + pr_err_once("%s: commitment overflow: ppid:%d, pid:%d, pages:%ld\n",
> + __func__, current->parent->pid, current->pid, pages);
> +