mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 12:07:12 +00:00 
			
		
		
		
	gem_tiled_swapping: Purge all page/swap caches first
Reset the system to a vanilla state before we query how much RAM/swap space is available for our testing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
		
							parent
							
								
									5d607a744f
								
							
						
					
					
						commit
						ff7806e52c
					
				@ -61,6 +61,7 @@ void igt_wait_for_keypress(void);
 | 
			
		||||
 | 
			
		||||
/* These are separate to allow easier testing when porting, see the comment at
 | 
			
		||||
 * the bottom of intel_os.c. */
 | 
			
		||||
void intel_purge_vm_caches(void);
 | 
			
		||||
uint64_t intel_get_avail_ram_mb(void);
 | 
			
		||||
uint64_t intel_get_total_ram_mb(void);
 | 
			
		||||
uint64_t intel_get_total_swap_mb(void);
 | 
			
		||||
 | 
			
		||||
@ -185,6 +185,19 @@ intel_get_total_swap_mb(void)
 | 
			
		||||
	return retval / (1024*1024);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
intel_purge_vm_caches(void)
 | 
			
		||||
{
 | 
			
		||||
	int fd;
 | 
			
		||||
 | 
			
		||||
	fd = open("/proc/sys/vm/drop_caches", O_RDWR);
 | 
			
		||||
	if (fd < 0)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	write(fd, "3\n", 2);
 | 
			
		||||
	close(fd);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * When testing a port to a new platform, create a standalone test binary
 | 
			
		||||
 | 
			
		||||
@ -102,6 +102,7 @@ igt_simple_main
 | 
			
		||||
	current_tiling_mode = I915_TILING_X;
 | 
			
		||||
 | 
			
		||||
	igt_skip_on_simulation();
 | 
			
		||||
	intel_purge_vm_caches();
 | 
			
		||||
 | 
			
		||||
	fd = drm_open_any();
 | 
			
		||||
	/* need slightly more than available memory */
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user