Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_prot.c
Show First 20 Lines • Show All 2,048 Lines • ▼ Show 20 Lines | crextend(struct ucred *cr, int n) | ||||
* Once we're allocating multiple pages, only allocate as many | * Once we're allocating multiple pages, only allocate as many | ||||
* as we actually need. The case of processes needing a | * as we actually need. The case of processes needing a | ||||
* non-power of two number of pages seems more likely than | * non-power of two number of pages seems more likely than | ||||
* a real world process that adds thousands of groups one at a | * a real world process that adds thousands of groups one at a | ||||
* time. | * time. | ||||
*/ | */ | ||||
if ( n < PAGE_SIZE / sizeof(gid_t) ) { | if ( n < PAGE_SIZE / sizeof(gid_t) ) { | ||||
if (cr->cr_agroups == 0) | if (cr->cr_agroups == 0) | ||||
cnt = MINALLOCSIZE / sizeof(gid_t); | cnt = MAX(1, MINALLOCSIZE / sizeof(gid_t)); | ||||
rlibby: This and the same in subr_bus.c are actually not necessary with a smallest alloc size of 8… | |||||
markjUnsubmitted Not Done Inline ActionsI'd suggest committing them separately if you weren't already going to. markj: I'd suggest committing them separately if you weren't already going to. | |||||
rlibbyAuthorUnsubmitted Done Inline ActionsOkay, I'll split them out. rlibby: Okay, I'll split them out. | |||||
else | else | ||||
cnt = cr->cr_agroups * 2; | cnt = cr->cr_agroups * 2; | ||||
while (cnt < n) | while (cnt < n) | ||||
cnt *= 2; | cnt *= 2; | ||||
} else | } else | ||||
cnt = roundup2(n, PAGE_SIZE / sizeof(gid_t)); | cnt = roundup2(n, PAGE_SIZE / sizeof(gid_t)); | ||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |
This and the same in subr_bus.c are actually not necessary with a smallest alloc size of 8 bytes, but I needed to fix them when testing with a smallest alloc size of 4 bytes.