tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: RLIMIT_AS and fixed process size calculations patch



matthew green <mrg%eterna.com.au@localhost> wrote:
> hi folks.
> 
> the patch below implements 3 things:
> 
>       1 - adds a new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits
>       the total address space available to processes.  this limit
>       exists in most other modern unix variants, and like most of
>       them, our defaults are unlimited.

It is also defined by POSIX.

> +     int64_t p_vm_vsize;             /* SEGSZ_T: total map size (pages) */
> +     int64_t p_vm_msize;             /* SEGSZ_T: stack-adjusted map size 
> (pages) */ };

Any reason why segsz_t is not unsigned?

> --- 502,507 ----
> *************** uvm_mmap(struct vm_map *map, vaddr_t *ad
> *** 1115,1120 ****
> --- 1097,1111 ----
>       }
>   
>       /*
> +      * check resource limits
> +      */
> + 
> +     if (!VM_MAP_IS_KERNEL(map) &&
> +         (((rlim_t)curproc->p_vmspace->vm_map.size + (rlim_t)size) >
> +         curproc->p_rlimit[RLIMIT_AS].rlim_cur))
> +             return ENOMEM;
> + 
> +     /*

Should not this also be checked for brk()/sbrk() call?

Thanks for working on this!

-- 
Best regards,
Mindaugas


Home | Main Index | Thread Index | Old Index