51c51
< __FBSDID("$FreeBSD: head/sys/vm/uma_core.c 248084 2013-03-09 02:32:23Z attilio $");
---
> __FBSDID("$FreeBSD: head/sys/vm/uma_core.c 249264 2013-04-08 19:10:45Z glebius $");
768c768
< keg->uk_name, UMA_SLAB_SIZE * keg->uk_ppera);
---
> keg->uk_name, PAGE_SIZE * keg->uk_ppera);
770c770
< keg->uk_freef(mem, UMA_SLAB_SIZE * keg->uk_ppera, flags);
---
> keg->uk_freef(mem, PAGE_SIZE * keg->uk_ppera, flags);
868c868
< mem = allocf(zone, keg->uk_ppera * UMA_SLAB_SIZE, &flags, wait);
---
> mem = allocf(zone, keg->uk_ppera * PAGE_SIZE, &flags, wait);
930c930
< keg->uk_freef(mem, UMA_SLAB_SIZE * keg->uk_ppera,
---
> keg->uk_freef(mem, PAGE_SIZE * keg->uk_ppera,
1141c1141,1149
< KASSERT(keg != NULL, ("Keg is null in keg_small_init"));
---
> if (keg->uk_flags & UMA_ZONE_PCPU) {
> keg->uk_slabsize = sizeof(struct pcpu);
> keg->uk_ppera = howmany(mp_ncpus * sizeof(struct pcpu),
> PAGE_SIZE);
> } else {
> keg->uk_slabsize = UMA_SLAB_SIZE;
> keg->uk_ppera = 1;
> }
>
1144,1145d1151
< if (rsize < UMA_SMALLEST_UNIT)
< rsize = UMA_SMALLEST_UNIT;
1147a1154,1155
> if (rsize < keg->uk_slabsize / 256)
> rsize = keg->uk_slabsize / 256;
1150d1157
< keg->uk_ppera = 1;
1151a1159,1162
> KASSERT((keg->uk_flags & UMA_ZONE_PCPU) == 0 ||
> keg->uk_rsize < sizeof(struct pcpu),
> ("%s: size %u too large", __func__, keg->uk_rsize));
>
1162,1163c1173,1176
< keg->uk_ipers = (UMA_SLAB_SIZE - shsize) / rsize;
< KASSERT(keg->uk_ipers != 0, ("keg_small_init: ipers is 0"));
---
> keg->uk_ipers = (keg->uk_slabsize - shsize) / rsize;
> KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= 255,
> ("%s: keg->uk_ipers %u", __func__, keg->uk_ipers));
>
1165c1178
< wastedspace = UMA_SLAB_SIZE - memused;
---
> wastedspace = keg->uk_slabsize - memused;
1178,1182c1191,1195
< if ((wastedspace >= UMA_MAX_WASTE) &&
< (keg->uk_ipers < (UMA_SLAB_SIZE / keg->uk_rsize))) {
< keg->uk_ipers = UMA_SLAB_SIZE / keg->uk_rsize;
< KASSERT(keg->uk_ipers <= 255,
< ("keg_small_init: keg->uk_ipers too high!"));
---
> if ((wastedspace >= keg->uk_slabsize / UMA_MAX_WASTE) &&
> (keg->uk_ipers < (keg->uk_slabsize / keg->uk_rsize))) {
> keg->uk_ipers = keg->uk_slabsize / keg->uk_rsize;
> KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= 255,
> ("%s: keg->uk_ipers %u", __func__, keg->uk_ipers));
1189,1190c1202,1203
< UMA_MAX_WASTE, keg->uk_ipers,
< UMA_SLAB_SIZE - keg->uk_ipers * keg->uk_rsize);
---
> keg->uk_slabsize / UMA_MAX_WASTE, keg->uk_ipers,
> keg->uk_slabsize - keg->uk_ipers * keg->uk_rsize);
1193,1194d1205
< if ((keg->uk_flags & UMA_ZONE_VTOSLAB) == 0)
< keg->uk_flags |= UMA_ZONE_HASH;
1195a1207,1210
>
> if ((keg->uk_flags & UMA_ZONE_OFFPAGE) &&
> (keg->uk_flags & UMA_ZONE_VTOSLAB) == 0)
> keg->uk_flags |= UMA_ZONE_HASH;
1212d1226
< int pages;
1216a1231,1232
> KASSERT((keg->uk_flags & UMA_ZONE_PCPU) == 0,
> ("%s: Cannot large-init a UMA_ZONE_PCPU keg", __func__));
1218,1224c1234,1235
< pages = keg->uk_size / UMA_SLAB_SIZE;
<
< /* Account for remainder */
< if ((pages * UMA_SLAB_SIZE) < keg->uk_size)
< pages++;
<
< keg->uk_ppera = pages;
---
> keg->uk_ppera = howmany(keg->uk_size, PAGE_SIZE);
> keg->uk_slabsize = keg->uk_ppera * PAGE_SIZE;
1244a1256,1258
> KASSERT((keg->uk_flags & UMA_ZONE_PCPU) == 0,
> ("%s: Cannot cachespread-init a UMA_ZONE_PCPU keg", __func__));
>
1261a1276
> keg->uk_slabsize = UMA_SLAB_SIZE;
1310a1326,1332
> if (arg->flags & UMA_ZONE_PCPU)
> #ifdef SMP
> keg->uk_flags |= UMA_ZONE_OFFPAGE;
> #else
> keg->uk_flags &= ~UMA_ZONE_PCPU;
> #endif
>
1388c1410
< keg->uk_pgoff = (UMA_SLAB_SIZE * keg->uk_ppera) - totsize;
---
> keg->uk_pgoff = (PAGE_SIZE * keg->uk_ppera) - totsize;
1404c1426
< if (totsize > UMA_SLAB_SIZE * keg->uk_ppera) {
---
> if (totsize > PAGE_SIZE * keg->uk_ppera) {
1679c1701,1702
< wsize = UMA_SLAB_SIZE - sizeof(struct uma_slab) - UMA_MAX_WASTE;
---
> wsize = UMA_SLAB_SIZE - sizeof(struct uma_slab) -
> (UMA_SLAB_SIZE / UMA_MAX_WASTE);
1692c1715,1716
< wsize = UMA_SLAB_SIZE - sizeof(struct uma_slab_refcnt) - UMA_MAX_WASTE;
---
> wsize = UMA_SLAB_SIZE - sizeof(struct uma_slab_refcnt) -
> (UMA_SLAB_SIZE / UMA_MAX_WASTE);
< __FBSDID("$FreeBSD: head/sys/vm/uma_core.c 248084 2013-03-09 02:32:23Z attilio $");
---
> __FBSDID("$FreeBSD: head/sys/vm/uma_core.c 249264 2013-04-08 19:10:45Z glebius $");
768c768
< keg->uk_name, UMA_SLAB_SIZE * keg->uk_ppera);
---
> keg->uk_name, PAGE_SIZE * keg->uk_ppera);
770c770
< keg->uk_freef(mem, UMA_SLAB_SIZE * keg->uk_ppera, flags);
---
> keg->uk_freef(mem, PAGE_SIZE * keg->uk_ppera, flags);
868c868
< mem = allocf(zone, keg->uk_ppera * UMA_SLAB_SIZE, &flags, wait);
---
> mem = allocf(zone, keg->uk_ppera * PAGE_SIZE, &flags, wait);
930c930
< keg->uk_freef(mem, UMA_SLAB_SIZE * keg->uk_ppera,
---
> keg->uk_freef(mem, PAGE_SIZE * keg->uk_ppera,
1141c1141,1149
< KASSERT(keg != NULL, ("Keg is null in keg_small_init"));
---
> if (keg->uk_flags & UMA_ZONE_PCPU) {
> keg->uk_slabsize = sizeof(struct pcpu);
> keg->uk_ppera = howmany(mp_ncpus * sizeof(struct pcpu),
> PAGE_SIZE);
> } else {
> keg->uk_slabsize = UMA_SLAB_SIZE;
> keg->uk_ppera = 1;
> }
>
1144,1145d1151
< if (rsize < UMA_SMALLEST_UNIT)
< rsize = UMA_SMALLEST_UNIT;
1147a1154,1155
> if (rsize < keg->uk_slabsize / 256)
> rsize = keg->uk_slabsize / 256;
1150d1157
< keg->uk_ppera = 1;
1151a1159,1162
> KASSERT((keg->uk_flags & UMA_ZONE_PCPU) == 0 ||
> keg->uk_rsize < sizeof(struct pcpu),
> ("%s: size %u too large", __func__, keg->uk_rsize));
>
1162,1163c1173,1176
< keg->uk_ipers = (UMA_SLAB_SIZE - shsize) / rsize;
< KASSERT(keg->uk_ipers != 0, ("keg_small_init: ipers is 0"));
---
> keg->uk_ipers = (keg->uk_slabsize - shsize) / rsize;
> KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= 255,
> ("%s: keg->uk_ipers %u", __func__, keg->uk_ipers));
>
1165c1178
< wastedspace = UMA_SLAB_SIZE - memused;
---
> wastedspace = keg->uk_slabsize - memused;
1178,1182c1191,1195
< if ((wastedspace >= UMA_MAX_WASTE) &&
< (keg->uk_ipers < (UMA_SLAB_SIZE / keg->uk_rsize))) {
< keg->uk_ipers = UMA_SLAB_SIZE / keg->uk_rsize;
< KASSERT(keg->uk_ipers <= 255,
< ("keg_small_init: keg->uk_ipers too high!"));
---
> if ((wastedspace >= keg->uk_slabsize / UMA_MAX_WASTE) &&
> (keg->uk_ipers < (keg->uk_slabsize / keg->uk_rsize))) {
> keg->uk_ipers = keg->uk_slabsize / keg->uk_rsize;
> KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= 255,
> ("%s: keg->uk_ipers %u", __func__, keg->uk_ipers));
1189,1190c1202,1203
< UMA_MAX_WASTE, keg->uk_ipers,
< UMA_SLAB_SIZE - keg->uk_ipers * keg->uk_rsize);
---
> keg->uk_slabsize / UMA_MAX_WASTE, keg->uk_ipers,
> keg->uk_slabsize - keg->uk_ipers * keg->uk_rsize);
1193,1194d1205
< if ((keg->uk_flags & UMA_ZONE_VTOSLAB) == 0)
< keg->uk_flags |= UMA_ZONE_HASH;
1195a1207,1210
>
> if ((keg->uk_flags & UMA_ZONE_OFFPAGE) &&
> (keg->uk_flags & UMA_ZONE_VTOSLAB) == 0)
> keg->uk_flags |= UMA_ZONE_HASH;
1212d1226
< int pages;
1216a1231,1232
> KASSERT((keg->uk_flags & UMA_ZONE_PCPU) == 0,
> ("%s: Cannot large-init a UMA_ZONE_PCPU keg", __func__));
1218,1224c1234,1235
< pages = keg->uk_size / UMA_SLAB_SIZE;
<
< /* Account for remainder */
< if ((pages * UMA_SLAB_SIZE) < keg->uk_size)
< pages++;
<
< keg->uk_ppera = pages;
---
> keg->uk_ppera = howmany(keg->uk_size, PAGE_SIZE);
> keg->uk_slabsize = keg->uk_ppera * PAGE_SIZE;
1244a1256,1258
> KASSERT((keg->uk_flags & UMA_ZONE_PCPU) == 0,
> ("%s: Cannot cachespread-init a UMA_ZONE_PCPU keg", __func__));
>
1261a1276
> keg->uk_slabsize = UMA_SLAB_SIZE;
1310a1326,1332
> if (arg->flags & UMA_ZONE_PCPU)
> #ifdef SMP
> keg->uk_flags |= UMA_ZONE_OFFPAGE;
> #else
> keg->uk_flags &= ~UMA_ZONE_PCPU;
> #endif
>
1388c1410
< keg->uk_pgoff = (UMA_SLAB_SIZE * keg->uk_ppera) - totsize;
---
> keg->uk_pgoff = (PAGE_SIZE * keg->uk_ppera) - totsize;
1404c1426
< if (totsize > UMA_SLAB_SIZE * keg->uk_ppera) {
---
> if (totsize > PAGE_SIZE * keg->uk_ppera) {
1679c1701,1702
< wsize = UMA_SLAB_SIZE - sizeof(struct uma_slab) - UMA_MAX_WASTE;
---
> wsize = UMA_SLAB_SIZE - sizeof(struct uma_slab) -
> (UMA_SLAB_SIZE / UMA_MAX_WASTE);
1692c1715,1716
< wsize = UMA_SLAB_SIZE - sizeof(struct uma_slab_refcnt) - UMA_MAX_WASTE;
---
> wsize = UMA_SLAB_SIZE - sizeof(struct uma_slab_refcnt) -
> (UMA_SLAB_SIZE / UMA_MAX_WASTE);