Re: [PATCH] include private data mappings in RLIMIT_DATA limit

From: Hugh Dickins
Date: Tue Jul 10 2007 - 15:44:01 EST


On Tue, 10 Jul 2007, Dave McCracken wrote:
> On Tuesday 10 July 2007, Hugh Dickins wrote:
> >
> > Mapped private readonly yes, but vm_stat_account() says
> > if (file) {
> > mm->shared_vm += pages;
> > if ((flags & (VM_EXEC|VM_WRITE)) == VM_EXEC)
> > mm->exec_vm += pages;
>
> In that code shared_vm includes everything that's mmap()ed, including private
> mappings. But if you look at Herbert's patch he has the following change:
>
> if (file) {
> - mm->shared_vm += pages;
> + if (flags & VM_SHARED)
> + mm->shared_vm += pages;
> if ((flags & (VM_EXEC|VM_WRITE)) == VM_EXEC)
> mm->exec_vm += pages;
>
> This means that shared_vm now is truly only memory that's mapped VM_SHARED and
> does not include VM_EXEC memory. That necessitates the separate subtraction
> of exec_vm in the data calculations.

Ah, I just noticed at the beginning of the patch, and didn't look for
a balancing change - thanks. I'd strongly recommend that he not mess
around with these numbers, unless there's _very_ good reason: they're
not ideal, nothing ever will be, changing them around just causes pain.
shared_vm may not be a full description of what it counts, but it'll
do until you've a better name (readonly mappings share with the file
even when they're private).

Hugh
-
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/