[Devel] [PATCH vz10 v4 1/2] selftests: cgroup: test page cache limiting feature
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Mon Dec 8 08:53:32 MSK 2025
> +static int vm_drop_caches(void)
> +{
> + int fd;
> + int ret = EXIT_SUCCESS;
> +
> + fd = open("/proc/sys/vm/drop_caches", O_WRONLY);
> + if (fd < 0) {
> + ksft_perror("failed to open drop_caches");
> + return EXIT_FAILURE;
> + }
> +
> + if (write(fd, "3", 1) != 1) {
> + ksft_perror("failed to write to drop_caches");
> + ret = EXIT_FAILURE;
> + }
> +
> + if (close(fd) < 0) {
> + ksft_perror("failed to close drop_caches");
> + ret = EXIT_FAILURE;
> + }
> +
> + return ret;
> +}
Can we maybe factor out this function (now used in both patches) and reuse it?
--
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.
More information about the Devel
mailing list