linux-lts-quantal-3.5.0/kernel/replay.c
/* Deallocates replay per-thread data and per-process data iff refcnt
 * is 0.  Call with rg_lock held. */
Deallocates replay per-thread data and per-process data iff refcnt
is 0.  Call with rg_lock held.
Deallocates replay per - thread data and per - process data iff refcnt is 0 . Call with rg_lock held .
void
__destroy_replay_thread (struct replay_thread* prp)
{
	struct replay_thread* prev;
	MPRINT ("  Pid %d enters destroy_replay_thread: pid %d, prp = %p, refcnt=%d\n", 
		current->pid, prp->rp_replay_pid, prp, atomic_read(&prp->rp_refcnt));
	if (!atomic_dec_and_test(&prp->rp_refcnt)) {
		DPRINT ("  -> pid %d don't destroy replay prp = %p, refcnt=%d!!\n", 
			current->pid, prp, atomic_read(&prp->rp_refcnt));
		return;
	}
	for (prev = prp; prev->rp_next_thread != prp; prev = prev->rp_next_thread);
	prev->rp_next_thread = prp->rp_next_thread;
	delete_sysv_mappings (prp);
	BUG_ON (ds_list_remove(prp->rp_group->rg_replay_threads, prp) == NULL);
#ifdef CACHE_READS
	put_replay_cache_files (prp->rp_cache_files);
#endif
	__destroy_record_thread (prp->rp_record_thread);
	MPRINT ("  Pid %d exits destroy_replay_thread: pid %d, prp = %p\n", 
		current->pid, prp->rp_replay_pid, prp);
	KFREE (prp);
}
void __destroy_replay_thread ( struct replay_thread * prp ) { struct replay_thread * prev ; MPRINT ( " \n " , current -> pid , prp -> rp_replay_pid , prp , atomic_read ( & prp -> rp_refcnt ) ) ; if ( ! atomic_dec_and_test ( & prp -> rp_refcnt ) ) { DPRINT ( " \n " , current -> pid , prp , atomic_read ( & prp -> rp_refcnt ) ) ; return ; } for ( prev = prp ; prev -> rp_next_thread != prp ; prev = prev -> rp_next_thread ) ; prev -> rp_next_thread = prp -> rp_next_thread ; delete_sysv_mappings ( prp ) ; BUG_ON ( ds_list_remove ( prp -> rp_group -> rg_replay_threads , prp ) == NULL ) ; #ifdef CACHE_READS put_replay_cache_files ( prp -> rp_cache_files ) ; #endif __destroy_record_thread ( prp -> rp_record_thread ) ; MPRINT ( " \n " , current -> pid , prp -> rp_replay_pid , prp ) ; KFREE ( prp ) ; }
Deallocates replay per-thread data and per-process data iff refcnt
 is 0.
Deallocates replay per - thread data and per - process data iff refcnt is 0 .
// remove sys mappings // Decrement the record thread's refcnt and maybe destroy it.