From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 3/4] mem: remove the old cgroup API
Date: Mon, 1 Jun 2020 18:04:58 +0800 [thread overview]
Message-ID: <20200601100459.32511-3-liwang@redhat.com> (raw)
In-Reply-To: <20200601100459.32511-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 45f155922..7a911f8b3 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;
@@ -709,57 +702,6 @@ void write_cpusets(long nd)
}
}
-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-06-01 10:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-01 10:04 [LTP] [PATCH v2 1/4] lib: add new cgroup test API Li Wang
2020-06-01 10:04 ` [LTP] [PATCH v2 2/4] mem: take use of new cgroup API Li Wang
2020-06-01 10:04 ` Li Wang [this message]
2020-06-01 10:04 ` [LTP] [PATCH v2 4/4] mm: add cpuset01 to runtest file Li Wang
2020-06-01 10:58 ` [LTP] [PATCH v2 1/4] lib: add new cgroup test API Li Wang
2020-06-01 13:57 ` Jan Stancek
2020-06-02 4:42 ` Li Wang
2020-06-02 12:12 ` Jan Stancek
2020-06-03 1:38 ` Li Wang
2020-06-03 10:43 ` Jan Stancek
2020-06-03 12:51 ` Li Wang
2020-06-05 10:14 ` Jan Stancek
2020-06-08 8:53 ` Li Wang
2020-06-08 9:48 ` Jan Stancek
2020-06-08 10:18 ` Li Wang
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=20200601100459.32511-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox