#include <linux/mount.h>
#include <linux/audit.h>
#include <linux/rmap.h>
-#include <linux/vinline.h>
-#include <linux/ninline.h>
+
+#include <linux/vs_network.h>
+#include <linux/vs_memory.h>
+#include <linux/vs_limit.h>
+#include <linux/vs_base.h>
+
#include <linux/ckrm.h>
#include <linux/ckrm_tsk.h>
struct vm_area_struct * mpnt, *tmp, **pprev;
struct rb_node **rb_link, *rb_parent;
int retval;
- unsigned long charge = 0;
+ unsigned long charge;
struct mempolicy *pol;
down_write(&oldmm->mmap_sem);
if(mpnt->vm_flags & VM_DONTCOPY)
continue;
+ charge = 0;
if (mpnt->vm_flags & VM_ACCOUNT) {
unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
if (security_vm_enough_memory(len))
goto fail_nomem;
- charge += len;
+ charge = len;
}
tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (!tmp)
tmp->vm_ops->open(tmp);
if (retval)
- goto fail;
+ goto out;
}
retval = 0;
kmem_cache_free(vm_area_cachep, tmp);
fail_nomem:
retval = -ENOMEM;
-fail:
vm_unacct_memory(charge);
goto out;
}
+
static inline int mm_alloc_pgd(struct mm_struct * mm)
{
mm->pgd = pgd_alloc(mm);
* not set up a proper pointer then tough luck.
*/
put_user(0, tidptr);
- sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL);
+ sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);
}
}
}
retval = -EAGAIN;
- vxi = current->vx_info;
- if (vxi && (atomic_read(&vxi->limit.res[RLIMIT_NPROC])
- >= vxi->limit.rlim[RLIMIT_NPROC]))
- goto bad_fork_free;
+ if (!vx_nproc_avail(1))
+ goto bad_fork_free;
if (atomic_read(&p->user->processes) >=
p->rlim[RLIMIT_NPROC].rlim_cur) {
link_pid(p, p->pids + PIDTYPE_TGID, &p->group_leader->pids[PIDTYPE_TGID].pid);
nr_threads++;
+ vxi = current->vx_info;
if (vxi) {
atomic_inc(&vxi->cacct.nr_threads);
- atomic_inc(&vxi->limit.res[RLIMIT_NPROC]);
+ // atomic_inc(&vxi->limit.res[RLIMIT_NPROC]);
}
+ vx_nproc_inc();
write_unlock_irq(&tasklist_lock);
retval = 0;