Lines Matching refs:cnt
212 int cnt = m->mem->active_idx + 2;
214 int span = UNIT + size*cnt;
217 cnt++;
220 if (cnt > m->last_idx+1)
221 cnt = m->last_idx+1;
222 m->mem->active_idx = cnt-1;
244 int i = 0, cnt;
254 cnt = small_cnt_tab[sc][i];
259 cnt = med_cnt_tab[sc&3];
261 // reduce cnt to avoid excessive eagar allocation.
262 while (!(cnt&1) && 4*cnt > usage)
263 cnt >>= 1;
267 while (size*cnt >= 65536*UNIT)
268 cnt >>= 1;
273 if (cnt==1 && size*cnt+UNIT <= pagesize/2) cnt = 2;
275 // All choices of size*cnt are "just below" a power of two, so anything
277 if (size*cnt+UNIT > pagesize/2) {
294 if (4*cnt > usage && !nosmall) {
296 else if ((sc&3)==1 && size*cnt>8*pagesize) cnt = 2;
297 else if ((sc&3)==2 && size*cnt>4*pagesize) cnt = 3;
298 else if ((sc&3)==0 && size*cnt>8*pagesize) cnt = 3;
299 else if ((sc&3)==0 && size*cnt>2*pagesize) cnt = 5;
301 size_t needed = size*cnt + UNIT;
307 if (!nosmall && cnt<=7) {
310 if (req<size+UNIT || (req>=4*pagesize && 2*cnt>usage)) {
311 cnt = 1;
327 if (active_idx > cnt-1) active_idx = cnt-1;
330 int j = size_to_class(UNIT+cnt*size-IB);
331 int idx = alloc_slot(j, UNIT+cnt*size-IB);
340 for (int i=0; i<=cnt; i++)
342 active_idx = cnt-1;
344 ctx.usage_by_class[sc] += cnt;
346 m->freed_mask = (2u<<(cnt-1))-1 - m->avail_mask;
350 m->last_idx = cnt-1;