Beispiel #1
0
  void
split_from_veelist(shellptr shellA,shellptr shellB,listptr vee_list,listptr vv_list)
{
  veeptr thisvee,nextvee;
  evfptr evfA,evfB;
  leptr newle,newle1,newle2,correctle,correctle1,correctle2;
  ;
  thisvee = vee_list->first.vee;
  while (thisvee != Nil)
  {
    nextvee = thisvee->next;
    evfA = thisvee->evfA;
    evfB = thisvee->evfB;
    switch (thisvee->onptcode)
    {
    case EvfApt1on:
      correctle = find_correct_splitedge(thisvee->evfB,thisvee->breakpos);
      newle = break_edge_at_pos(correctle,thisvee->breakpos);
      log_pure_vv(vv_list,thisvee->evfA->le1->facevert,newle->facevert);
      break;
    case EvfApt2on:
      correctle = find_correct_splitedge(thisvee->evfB,thisvee->breakpos);
      newle = break_edge_at_pos(correctle,thisvee->breakpos);
      log_pure_vv(vv_list,thisvee->evfA->le2->facevert,newle->facevert);
      break;
    case EvfBpt1on:
      correctle = find_correct_splitedge(thisvee->evfA,thisvee->breakpos);
      newle = break_edge_at_pos(correctle,thisvee->breakpos);
      log_pure_vv(vv_list,newle->facevert,thisvee->evfB->le1->facevert);
      break;
    case EvfBpt2on:
      correctle = find_correct_splitedge(thisvee->evfA,thisvee->breakpos);
      newle = break_edge_at_pos(correctle,thisvee->breakpos);
      log_pure_vv(vv_list,newle->facevert,thisvee->evfB->le1->facevert);
      break;
    case Evfsintersect:
      correctle1 = find_correct_splitedge(thisvee->evfA,thisvee->breakpos);
      correctle2 = find_correct_splitedge(thisvee->evfB,thisvee->breakpos);
      newle1 = break_edge_at_pos(correctle1,thisvee->breakpos);
      newle2 = break_edge_at_pos(correctle2,thisvee->breakpos);
      log_pure_vv(vv_list,newle1->facevert,newle2->facevert);
      break;
    }
    del_elem(vee_list,(elemptr) thisvee);
    thisvee = nextvee;
  }
}
Beispiel #2
0
static u64 del_lru_elem_unlocked(struct ce_array *ca)
{
	unsigned int min = FULL_COUNT_MASK;
	int i, min_idx = 0;

	for (i = 0; i < ca->n; i++) {
		unsigned int this = FULL_COUNT(ca->array[i]);

		if (min > this) {
			min = this;
			min_idx = i;
		}
	}

	del_elem(ca, min_idx);

	return PFN(ca->array[min_idx]);
}
Beispiel #3
0
  void
resolve_edge_faces(shellptr shellA,shellptr shellB,listptr vf_list,listptr ef_list)
{		/* logs final entry in vf list */
  efptr thisef,nextef;
  vertype breakpos;
  leptr breakle,newle;
  ;
  /* assumes ef_list has been created */
  log_edge_faces(shellA,shellB,vf_list,ef_list,SolidA);
  log_edge_faces(shellB,shellA,vf_list,ef_list,SolidB);

  thisef = ef_list->first.ef;
  while (thisef != Nil)
  {
    nextef = thisef->next;
    /* for edge/face case make sure you'r splitting the correct edge */
    breakle = find_correct_splitedge(thisef->breakevf,thisef->breakpos);
    newle = break_edge_at_pos(breakle,thisef->breakpos);
    log_vf(vf_list,newle->facevert,thisef->breakfve,thisef->evfinwhichsolid);
    del_elem(ef_list,(elemptr) thisef);
    thisef = nextef;
  }
}
Beispiel #4
0
int cec_add_elem(u64 pfn)
{
	struct ce_array *ca = &ce_arr;
	unsigned int to;
	int count, ret = 0;

	/*
	 * We can be called very early on the identify_cpu() path where we are
	 * not initialized yet. We ignore the error for simplicity.
	 */
	if (!ce_arr.array || ce_arr.disabled)
		return -ENODEV;

	mutex_lock(&ce_mutex);

	ca->ces_entered++;

	if (ca->n == MAX_ELEMS)
		WARN_ON(!del_lru_elem_unlocked(ca));

	ret = find_elem(ca, pfn, &to);
	if (ret < 0) {
		/*
		 * Shift range [to-end] to make room for one more element.
		 */
		memmove((void *)&ca->array[to + 1],
			(void *)&ca->array[to],
			(ca->n - to) * sizeof(u64));

		ca->array[to] = (pfn << PAGE_SHIFT) |
				(DECAY_MASK << COUNT_BITS) | 1;

		ca->n++;

		ret = 0;

		goto decay;
	}

	count = COUNT(ca->array[to]);

	if (count < count_threshold) {
		ca->array[to] |= (DECAY_MASK << COUNT_BITS);
		ca->array[to]++;

		ret = 0;
	} else {
		u64 pfn = ca->array[to] >> PAGE_SHIFT;

		if (!pfn_valid(pfn)) {
			pr_warn("CEC: Invalid pfn: 0x%llx\n", pfn);
		} else {
			/* We have reached max count for this page, soft-offline it. */
			pr_err("Soft-offlining pfn: 0x%llx\n", pfn);
			memory_failure_queue(pfn, MF_SOFT_OFFLINE);
			ca->pfns_poisoned++;
		}

		del_elem(ca, to);

		/*
		 * Return a >0 value to denote that we've reached the offlining
		 * threshold.
		 */
		ret = 1;

		goto unlock;
	}

decay:
	ca->decay_count++;

	if (ca->decay_count >= CLEAN_ELEMS)
		do_spring_cleaning(ca);

unlock:
	mutex_unlock(&ce_mutex);

	return ret;
}