From: Topi Miettinen <toiwoton@gmail.com> To: linux-kernel@vger.kernel.org Cc: Topi Miettinen <toiwoton@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, Oleg Nesterov <oleg@redhat.com>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Chen Gang <gang.chen.5i5j@gmail.com>, Michal Hocko <mhocko@suse.com>, Konstantin Khlebnikov <koct9i@gmail.com>, Andrea Arcangeli <aarcange@redhat.com>, Andrey Ryabinin <aryabinin@virtuozzo.com>, David Rientjes <rientjes@google.com>, Vlastimil Babka <vbabka@suse.cz>, Hugh Dickins <hughd@google.com>, Alexander Kuleshov <kuleshovmail@gmail.com>, linux-mm@kvack.org (open list:MEMORY MANAGEMENT) Subject: [PATCH 10/14] resource limits: track highwater mark of address space size Date: Fri, 15 Jul 2016 13:35:57 +0300 [thread overview] Message-ID: <1468578983-28229-11-git-send-email-toiwoton@gmail.com> (raw) In-Reply-To: <1468578983-28229-1-git-send-email-toiwoton@gmail.com> Track maximum size of address space, to be able to configure RLIMIT_AS resource limits. The information is available with taskstats and cgroupstats netlink socket. Signed-off-by: Topi Miettinen <toiwoton@gmail.com> --- mm/mmap.c | 4 ++++ mm/mremap.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/mm/mmap.c b/mm/mmap.c index c37f599..ded2f8d 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2707,6 +2707,9 @@ static int do_brk(unsigned long addr, unsigned long len) out: perf_event_mmap(vma); mm->total_vm += len >> PAGE_SHIFT; + + update_resource_highwatermark(RLIMIT_AS, mm->total_vm << PAGE_SHIFT); + mm->data_vm += len >> PAGE_SHIFT; if (flags & VM_LOCKED) mm->locked_vm += (len >> PAGE_SHIFT); @@ -2927,6 +2930,7 @@ bool may_expand_vm(struct mm_struct *mm, vm_flags_t flags, unsigned long npages) void vm_stat_account(struct mm_struct *mm, vm_flags_t flags, long npages) { mm->total_vm += npages; + update_resource_highwatermark(RLIMIT_AS, mm->total_vm << PAGE_SHIFT); if (is_exec_mapping(flags)) mm->exec_vm += npages; diff --git a/mm/mremap.c b/mm/mremap.c index f1821335..aa717d0 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -398,6 +398,9 @@ static struct vm_area_struct *vma_to_resize(unsigned long addr, update_resource_highwatermark(RLIMIT_MEMLOCK, (mm->locked_vm << PAGE_SHIFT) + new_len - old_len); + update_resource_highwatermark(RLIMIT_AS, (mm->total_vm << PAGE_SHIFT) + + new_len - old_len); + return vma; } -- 2.8.1
WARNING: multiple messages have this Message-ID (diff)
From: Topi Miettinen <toiwoton@gmail.com> To: linux-kernel@vger.kernel.org Cc: Topi Miettinen <toiwoton@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, Oleg Nesterov <oleg@redhat.com>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Chen Gang <gang.chen.5i5j@gmail.com>, Michal Hocko <mhocko@suse.com>, Konstantin Khlebnikov <koct9i@gmail.com>, Andrea Arcangeli <aarcange@redhat.com>, Andrey Ryabinin <aryabinin@virtuozzo.com>, David Rientjes <rientjes@google.com>, Vlastimil Babka <vbabka@suse.cz>, Hugh Dickins <hughd@google.com>, Alexander Kuleshov <kuleshovmail@gmail.com>, "open list:MEMORY MANAGEMENT" <linux-mm@kvack.org> Subject: [PATCH 10/14] resource limits: track highwater mark of address space size Date: Fri, 15 Jul 2016 13:35:57 +0300 [thread overview] Message-ID: <1468578983-28229-11-git-send-email-toiwoton@gmail.com> (raw) In-Reply-To: <1468578983-28229-1-git-send-email-toiwoton@gmail.com> Track maximum size of address space, to be able to configure RLIMIT_AS resource limits. The information is available with taskstats and cgroupstats netlink socket. Signed-off-by: Topi Miettinen <toiwoton@gmail.com> --- mm/mmap.c | 4 ++++ mm/mremap.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/mm/mmap.c b/mm/mmap.c index c37f599..ded2f8d 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2707,6 +2707,9 @@ static int do_brk(unsigned long addr, unsigned long len) out: perf_event_mmap(vma); mm->total_vm += len >> PAGE_SHIFT; + + update_resource_highwatermark(RLIMIT_AS, mm->total_vm << PAGE_SHIFT); + mm->data_vm += len >> PAGE_SHIFT; if (flags & VM_LOCKED) mm->locked_vm += (len >> PAGE_SHIFT); @@ -2927,6 +2930,7 @@ bool may_expand_vm(struct mm_struct *mm, vm_flags_t flags, unsigned long npages) void vm_stat_account(struct mm_struct *mm, vm_flags_t flags, long npages) { mm->total_vm += npages; + update_resource_highwatermark(RLIMIT_AS, mm->total_vm << PAGE_SHIFT); if (is_exec_mapping(flags)) mm->exec_vm += npages; diff --git a/mm/mremap.c b/mm/mremap.c index f1821335..aa717d0 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -398,6 +398,9 @@ static struct vm_area_struct *vma_to_resize(unsigned long addr, update_resource_highwatermark(RLIMIT_MEMLOCK, (mm->locked_vm << PAGE_SHIFT) + new_len - old_len); + update_resource_highwatermark(RLIMIT_AS, (mm->total_vm << PAGE_SHIFT) + + new_len - old_len); + return vma; } -- 2.8.1 -- 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:[~2016-07-15 10:37 UTC|newest] Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-07-15 10:35 [PATCH 00/14] Present useful limits to user (v2) Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 10:35 ` [PATCH 01/14] resource limits: foundation for resource highwater tracking Topi Miettinen 2016-07-15 12:12 ` kbuild test robot 2016-07-15 12:49 ` Nicolas Dichtel 2016-07-15 16:27 ` Topi Miettinen 2016-07-15 17:57 ` Nicolas Dichtel 2016-07-15 10:35 ` [PATCH 02/14] resource limits: aggregate task highwater marks to cgroup level Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 12:38 ` kbuild test robot 2016-07-15 14:10 ` Tejun Heo 2016-07-15 17:15 ` Topi Miettinen 2016-07-18 22:52 ` Tejun Heo 2016-07-19 16:57 ` Topi Miettinen 2016-07-19 18:18 ` Tejun Heo 2016-07-15 10:35 ` [PATCH 03/14] resource limits: track highwater mark of file sizes Topi Miettinen 2016-07-15 10:35 ` [PATCH 04/14] resource limits: track highwater mark of VM data segment Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 10:35 ` [PATCH 05/14] resource limits: track highwater mark of stack size Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 10:35 ` [PATCH 06/14] resource limits: track highwater mark of cores dumped Topi Miettinen 2016-07-15 10:35 ` [PATCH 07/14] resource limits: track highwater mark of user processes Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 10:35 ` [PATCH 08/14] resource limits: track highwater mark of number of files Topi Miettinen 2016-07-15 10:35 ` [PATCH 09/14] resource limits: track highwater mark of locked memory Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen 2016-07-15 15:14 ` Oleg Nesterov 2016-07-15 15:14 ` Oleg Nesterov 2016-07-15 15:14 ` Oleg Nesterov 2016-07-15 17:39 ` Topi Miettinen 2016-07-15 17:39 ` Topi Miettinen 2016-07-15 17:39 ` Topi Miettinen 2016-07-18 15:38 ` Oleg Nesterov 2016-07-18 15:38 ` Oleg Nesterov 2016-07-18 15:38 ` Oleg Nesterov 2016-07-15 17:45 ` Topi Miettinen 2016-07-15 10:35 ` Topi Miettinen [this message] 2016-07-15 10:35 ` [PATCH 10/14] resource limits: track highwater mark of address space size Topi Miettinen 2016-07-15 10:35 ` [PATCH 11/14] resource limits: track highwater mark of number of pending signals Topi Miettinen 2016-07-15 10:35 ` [PATCH 12/14] resource limits: track highwater mark of size of message queues Topi Miettinen 2016-07-15 10:36 ` [PATCH 13/14] resource limits: track highwater mark of niceness Topi Miettinen 2016-07-15 10:36 ` [PATCH 14/14] resource limits: track highwater mark of RT priority Topi Miettinen 2016-07-15 12:43 ` [PATCH 00/14] Present useful limits to user (v2) Peter Zijlstra 2016-07-15 12:43 ` Peter Zijlstra 2016-07-15 12:43 ` Peter Zijlstra 2016-07-15 13:52 ` Topi Miettinen 2016-07-15 13:52 ` Topi Miettinen 2016-07-15 13:52 ` Topi Miettinen 2016-07-15 13:59 ` Peter Zijlstra 2016-07-15 13:59 ` Peter Zijlstra 2016-07-15 13:59 ` Peter Zijlstra 2016-07-15 13:59 ` Peter Zijlstra 2016-07-15 13:59 ` Peter Zijlstra 2016-07-15 16:57 ` Topi Miettinen 2016-07-15 16:57 ` Topi Miettinen 2016-07-15 16:57 ` Topi Miettinen 2016-07-15 16:57 ` Topi Miettinen 2016-07-15 20:54 ` H. Peter Anvin 2016-07-15 20:54 ` H. Peter Anvin 2016-07-15 20:54 ` H. Peter Anvin 2016-07-15 20:54 ` H. Peter Anvin 2016-07-15 20:54 ` H. Peter Anvin 2016-07-18 13:00 ` Austin S. Hemmelgarn [not found] ` <20160715135956.GA3115-ndre7Fmf5hadTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org> 2016-07-15 20:54 ` H. Peter Anvin 2016-07-15 20:54 ` H. Peter Anvin 2016-07-15 20:54 ` H. Peter Anvin 2016-07-15 20:54 ` H. Peter Anvin 2016-07-15 13:04 ` Balbir Singh 2016-07-15 13:04 ` Balbir Singh 2016-07-15 13:04 ` Balbir Singh 2016-07-15 16:35 ` Topi Miettinen 2016-07-15 16:35 ` Topi Miettinen 2016-07-15 16:35 ` Topi Miettinen 2016-07-18 22:05 ` Doug Ledford 2016-07-18 22:05 ` Doug Ledford 2016-07-19 16:53 ` Topi Miettinen 2016-07-19 16:53 ` Topi Miettinen 2016-07-19 16:53 ` Topi Miettinen 2016-07-15 14:19 ` Richard Weinberger 2016-07-15 14:19 ` Richard Weinberger 2016-07-15 14:19 ` Richard Weinberger 2016-07-15 17:19 ` Topi Miettinen 2016-07-15 17:19 ` Topi Miettinen 2016-07-15 17:19 ` Topi Miettinen 2016-07-18 21:25 ` Doug Ledford 2016-07-18 21:25 ` Doug Ledford 2016-07-15 17:42 ` Topi Miettinen 2016-08-03 18:20 ` Topi Miettinen 2016-08-03 18:20 ` Topi Miettinen 2016-08-04 6:59 ` Fwd: " Topi Miettinen
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=1468578983-28229-11-git-send-email-toiwoton@gmail.com \ --to=toiwoton@gmail.com \ --cc=aarcange@redhat.com \ --cc=akpm@linux-foundation.org \ --cc=aryabinin@virtuozzo.com \ --cc=gang.chen.5i5j@gmail.com \ --cc=hughd@google.com \ --cc=kirill.shutemov@linux.intel.com \ --cc=koct9i@gmail.com \ --cc=kuleshovmail@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mhocko@suse.com \ --cc=oleg@redhat.com \ --cc=rientjes@google.com \ --cc=vbabka@suse.cz \ /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: linkBe 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.