Exemple #1
0
static void cleanup(void)
{
	FILE_PRINTF(cdrv[id].file, "%d", boost_value);

	if (governor[0] != '\0')
		FILE_PRINTF(governor, "%s", governor_name);
}
Exemple #2
0
/*
 * We try raising bdi readahead limit as much as we can. We write
 * and read back "read_ahead_kb" sysfs value, starting with filesize.
 * If that fails, we try again with lower value.
 * readahead_length used in the test is then set to MIN(bdi limit, 2M),
 * to respect kernels prior to commit 600e19afc5f8a6c.
 */
static void setup_readahead_length(void)
{
	struct stat sbuf;
	char tmp[PATH_MAX], *backing_dev;
	int ra_new_limit, ra_limit;

	/* Find out backing device name */
	SAFE_LSTAT(tst_device->dev, &sbuf);
	if (S_ISLNK(sbuf.st_mode))
		SAFE_READLINK(tst_device->dev, tmp, PATH_MAX);
	else
		strcpy(tmp, tst_device->dev);

	backing_dev = basename(tmp);
	sprintf(sys_bdi_ra_path, "/sys/class/block/%s/bdi/read_ahead_kb",
		backing_dev);
	if (access(sys_bdi_ra_path, F_OK))
		return;

	SAFE_FILE_SCANF(sys_bdi_ra_path, "%d", &orig_bdi_limit);

	/* raise bdi limit as much as kernel allows */
	ra_new_limit = testfile_size / 1024;
	while (ra_new_limit > pagesize / 1024) {
		FILE_PRINTF(sys_bdi_ra_path, "%d", ra_new_limit);
		SAFE_FILE_SCANF(sys_bdi_ra_path, "%d", &ra_limit);

		if (ra_limit == ra_new_limit) {
			readahead_length = MIN(ra_new_limit * 1024,
				2 * 1024 * 1024);
			break;
		}
		ra_new_limit = ra_new_limit / 2;
	}
}
Exemple #3
0
void cleanup(void)
{
	if (access(PATH_KSM "merge_across_nodes", F_OK) == 0)
		FILE_PRINTF(PATH_KSM "merge_across_nodes",
				 "%d", merge_across_nodes);

	TEST_CLEANUP;
}
Exemple #4
0
void cleanup(void)
{
	if (access(PATH_KSM "merge_across_nodes", F_OK) == 0)
		FILE_PRINTF(PATH_KSM "merge_across_nodes",
				 "%d", merge_across_nodes);

	umount_mem(MEMCG_PATH, MEMCG_PATH_NEW);
}
Exemple #5
0
Fichier : ksm02.c Projet : 1587/ltp
void cleanup(void)
{
	if (access(PATH_KSM "merge_across_nodes", F_OK) == 0)
		FILE_PRINTF(PATH_KSM "merge_across_nodes",
				 "%d", merge_across_nodes);

	restore_max_page_sharing();

	umount_mem(CPATH, CPATH_NEW);
}
Exemple #6
0
static void cleanup(void)
{
	int i;

	for (i = 0; i < num_shms; i++)
		rm_shm(shm_id_arr[i]);

	FILE_PRINTF(PATH_SHMMNI, "%ld", orig_shmmni);
	restore_nr_hugepages();
}
Exemple #7
0
void tst_sys_conf_restore(int verbose)
{
	struct tst_sys_conf *i;

	for (i = save_restore_data; i; i = i->next) {
		if (verbose) {
			tst_res(TINFO, "Restoring conf.: %s -> %s\n",
				i->path, i->value);
		}
		FILE_PRINTF(i->path, "%s", i->value);
	}
}
Exemple #8
0
static void cleanup(void)
{
	if (sigprocmask(SIG_SETMASK, &oldset, NULL) < 0)
		tst_resm(TWARN | TERRNO, "sigprocmask restore oldset failed");

	if (fd > 0 && close(fd))
		tst_resm(TWARN | TERRNO, "failed to close file");

	tst_rmdir();

	/* Restore the lease-break-time. */
	FILE_PRINTF(PATH_LS_BRK_T, "%d", ls_brk_t);
}
Exemple #9
0
Fichier : mem.c Projet : Havner/ltp
void restore_max_page_sharing(void)
{
	if (access(PATH_KSM "max_page_sharing", F_OK) == 0)
	        FILE_PRINTF(PATH_KSM "max_page_sharing",
	                         "%d", max_page_sharing);
}