From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1 3/4] mem: remove the old cgroup API
Date: Wed, 27 May 2020 11:14:29 +0800 [thread overview]
Message-ID: <20200527031430.22144-3-liwang@redhat.com> (raw)
In-Reply-To: <20200527031430.22144-1-liwang@redhat.com>
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/mem/include/mem.h | 16 +--------
testcases/kernel/mem/lib/mem.c | 58 ------------------------------
2 files changed, 1 insertion(+), 73 deletions(-)
diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index f553651c2..0e089fae2 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -60,24 +60,10 @@ void test_ksm_merge_across_nodes(unsigned long nr_pages);
void check_hugepage(void);
void write_memcg(void);
-/* cpuset/memcg */
-
-#define CPATH "/dev/cpuset"
-#define CPATH_NEW CPATH "/1"
-#define MEMCG_PATH "/dev/cgroup"
-#define MEMCG_PATH_NEW MEMCG_PATH "/1"
-#define MEMCG_LIMIT MEMCG_PATH_NEW "/memory.limit_in_bytes"
-#define MEMCG_SW_LIMIT MEMCG_PATH_NEW "/memory.memsw.limit_in_bytes"
-#if HAVE_SYS_EVENTFD_H
-#define PATH_OOMCTRL MEMCG_PATH_NEW "/memory.oom_control"
-#define PATH_EVTCTRL MEMCG_PATH_NEW "/cgroup.event_control"
-#endif
-
+/* cpuset/memcg - include/tst_cgroup.h */
void read_cpuset_files(char *prefix, char *filename, char *retbuf);
void write_cpuset_files(char *prefix, char *filename, char *buf);
void write_cpusets(long nd);
-void mount_mem(char *name, char *fs, char *options, char *path, char *path_new);
-void umount_mem(char *path, char *path_new);
/* shared */
unsigned int get_a_numa_node(void);
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index df1baa42a..3ccba142e 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -312,13 +312,6 @@ void check_hugepage(void)
tst_brk(TCONF, "Huge page is not supported.");
}
-void write_memcg(void)
-{
- SAFE_FILE_PRINTF(MEMCG_LIMIT, "%ld", TESTMEM);
-
- SAFE_FILE_PRINTF(MEMCG_PATH_NEW "/tasks", "%d", getpid());
-}
-
struct ksm_merge_data {
char data;
unsigned int mergeable_size;
@@ -711,57 +704,6 @@ void write_cpusets(long nd)
SAFE_FILE_PRINTF(PATH_CG1_CST_LTP "/tasks", "%d", getpid());
}
-void umount_mem(char *path, char *path_new)
-{
- FILE *fp;
- int fd;
- char s_new[BUFSIZ], s[BUFSIZ], value[BUFSIZ];
-
- /* Move all processes in task to its parent node. */
- sprintf(s, "%s/tasks", path);
- fd = open(s, O_WRONLY);
- if (fd == -1)
- tst_res(TWARN | TERRNO, "open %s", s);
-
- snprintf(s_new, BUFSIZ, "%s/tasks", path_new);
- fp = fopen(s_new, "r");
- if (fp == NULL)
- tst_res(TWARN | TERRNO, "fopen %s", s_new);
- if ((fd != -1) && (fp != NULL)) {
- while (fgets(value, BUFSIZ, fp) != NULL)
- if (write(fd, value, strlen(value) - 1)
- != (ssize_t)strlen(value) - 1)
- tst_res(TWARN | TERRNO, "write %s", s);
- }
- if (fd != -1)
- close(fd);
- if (fp != NULL)
- fclose(fp);
- if (rmdir(path_new) == -1)
- tst_res(TWARN | TERRNO, "rmdir %s", path_new);
- if (umount(path) == -1)
- tst_res(TWARN | TERRNO, "umount %s", path);
- if (rmdir(path) == -1)
- tst_res(TWARN | TERRNO, "rmdir %s", path);
-}
-
-void mount_mem(char *name, char *fs, char *options, char *path, char *path_new)
-{
- SAFE_MKDIR(path, 0777);
- if (mount(name, path, fs, 0, options) == -1) {
- if (errno == ENODEV) {
- if (rmdir(path) == -1)
- tst_res(TWARN | TERRNO, "rmdir %s failed",
- path);
- tst_brk(TCONF,
- "file system %s is not configured in kernel",
- fs);
- }
- tst_brk(TBROK | TERRNO, "mount %s", path);
- }
- SAFE_MKDIR(path_new, 0777);
-}
-
/* shared */
/* Warning: *DO NOT* use this function in child */
--
2.21.1
next prev parent reply other threads:[~2020-05-27 3:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-27 3:14 [LTP] [PATCH v1 1/4] lib: add new cgroup test API Li Wang
2020-05-27 3:14 ` [LTP] [PATCH v1 2/4] mem: take use of new cgroup API Li Wang
2020-05-27 7:45 ` Jan Stancek
2020-05-27 10:10 ` Li Wang
2020-05-27 3:14 ` Li Wang [this message]
2020-05-27 3:14 ` [LTP] [PATCH v1 4/4] mm: add cpuset01 to runtest file Li Wang
2020-05-27 7:40 ` [LTP] [PATCH v1 1/4] lib: add new cgroup test API Jan Stancek
2020-05-27 8:00 ` Li Wang
2020-05-27 9:15 ` Jan Stancek
2020-05-27 7:47 ` Jan Stancek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200527031430.22144-3-liwang@redhat.com \
--to=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.