From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752770AbeBFRsy (ORCPT ); Tue, 6 Feb 2018 12:48:54 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:40975 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752612AbeBFRss (ORCPT ); Tue, 6 Feb 2018 12:48:48 -0500 X-Google-Smtp-Source: AH8x224/LCmKtLeEDHylR+dgTWo2Xwx4PmpXR4KW1Kbb3SOpXE72p2JIRUxsUjgoukNk8uihRcElw8CVpz+rl4NSx/4= MIME-Version: 1.0 In-Reply-To: <1517935505-9321-1-git-send-email-dwmw@amazon.co.uk> References: <1517935505-9321-1-git-send-email-dwmw@amazon.co.uk> From: Konstantin Khlebnikov Date: Tue, 6 Feb 2018 20:48:46 +0300 Message-ID: Subject: Re: [PATCH] mm: Always print RLIMIT_DATA warning To: David Woodhouse Cc: Andrew Morton , Cyrill Gorcunov , Linus Torvalds , Vegard Nossum , Peter Zijlstra , Vladimir Davydov , Andy Lutomirski , Quentin Casasnovas , Kees Cook , Willy Tarreau , Pavel Emelyanov , Laura Abbott , Linux Kernel Mailing List , linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 6, 2018 at 7:45 PM, David Woodhouse wrote: > 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. Ack. But I think this was a misprint in docs. Anyway, this knob is a kludge so we might warn once even if it is set. So, somebody still have problems with this change? I remember concerns about that "warn_once" isn't enough to detect what's going wrong. And probably we should invent "warn_sometimes". > > Signed-off-by: David Woodhouse > --- > 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f72.google.com (mail-lf0-f72.google.com [209.85.215.72]) by kanga.kvack.org (Postfix) with ESMTP id 58BC96B0292 for ; Tue, 6 Feb 2018 12:48:48 -0500 (EST) Received: by mail-lf0-f72.google.com with SMTP id c7so111249lfk.19 for ; Tue, 06 Feb 2018 09:48:48 -0800 (PST) Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id t17sor2285358ljd.51.2018.02.06.09.48.46 for (Google Transport Security); Tue, 06 Feb 2018 09:48:46 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1517935505-9321-1-git-send-email-dwmw@amazon.co.uk> References: <1517935505-9321-1-git-send-email-dwmw@amazon.co.uk> From: Konstantin Khlebnikov Date: Tue, 6 Feb 2018 20:48:46 +0300 Message-ID: Subject: Re: [PATCH] mm: Always print RLIMIT_DATA warning Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: To: David Woodhouse Cc: Andrew Morton , Cyrill Gorcunov , Linus Torvalds , Vegard Nossum , Peter Zijlstra , Vladimir Davydov , Andy Lutomirski , Quentin Casasnovas , Kees Cook , Willy Tarreau , Pavel Emelyanov , Laura Abbott , Linux Kernel Mailing List , linux-mm@kvack.org On Tue, Feb 6, 2018 at 7:45 PM, David Woodhouse wrote: > 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. Ack. But I think this was a misprint in docs. Anyway, this knob is a kludge so we might warn once even if it is set. So, somebody still have problems with this change? I remember concerns about that "warn_once" isn't enough to detect what's going wrong. And probably we should invent "warn_sometimes". > > Signed-off-by: David Woodhouse > --- > 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: email@kvack.org