From: Linus Torvalds <torvalds@linux-foundation.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>,
Quentin Casasnovas <quentin.casasnovas@oracle.com>,
Vegard Nossum <vegard.nossum@oracle.com>,
Willy Tarreau <w@1wt.eu>, Andy Lutomirski <luto@amacapital.net>,
Kees Cook <keescook@google.com>,
Vladimir Davydov <vdavydov@virtuozzo.com>,
Konstantin Khlebnikov <koct9i@gmail.com>,
Pavel Emelyanov <xemul@virtuozzo.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [RFC] mm: Account anon mappings as RLIMIT_DATA
Date: Fri, 11 Dec 2015 12:55:51 -0800 [thread overview]
Message-ID: <CA+55aFzbBQp-QzWj2k7twuZ7+ESFpzoRPGZVKWkDv04zHCZ3Sg@mail.gmail.com> (raw)
In-Reply-To: <20151211204939.GA2604@uranus>
On Fri, Dec 11, 2015 at 12:49 PM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
>
> This should give a way to control the amount of anonymous
> memory allocated.
This looks good to me, assuming it gets testing. I think we could add
the hugetlb stuff later, I think it's a separate improvement.
Small nit:
> @@ -1214,6 +1214,8 @@ void vm_stat_account(struct mm_struct *m
> {
> const unsigned long stack_flags
> = VM_STACK_FLAGS & (VM_GROWSUP|VM_GROWSDOWN);
> + const unsigned long not_anon_acc
> + = VM_GROWSUP | VM_GROWSDOWN | VM_SHARED | VM_MAYSHARE;
>
> mm->total_vm += pages;
>
> @@ -1223,6 +1225,9 @@ void vm_stat_account(struct mm_struct *m
> mm->exec_vm += pages;
> } else if (flags & stack_flags)
> mm->stack_vm += pages;
> +
> + if (!file && (flags & not_anon_acc) == 0)
> + mm->anon_vm += pages;
> }
> #endif /* CONFIG_PROC_FS */
>
> @@ -1534,6 +1539,13 @@ static inline int accountable_mapping(st
> return (vm_flags & (VM_NORESERVE | VM_SHARED | VM_WRITE)) == VM_WRITE;
> }
>
> +static inline int anon_accountable_mapping(struct file *file, vm_flags_t vm_flags)
> +{
> + return !file &&
> + (vm_flags & (VM_GROWSDOWN | VM_GROWSUP |
> + VM_SHARED | VM_MAYSHARE)) == 0;
> +}
You're duplicating that "is it an anon accountable mapping" logic. I
think you should move the inline helper function up, and use it in
vm_stat_account().
Other than that, I think the patch certainly looks clean and obvious
enough. But I didn't actually try to *run* it, maybe it ends up not
working due to something I don't see.
Linus
--
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>
next prev parent reply other threads:[~2015-12-11 20:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-11 20:49 [RFC] mm: Account anon mappings as RLIMIT_DATA Cyrill Gorcunov
2015-12-11 20:55 ` Linus Torvalds [this message]
2015-12-11 20:59 ` Cyrill Gorcunov
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=CA+55aFzbBQp-QzWj2k7twuZ7+ESFpzoRPGZVKWkDv04zHCZ3Sg@mail.gmail.com \
--to=torvalds@linux-foundation.org \
--cc=a.p.zijlstra@chello.nl \
--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=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;
as well as URLs for NNTP newsgroup(s).