Lines Matching refs:undo

72  * Removing the undo structure tunables involved a serious redesign of
73 * how they were implemented. There is now one undo structure for
76 * to. To avoid scalability and performance problems, the undo
83 * The latter is used when removing the semaphore, so the undo
86 * The undo structure itself contains pointers to the ksemid and proc
88 * adjust-on-exit (AOE) values. When an undo structure is allocated it
97 * sem_rmid, holding the ID lock, iterates through all undo structures
99 * see if p_semacct is NULL. If it is, it skips that undo structure
100 * and continues to the next. Otherwise, it removes the undo structure
102 * hold that the undo structure had on the semaphore.
107 * up all undo structures found in the tree -- a coexecuting sem_rmid
108 * will see the NULL p_semacct and skip that undo structure. It walks
109 * the AVL tree (using avl_destroy_nodes) and for each undo structure
111 * undo structure has a hold on the semaphore), updates all semaphores
114 * semaphore, drops the ID lock, and frees the undo structure.
253 sem_undo_add(short val, ushort_t num, struct sem_undo *undo)
255 int newval = undo->un_aoe[num] - val;
259 undo->un_aoe[num] = newval;
265 * sem_undo_clear - clears all undo entries for specified semaphores
272 struct sem_undo *undo;
278 for (undo = list_head(&sp->sem_undos); undo;
279 undo = list_next(&sp->sem_undos, undo))
281 undo->un_aoe[i] = 0;
288 sem_rollback(ksemid_t *sp, struct sembuf *op, int n, struct sem_undo *undo)
298 ASSERT(undo != NULL);
299 (void) sem_undo_add(-op->sem_op, op->sem_num, undo);
309 struct sem_undo *undo;
314 while (undo = list_head(&sp->sem_undos)) {
315 list_remove(&sp->sem_undos, undo);
316 mutex_enter(&undo->un_proc->p_lock);
317 if (undo->un_proc->p_semacct == NULL) {
318 mutex_exit(&undo->un_proc->p_lock);
321 avl_remove(undo->un_proc->p_semacct, undo);
322 mutex_exit(&undo->un_proc->p_lock);
323 kmem_free(undo, size);
610 struct sem_undo *undo;
618 while (undo = avl_destroy_nodes(tree, &cookie)) {
619 ksemid_t *sp = undo->un_sp;
626 int adj = undo->un_aoe[i];
640 list_remove(&sp->sem_undos, undo);
643 kmem_free(undo, size);
802 * Helper function for semop - creates an undo structure and adds it to
810 struct sem_undo *undo;
817 undo = kmem_zalloc(size, KM_SLEEP);
818 undo->un_proc = pp;
819 undo->un_sp = sp;
826 kmem_free(undo, size);
846 kmem_free(undo, size);
848 *un = undo;
849 avl_insert(pp->p_semacct, undo, where);
851 list_insert_head(&sp->sem_undos, undo);
876 struct sem_undo *undo;
972 * operations are marked SEM_UNDO, find (or allocate) the undo
995 undo = avl_find(pp->p_semacct, &template, NULL);
997 undo = NULL;
999 if (undo == NULL) {
1005 &undo))
1017 * Actually, do the operations and undo them if a wait is needed
1031 undo)))) {
1033 sem_rollback(sp, uops, i, undo);
1061 op->sem_num, undo))) {
1063 sem_rollback(sp, uops, i, undo);
1072 sem_rollback(sp, uops, i, undo);
1119 sem_rollback(sp, uops, i, undo);