mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>,
	linux-mm@kvack.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linuxfoundation.org>,
	linux-kernel@vger.kernel.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>
Subject: Re: [PATCH v3] mm: warn about VmData over RLIMIT_DATA
Date: Tue, 26 Jan 2016 14:49:26 -0800	[thread overview]
Message-ID: <20160126144926.21d854fe53b76bd03e34b0d1@linux-foundation.org> (raw)
In-Reply-To: <145358234948.18573.2681359119037889087.stgit@zurg>

On Sat, 23 Jan 2016 23:52:29 +0300 Konstantin Khlebnikov <koct9i@gmail.com> wrote:

> This patch fixes 84638335900f ("mm: rework virtual memory accounting")

uh, I think I'll rewrite this to

: This patch provides a way of working around a slight regression introduced
: by 84638335900f ("mm: rework virtual memory accounting").

> Before that commit RLIMIT_DATA have control only over size of the brk region.
> But that change have caused problems with all existing versions of valgrind,
> because it set RLIMIT_DATA to zero.
> 
> This patch fixes rlimit check (limit actually in bytes, not pages)
> and by default turns it into warning which prints at first VmData misuse:
> "mmap: top (795): VmData 516096 exceed data ulimit 512000. Will be forbidden soon."
> 
> Behavior is controlled by boot param ignore_rlimit_data=y/n and by sysfs
> /sys/module/kernel/parameters/ignore_rlimit_data. For now it set to "y".
> 
> 
> ...
>
> +static inline bool is_data_mapping(vm_flags_t flags)
> +{
> +	return (flags & ((VM_STACK_FLAGS & (VM_GROWSUP | VM_GROWSDOWN)) |
> +					VM_WRITE | VM_SHARED)) == VM_WRITE;
> +}

This (copied from existing code) hurts my brain.  We're saying "if it
isn't stack and it's unshared and writable, it's data", yes?

hm.  I guess that's because with a shared mapping we don't know who to
blame for the memory consumption so we blame nobody.  But what about
non-shared read-only mappings?

Can we please have a comment here fully explaining the thinking?

  reply	other threads:[~2016-01-26 22:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-23 20:52 Konstantin Khlebnikov
2016-01-26 22:49 ` Andrew Morton [this message]
2016-01-27  9:09   ` Konstantin Khlebnikov

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=20160126144926.21d854fe53b76bd03e34b0d1@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linuxfoundation.org \
    --cc=gorcunov@gmail.com \
    --cc=keescook@google.com \
    --cc=koct9i@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®