| 133 | } |
| 134 | |
| 135 | static void |
| 136 | removeKernels(ListHead *truncList, struct KernelCache *kcache, size_t truncSize) |
| 137 | { |
| 138 | size_t remSize = 0; |
| 139 | size_t ksize; |
| 140 | ListNode *l; |
| 141 | KernelNode *knode; |
| 142 | |
| 143 | listInitHead(truncList); |
| 144 | |
| 145 | while (remSize < truncSize) { |
| 146 | l = listNodeLast(&kcache->lruKern); |
| 147 | if (l == &kcache->lruKern) { |
| 148 | break; |
| 149 | } |
| 150 | |
| 151 | knode = container_of(l, lruNode, KernelNode); |
| 152 | listDel(l); |
| 153 | listDel(&knode->dimNode); |
| 154 | listAddToTail(truncList, &knode->lruNode); |
| 155 | ksize = fullKernelSize(&knode->kern); |
| 156 | remSize += ksize; |
| 157 | kcache->totalSize -= ksize; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | static void |
| 162 | putRemovedKernels(struct KernelCache *kcache, ListHead *truncList) |
no test coverage detected