linux-lts-quantal-3.5.0/kernel/replay.c
// Need to re-establish preallcoations (if needed) after a deallocation such as a munmap,
// in case that memory area is used again in the future
Need to re-establish preallcoations (if needed) after a deallocation such as a munmap,
in case that memory area is used again in the future
Need to re - establish preallcoations ( if needed ) after a deallocation such as a munmap in case that memory area is used again in the future
static void 
preallocate_after_munmap (u_long addr, u_long len)
{
	ds_list_iter_t* iter;
	struct reserved_mapping* pmapping;
	u_long begin, end;
	len = (len % PAGE_SIZE == 0) ? len : len - (len % PAGE_SIZE) + PAGE_SIZE; 
	MPRINT ("Re-allocating reserved memory as needed from %lx to %lx\n", addr, addr+len);
	iter = ds_list_iter_create (current->replay_thrd->rp_record_thread->rp_group->rg_reserved_mem_list);
	while ((pmapping = ds_list_iter_next (iter)) != NULL) {
		MPRINT ("pre-allocation from %lx to %lx\n", pmapping->m_begin, pmapping->m_end);
		if (pmapping->m_begin > addr+len) break; 
		if (pmapping->m_begin <= addr+len && pmapping->m_end >= addr) {
			MPRINT ("Overlap\n");
			begin = (pmapping->m_begin > addr) ? pmapping->m_begin : addr;
			end = (pmapping->m_end < addr+len) ? pmapping->m_end : addr+len;
			do_preallocate (begin, end);
		}
	}
	ds_list_iter_destroy (iter);
}
static void preallocate_after_munmap ( u_long addr , u_long len ) { ds_list_iter_t * iter ; struct reserved_mapping * pmapping ; u_long begin , end ; len = ( len % PAGE_SIZE == 0 ) ? len : len - ( len % PAGE_SIZE ) + PAGE_SIZE ; MPRINT ( " \n " , addr , addr + len ) ; iter = ds_list_iter_create ( current -> replay_thrd -> rp_record_thread -> rp_group -> rg_reserved_mem_list ) ; while ( ( pmapping = ds_list_iter_next ( iter ) ) != NULL ) { MPRINT ( " \n " , pmapping -> m_begin , pmapping -> m_end ) ; if ( pmapping -> m_begin > addr + len ) break ; if ( pmapping -> m_begin <= addr + len && pmapping -> m_end >= addr ) { MPRINT ( " \n " ) ; begin = ( pmapping -> m_begin > addr ) ? pmapping -> m_begin : addr ; end = ( pmapping -> m_end < addr + len ) ? pmapping -> m_end : addr + len ; do_preallocate ( begin , end ) ; } } ds_list_iter_destroy ( iter ) ; }
Need to re-establish preallcoations (if needed) after a deallocation such as a munmap,
in case that memory area is used again in the future
Need to re - establish preallcoations ( if needed ) after a deallocation such as a munmap in case that memory area is used again in the future
// pad to nearest page size // No more mappings will matter