Re: [PATCH RFC] mm: Rework virtual memory accounting

From: Cyrill Gorcunov
Date: Tue Dec 29 2015 - 04:48:55 EST


On Mon, Dec 28, 2015 at 03:10:02PM -0800, Andrew Morton wrote:
> On Tue, 29 Dec 2015 00:10:15 +0300 Cyrill Gorcunov <gorcunov@xxxxxxxxx> wrote:
...
>
> This clashes with
> mm-mmapc-remove-redundant-local-variables-for-may_expand_vm.patch,
> below. I resolved it thusly:
>
> bool may_expand_vm(struct mm_struct *mm, vm_flags_t flags, unsigned long npages)
> {
> if (mm->total_vm + npages > rlimit(RLIMIT_AS) >> PAGE_SHIFT)
> return false;
>
> if ((flags & (VM_WRITE | VM_SHARED | (VM_STACK_FLAGS &
> (VM_GROWSUP | VM_GROWSDOWN)))) == VM_WRITE)
> return mm->data_vm + npages <= rlimit(RLIMIT_DATA);
>
> return true;
> }

Thanks, Andrew!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/