lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFzbBQp-QzWj2k7twuZ7+ESFpzoRPGZVKWkDv04zHCZ3Sg@mail.gmail.com>
Date:	Fri, 11 Dec 2015 12:55:51 -0800
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Cyrill Gorcunov <gorcunov@...il.com>
Cc:	LKML <linux-kernel@...r.kernel.org>, Linux MM <linux-mm@...ck.org>,
	Quentin Casasnovas <quentin.casasnovas@...cle.com>,
	Vegard Nossum <vegard.nossum@...cle.com>,
	Willy Tarreau <w@....eu>,
	Andy Lutomirski <luto@...capital.net>,
	Kees Cook <keescook@...gle.com>,
	Vladimir Davydov <vdavydov@...tuozzo.com>,
	Konstantin Khlebnikov <koct9i@...il.com>,
	Pavel Emelyanov <xemul@...tuozzo.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [RFC] mm: Account anon mappings as RLIMIT_DATA

On Fri, Dec 11, 2015 at 12:49 PM, Cyrill Gorcunov <gorcunov@...il.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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ