Check kse group limit before linking new ksegrp.

This commit is contained in:
David Xu 2003-02-28 15:57:33 +00:00
parent 01ba618f4a
commit 9948c47f0e
2 changed files with 4 additions and 4 deletions

View File

@ -626,12 +626,12 @@ kse_create(struct thread *td, struct kse_create_args *uap)
bcopy(&kg->kg_startcopy, &newkg->kg_startcopy,
RANGEOF(struct ksegrp, kg_startcopy, kg_endcopy));
mtx_lock_spin(&sched_lock);
ksegrp_link(newkg, p);
if (p->p_numksegrps >= max_groups_per_proc) {
ksegrp_unlink(newkg);
mtx_unlock_spin(&sched_lock);
ksegrp_free(newkg);
return (EPROCLIM);
}
ksegrp_link(newkg, p);
mtx_unlock_spin(&sched_lock);
} else {
newkg = kg;

View File

@ -626,12 +626,12 @@ kse_create(struct thread *td, struct kse_create_args *uap)
bcopy(&kg->kg_startcopy, &newkg->kg_startcopy,
RANGEOF(struct ksegrp, kg_startcopy, kg_endcopy));
mtx_lock_spin(&sched_lock);
ksegrp_link(newkg, p);
if (p->p_numksegrps >= max_groups_per_proc) {
ksegrp_unlink(newkg);
mtx_unlock_spin(&sched_lock);
ksegrp_free(newkg);
return (EPROCLIM);
}
ksegrp_link(newkg, p);
mtx_unlock_spin(&sched_lock);
} else {
newkg = kg;