Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1444166
| From | Topi Miettinen <toiwoton@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 10/14] resource limits: track highwater mark of address space size |
| Date | 2016-07-15 12:40 +0200 |
| Message-ID | <rV8Hg-5Li-31@gated-at.bofh.it> (permalink) |
| References | <rV8Hf-5Li-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 10/14] resource limits: track highwater mark of address space size Topi Miettinen <toiwoton@gmail.com> - 2016-07-15 12:40 +0200
csiph-web