All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw@amazon.co.uk>
To: Konstantin Khlebnikov <koct9i@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Vegard Nossum <vegard.nossum@oracle.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Vladimir Davydov <vdavydov@virtuozzo.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Quentin Casasnovas <quentin.casasnovas@oracle.com>,
	Kees Cook <keescook@google.com>, Willy Tarreau <w@1wt.eu>,
	Pavel Emelyanov <xemul@virtuozzo.com>,
	Laura Abbott <labbott@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] mm: Always print RLIMIT_DATA warning
Date: Tue,  6 Feb 2018 16:45:05 +0000	[thread overview]
Message-ID: <1517935505-9321-1-git-send-email-dwmw@amazon.co.uk> (raw)

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.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
We should probably also do what Linus suggested in 
https://lkml.org/lkml/2016/9/16/585

 mm/mmap.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 9efdc021..dd76ea3 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3184,13 +3184,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;
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: David Woodhouse <dwmw@amazon.co.uk>
To: Konstantin Khlebnikov <koct9i@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Vegard Nossum <vegard.nossum@oracle.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Vladimir Davydov <vdavydov@virtuozzo.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Quentin Casasnovas <quentin.casasnovas@oracle.com>,
	Kees Cook <keescook@google.com>, Willy Tarreau <w@1wt.eu>,
	Pavel Emelyanov <xemul@virtuozzo.com>,
	Laura Abbott <labbott@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] mm: Always print RLIMIT_DATA warning
Date: Tue,  6 Feb 2018 16:45:05 +0000	[thread overview]
Message-ID: <1517935505-9321-1-git-send-email-dwmw@amazon.co.uk> (raw)

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.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
We should probably also do what Linus suggested in 
https://lkml.org/lkml/2016/9/16/585

 mm/mmap.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 9efdc021..dd76ea3 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3184,13 +3184,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;
-- 
2.7.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2018-02-06 16:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 16:45 David Woodhouse [this message]
2018-02-06 16:45 ` [PATCH] mm: Always print RLIMIT_DATA warning David Woodhouse
2018-02-06 17:27 ` Cyrill Gorcunov
2018-02-06 17:27   ` Cyrill Gorcunov
2018-02-06 17:30   ` David Woodhouse
2018-02-06 17:48 ` Konstantin Khlebnikov
2018-02-06 17:48   ` Konstantin Khlebnikov
2018-02-07 13:03   ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517935505-9321-1-git-send-email-dwmw@amazon.co.uk \
    --to=dwmw@amazon.co.uk \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@gmail.com \
    --cc=keescook@google.com \
    --cc=koct9i@gmail.com \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@amacapital.net \
    --cc=quentin.casasnovas@oracle.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vdavydov@virtuozzo.com \
    --cc=vegard.nossum@oracle.com \
    --cc=w@1wt.eu \
    --cc=xemul@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.