Lines Matching defs:chunk

109  * amap_chunk_get: lookup a chunk for slot. if create is non-zero,
110 * the chunk is created if it does not yet exist.
112 * => returns the chunk on success or NULL on error
120 struct vm_amap_chunk *chunk, *newchunk, *pchunk = NULL;
125 for (chunk = amap->am_buckets[bucket]; chunk != NULL;
126 chunk = TAILQ_NEXT(chunk, ac_list)) {
127 if (UVM_AMAP_BUCKET(amap, chunk->ac_baseslot) != bucket)
129 if (chunk->ac_baseslot == baseslot)
130 return chunk;
131 pchunk = chunk;
160 amap_chunk_free(struct vm_amap *amap, struct vm_amap_chunk *chunk)
162 int bucket = UVM_AMAP_BUCKET(amap, chunk->ac_baseslot);
168 nchunk = TAILQ_NEXT(chunk, ac_list);
169 TAILQ_REMOVE(&amap->am_chunks, chunk, ac_list);
170 if (amap->am_buckets[bucket] == chunk) {
178 pool_put(&uvm_amap_chunk_pool, chunk);
197 * the chunk reference count plus one is stored in that chunk's slot.
200 * greater than one.] the second slot of the chunk contains the length
201 * of the chunk. here is an example:
209 * chunk. note that the "plus one" part is needed because a reference
225 if (ppref[offset] > 0) { /* chunk size must be 1 */
291 struct vm_amap_chunk *chunk, *tmp;
313 * of lookups we would have if we could chunk the amap. The
382 chunk = pool_get(&uvm_amap_chunk_pool,
384 if (chunk == NULL)
387 amap->am_buckets[i] = chunk;
389 chunk->ac_baseslot = i * UVM_AMAP_CHUNK;
390 chunk->ac_nslot = n;
391 TAILQ_INSERT_TAIL(&amap->am_chunks, chunk, ac_list);
399 TAILQ_FOREACH_SAFE(chunk, &amap->am_chunks, ac_list, tmp)
400 pool_put(&uvm_amap_chunk_pool, chunk);
447 struct vm_amap_chunk *chunk, *tmp;
465 TAILQ_FOREACH_SAFE(chunk, &amap->am_chunks, ac_list, tmp)
466 pool_put(&uvm_amap_chunk_pool, chunk);
484 struct vm_amap_chunk *chunk;
499 AMAP_CHUNK_FOREACH(chunk, amap) {
500 int i, refs, map = chunk->ac_usedmap;
505 anon = chunk->ac_anon[slot];
537 * => if canchunk is true, then we may clip the entry into a chunk
552 struct vm_amap_chunk *chunk = NULL, *srcchunk = NULL;
563 * chunk. We align startva/endva to chunk-sized
566 * If we cannot chunk the amap, allocate it in a way
659 chunk = amap_chunk_get(amap, lcv, 1, PR_NOWAIT);
660 if (chunk == NULL) {
669 chunk->ac_anon[i] = anon = srcchunk->ac_anon[j];
675 chunk->ac_usedmap |= (1 << i);
744 struct vm_amap_chunk *chunk;
753 AMAP_CHUNK_FOREACH(chunk, amap) {
754 int i, map = chunk->ac_usedmap;
759 anon = chunk->ac_anon[slot];
817 chunk->ac_anon[slot] = nanon;
931 * the ppref array; that is, there is no previous chunk.
967 amap_wiperange_chunk(struct vm_amap *amap, struct vm_amap_chunk *chunk,
977 map = chunk->ac_usedmap;
978 if (startbase == chunk->ac_baseslot)
980 if (endbase == chunk->ac_baseslot)
988 chunk->ac_usedmap ^= 1 << curslot;
989 anon = chunk->ac_anon[curslot];
993 chunk->ac_anon[curslot] = NULL;
1020 struct vm_amap_chunk *chunk, *nchunk;
1034 TAILQ_FOREACH_SAFE(chunk, &amap->am_chunks, ac_list, nchunk) {
1035 if (chunk->ac_baseslot + chunk->ac_nslot <= slotoff)
1037 if (chunk->ac_baseslot >= slotoff + slots)
1040 amap_wiperange_chunk(amap, chunk, slotoff, slots);
1041 if (chunk->ac_usedmap == 0)
1042 amap_chunk_free(amap, chunk);
1046 for (chunk = amap->am_buckets[bucket]; chunk != NULL;
1047 chunk = nchunk) {
1048 nchunk = TAILQ_NEXT(chunk, ac_list);
1050 if (UVM_AMAP_BUCKET(amap, chunk->ac_baseslot) !=
1053 if (chunk->ac_baseslot + chunk->ac_nslot <=
1056 if (chunk->ac_baseslot >= slotoff + slots)
1059 amap_wiperange_chunk(amap, chunk, slotoff,
1061 if (chunk->ac_usedmap == 0)
1062 amap_chunk_free(amap, chunk);
1089 struct vm_amap_chunk *chunk;
1102 AMAP_CHUNK_FOREACH(chunk, am) {
1103 map = chunk->ac_usedmap;
1111 anon = chunk->ac_anon[slot];
1156 struct vm_amap_chunk *chunk;
1162 chunk = amap_chunk_get(amap, slot, 0, PR_NOWAIT);
1163 if (chunk == NULL)
1166 return chunk->ac_anon[UVM_AMAP_SLOTIDX(slot)];
1181 struct vm_amap_chunk *chunk = NULL;
1193 chunk = amap_chunk_get(amap, lcv, 0, PR_NOWAIT);
1194 if (chunk == NULL)
1198 &chunk->ac_anon[UVM_AMAP_SLOTIDX(lcv)],
1213 struct vm_amap_chunk *chunk;
1219 chunk = amap_chunk_get(amap, slot, 1, PR_WAITOK);
1220 KASSERT(chunk != NULL);
1235 struct vm_amap_chunk *chunk;
1241 chunk = amap_chunk_get(amap, slot, 1, PR_NOWAIT);
1242 if (chunk == NULL)
1247 struct vm_anon *oanon = chunk->ac_anon[slot];
1257 if (chunk->ac_anon[slot] != NULL)
1260 chunk->ac_usedmap |= 1 << slot;
1263 chunk->ac_anon[slot] = anon;
1277 struct vm_amap_chunk *chunk;
1285 chunk = amap_chunk_get(amap, slot, 0, PR_NOWAIT);
1286 KASSERT(chunk != NULL);
1289 KASSERT(chunk->ac_anon[slot] != NULL);
1291 chunk->ac_anon[slot] = NULL;
1292 chunk->ac_usedmap &= ~(1 << slot);
1295 if (chunk->ac_usedmap == 0)
1296 amap_chunk_free(amap, chunk);