mm: always print RLIMIT_DATA warning
authorDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 5 Apr 2018 23:22:05 +0000 (16:22 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Apr 2018 04:36:24 +0000 (21:36 -0700)
The documentation for ignore_rlimit_data says that it will print a
warning at first misuse.  Yet it doesn't seem to do that.

Fix the code to print the warning even when we allow the process to
continue.

Link: http://lkml.kernel.org/r/1517935505-9321-1-git-send-email-dwmw@amazon.co.uk
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Acked-by: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmap.c

index aa0dc8231c0d0df33d1137199290b5d3422d2ca2..f2154fc2548b0e13e7e2a61b86e5720765260d1f 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3191,13 +3191,15 @@ bool may_expand_vm(struct mm_struct *mm, vm_flags_t flags, unsigned long npages)
                if (rlimit(RLIMIT_DATA) == 0 &&
                    mm->data_vm + npages <= rlimit_max(RLIMIT_DATA) >> PAGE_SHIFT)
                        return true;
-               if (!ignore_rlimit_data) {
-                       pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits or use boot option ignore_rlimit_data.\n",
-                                    current->comm, current->pid,
-                                    (mm->data_vm + npages) << PAGE_SHIFT,
-                                    rlimit(RLIMIT_DATA));
+
+               pr_warn_once("%s (%d): VmData %lu exceed data ulimit %lu. Update limits%s.\n",
+                            current->comm, current->pid,
+                            (mm->data_vm + npages) << PAGE_SHIFT,
+                            rlimit(RLIMIT_DATA),
+                            ignore_rlimit_data ? "" : " or use boot option ignore_rlimit_data");
+
+               if (!ignore_rlimit_data)
                        return false;
-               }
        }
 
        return true;