Lines Matching refs:to

21  * We've opted for possibly the simplest data structure to collect those - an
27 * The generation in the two highest order bits is two bits which are set to 11b
29 * generation field gets decremented during spring cleaning to 10b, then 01b and
32 * This way we're employing the natural numeric ordering to make sure that newly
39 * If, after decay, an element gets inserted again, its generation is set to 11b
40 * to make sure it has higher numerical count than other, older elements and
41 * thus emulate an LRU-like behavior when deleting elements to free up space
44 * When an element reaches it's max count of action_threshold, we try to poison
47 * initialized to COUNT_MASK which is the maximum.
49 * That error event entry causes cec_add_elem() to return !0 value and thus
50 * signal to its callers to log the error.
53 * memmove(), it is because it is a very simple structure to handle and max data
55 * We wanted to avoid the pointer traversal of more complex structures like a
139 * Decrement decay value. We're using DECAY_BITS bits to denote decay of an
140 * element in the array. On insertion and any access, it gets reset to max.
182 * @to: index of the smallest element which is >= then @pfn.
186 static int __find_elem(struct ce_array *ca, u64 pfn, unsigned int *to)
201 if (to)
202 *to = i;
211 * terminates when min > max, which means the min index points to the
212 * bigger element while the max index to the smaller element, in-between
213 * which the new @pfn belongs to.
217 if (to)
218 *to = min;
223 static int find_elem(struct ce_array *ca, u64 pfn, unsigned int *to)
225 WARN_ON(!to);
228 *to = 0;
231 return __find_elem(ca, pfn, to);
313 * cec_add_elem - Add an element to the CEC array.
314 * @pfn: page frame number to insert
325 unsigned int to = 0;
342 err = find_elem(ca, pfn, &to);
345 * Shift range [to-end] to make room for one more element.
347 memmove((void *)&ca->array[to + 1],
348 (void *)&ca->array[to],
349 (ca->n - to) * sizeof(u64));
351 ca->array[to] = pfn << PAGE_SHIFT;
356 ca->array[to] |= DECAY_MASK << COUNT_BITS;
357 ca->array[to]++;
360 count = COUNT(ca->array[to]);
362 u64 pfn = ca->array[to] >> PAGE_SHIFT;
373 del_elem(ca, to);
376 * Return a >0 value to callers, to denote that we've reached