diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 4635b9924550..642b4bbfea00 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -294,8 +294,7 @@ acct_process(td) /* * Eliminate any file size rlimit. */ - if (p->p_limit->p_refcnt > 1 && - (p->p_limit->p_lflags & PL_SHAREMOD) == 0) { + if (p->p_limit->p_refcnt > 1) { p->p_limit->p_refcnt--; p->p_limit = limcopy(p->p_limit); } diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 5c36a246ea7f..19f506c1b5d3 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -558,17 +558,10 @@ again: PROC_UNLOCK(p2); /* - * If p_limit is still copy-on-write, bump refcnt, - * otherwise get a copy that won't be modified. - * (If PL_SHAREMOD is clear, the structure is shared - * copy-on-write.) + * p_limit is copy-on-write, bump refcnt, */ - if (p1->p_limit->p_lflags & PL_SHAREMOD) - p2->p_limit = limcopy(p1->p_limit); - else { - p2->p_limit = p1->p_limit; - p2->p_limit->p_refcnt++; - } + p2->p_limit = p1->p_limit; + p2->p_limit->p_refcnt++; /* * Setup linkage for kernel based threading diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 5b3920cbaab7..5dfbfd725e88 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -555,8 +555,7 @@ dosetrlimit(td, which, limp) return (error); if (limp->rlim_cur > limp->rlim_max) limp->rlim_cur = limp->rlim_max; - if (p->p_limit->p_refcnt > 1 && - (p->p_limit->p_lflags & PL_SHAREMOD) == 0) { + if (p->p_limit->p_refcnt > 1) { p->p_limit->p_refcnt--; p->p_limit = limcopy(p->p_limit); alimp = &p->p_rlimit[which]; @@ -828,7 +827,6 @@ limcopy(lim) MALLOC(copy, struct plimit *, sizeof(struct plimit), M_SUBPROC, M_WAITOK); bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct plimit)); - copy->p_lflags = 0; copy->p_refcnt = 1; return (copy); } diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index 572b575f520e..40db407878cb 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -72,15 +72,10 @@ struct pstats { /* * Kernel shareable process resource limits. Because this structure * is moderately large but changes infrequently, it is normally - * shared copy-on-write after forks. If a group of processes - * ("threads") share modifications, the PL_SHAREMOD flag is set, - * and a copy must be made for the child of a new fork that isn't - * sharing modifications to the limits. + * shared copy-on-write after forks. */ struct plimit { struct rlimit pl_rlimit[RLIM_NLIMITS]; -#define PL_SHAREMOD 0x01 /* modifications are shared */ - int p_lflags; int p_refcnt; /* number of references */ };