mm/thp: add two new case
v5 cover mm/thp: add two new case
The patchset is desinged to test THP functionality.
when one process allocate hugepage aligned anonymous pages, kernel thread 'khugepaged' controlled by sysfs knobs /sys/kernel/mm/transparent_hugepage/* will scan them, and make them as transparent hugepage if they are suited, you can find out how many transparent hugepages are there in one process from /proc/<pid>/smaps, among the file contents, 'AnonHugePages' entry stand for transparent hugepage.
v1 to v2:
accepted Wanlong's suggestion, added some comment for '10s' added 'static' key word for single-file-only variant.
v2 to v3:
added some comments for low memory system.
v3 to v4:
Wanglong point out that the value of khugepaged/defrag is string type, not a numeric before applying the commit e27e6151b154 in v2.6.39-rc4, and I checked the code again, found the current cases thp0* don't be effected by khugepaged/defrag, so I removed the checking of khugepaged/defrag from khugepaged_scan_done().
v4 to v5:
1. made some cleaup
2. updated 10s to 5s for each checking in khugepaged_scan_done()
3. used SAFE_FILE_SCANF|PRINTF() instead of write_file()
v5 to v6:
made a little cleanup.
Zhouping Liu (3):
mm/thp: new case thp04.c
lib/mem: introduce a new function set_global_mempolicy() mm/thp: add new case thp05
runtest/mm | 6 ++ testcases/kernel/mem/include/mem.h | 12 +++ testcases/kernel/mem/lib/mem.c | 199 ++++++++++++++++++++++++++++++++++++- testcases/kernel/mem/thp/thp04.c | 142 ++++++++++++++++++++++++++ testcases/kernel/mem/thp/thp05.c | 153 ++++++++++++++++++++++++++++ 5 files changed, 511 insertions(+), 1 deletion(-) create mode 100644 testcases/kernel/mem/thp/thp04.c create mode 100644 testcases/kernel/mem/thp/thp05.c
Signature · 13 lines
1.7.11.7 ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v4 1/3 mm/thp: new case thp04.c
The case is desinged to test THP functionality.
when one process allocate hugepage aligned anonymous pages, kernel thread 'khugepaged' controlled by sysfs knobs /sys/kernel/mm/transparent_hugepage/* will scan them, and make them as transparent hugepage if they are suited, you can find out how many transparent hugepages are there in one process from /proc/<pid>/smaps, among the file contents, 'AnonHugePages' entry stand for transparent hugepage.
--- runtest/mm | 3 + testcases/kernel/mem/include/mem.h | 11 +++ testcases/kernel/mem/lib/mem.c | 188 +++++++++++++++++++++++++++++++++++++ testcases/kernel/mem/thp/thp04.c | 142 ++++++++++++++++++++++++++++ 4 files changed, 344 insertions(+) create mode 100644 testcases/kernel/mem/thp/thp04.c
runtest/mm +3 -0
@@ -84,6 +84,9 @@ swapping01 swapping01 -i 5 thp01 thp01 -I 120 thp02 thp02 thp03 thp03 +thp04_1 thp04 +thp04_2 thp04 -n 10 -N 20 +thp04_3 thp04 -n 1 -N 300 vma01 vma01 vma02 vma02
testcases/kernel/mem/include/mem.h +11 -0
@@ -32,6 +32,17 @@ void testoom(int mempolicy, int lite);#define PATH_KSM "/sys/kernel/mm/ksm/" +/* THP */ + +#define PATH_THP "/sys/kernel/mm/transparent_hugepage/" +#define PATH_KHPD PATH_THP "khugepaged/" + +int opt_nr_children, opt_nr_thps; +char *opt_nr_children_str, *opt_nr_thps_str; +void test_transparent_hugepage (int nr_children,int nr_thps,int hg_aligned); +void check_thp_options (int *nr_children,int *nr_thps); +void thp_usage (void ); +/* HUGETLB */ #define PATH_SHMMAX "/proc/sys/kernel/shmmax"
testcases/kernel/mem/lib/mem.c +188 -0
194 lines not on this page · raw message
testcases/kernel/mem/thp/thp04.c new file +142 -0
142 lines not on this page · raw message
Signature · 13 lines
1.7.11.7 ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v4 2/3 lib/mem: introduce a new function set_global_mempolicy()
Fork out a new function set_global_mempolicy() from the previous testoom() func, which will be useful for other func.
--- testcases/kernel/mem/include/mem.h | 3 ++- testcases/kernel/mem/lib/mem.c | 13 +++++++++++-- testcases/kernel/mem/thp/thp04.c | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-)
testcases/kernel/mem/include/mem.h +2 -1
@@ -39,7 +39,8 @@ void testoom(int mempolicy, int lite);int opt_nr_children, opt_nr_thps;char *opt_nr_children_str, *opt_nr_thps_str; -void test_transparent_hugepage (int nr_children,int nr_thps,int hg_aligned); +void test_transparent_hugepage (int nr_children,int nr_thps, +int hg_aligned,int mempolicy);void check_thp_options (int *nr_children,int *nr_thps);void thp_usage (void );
testcases/kernel/mem/lib/mem.c +11 -2
@@ -91,7 +91,7 @@ void oom(int testcase, int lite) } } -void testoom (int mempolicy,int lite) +static void set_global_mempolicy (int mempolicy) {#if HAVE_NUMA_H &&HAVE_LINUX_MEMPOLICY_H &&HAVE_NUMAIF_H \ &&HAVE_MPOL_CONSTANTS
@@ -133,6 +133,11 @@ void testoom(int mempolicy, int lite) tst_brkm(TBROK|TERRNO, cleanup, "set_mempolicy"); }#endif +} + +void testoom (int mempolicy,int lite) +{ +set_global_mempolicy (mempolicy);tst_resm (TINFO ,"start normal OOM testing." );oom (NORMAL , lite);
@@ -613,12 +618,16 @@ static void verify_thp_size(int *children, int nr_children, int nr_thps) } } -void test_transparent_hugepage (int nr_children,int nr_thps,int hg_aligned) +void test_transparent_hugepage (int nr_children,int nr_thps, +int hg_aligned,int mempolicy) {unsigned long hugepagesize, memfree;int i, *pids, ret, status;char path[BUFSIZ ]; +if (mempolicy) +set_global_mempolicy (mempolicy); + memfree =read_meminfo ("MemFree:" );tst_resm (TINFO ,"The current MemFree is %luMB" , memfree /KB );if (memfree <MB )
testcases/kernel/mem/thp/thp04.c +1 -1
@@ -83,7 +83,7 @@ int main(int argc, char *argv[])for (lc =0 ;TEST_LOOPING (lc); lc++) { tst_count =0 ; -test_transparent_hugepage (nr_children, nr_thps,1 ); +test_transparent_hugepage (nr_children, nr_thps,1 ,0 ); }cleanup ();
Signature · 13 lines
1.7.11.7 ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v4 3/3 mm/thp: add new case thp05
added new case thp05, which is used to test transparent hugepage under mempolicy - NUMA.
--- runtest/mm | 3 + testcases/kernel/mem/thp/thp05.c | 153 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 testcases/kernel/mem/thp/thp05.c
runtest/mm +3 -0
@@ -87,6 +87,9 @@ thp03 thp03 thp04_1 thp04 thp04_2 thp04 -n 10 -N 20 thp04_3 thp04 -n 1 -N 300 +thp05_1 thp05 +thp05_2 thp05 -n 10 -N 20 +thp05_3 thp05 -n 1 -N 300 vma01 vma01 vma02 vma02
testcases/kernel/mem/thp/thp05.c new file +153 -0
153 lines not on this page · raw message
Signature · 13 lines
1.7.11.7 ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Wanlong Gao
AppliedQuoted 24 lines · Zhouping Liu
The patchset is desinged to test THP functionality.
when one process allocate hugepage aligned anonymous pages, kernel thread 'khugepaged' controlled by sysfs knobs
/sys/kernel/mm/transparent_hugepage/*will scan them, and make them as transparent hugepage if they are suited, you can find out how many transparent hugepages are there in one process from /proc/<pid>/smaps, among the file contents, 'AnonHugePages' entry stand for transparent hugepage.v1 to v2:
accepted Wanlong's suggestion, added some comment for '10s' added 'static' key word for single-file-only variant.v2 to v3:
added some comments for low memory system.v3 to v4:
Wanglong point out that the value of khugepaged/defrag is string type, not a numeric before applying the commite27e6151b154in v2.6.39-rc4, and I checked the code again, found the current cases thp0* don't be effected by khugepaged/defrag, so I removed the checking of khugepaged/defrag fromkhugepaged_scan_done().
Quoted 7 lines
v4 to v5:
1. made some cleaup
2. updated 10s to 5s for each checking inkhugepaged_scan_done()
3. used SAFE_FILE_SCANF|PRINTF() instead ofwrite_file()v5 to v6:
made a little cleanup.
Applied this V6, thank you.
You may use the wrong --subject-prefix
Wanlong Gao
Quoted 6 lines
Zhouping Liu (3):
mm/thp: new casethp04.c
lib/mem: introduce a new functionset_global_mempolicy()mm/thp: add new case thp05
Quoted 9 lines
runtest/mm | 6 ++ testcases/kernel/mem/include/mem.h | 12 +++ testcases/kernel/mem/lib/mem.c | 199 ++++++++++++++++++++++++++++++++++++- testcases/kernel/mem/thp/thp04.c | 142 ++++++++++++++++++++++++++ testcases/kernel/mem/thp/thp05.c | 153 ++++++++++++++++++++++++++++ 5 files changed, 511 insertions(+), 1 deletion(-) create mode 100644 testcases/kernel/mem/thp/thp04.c create mode 100644 testcases/kernel/mem/thp/thp05.c
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
----- Original Message -----
Quoted 36 lines
From: "Wanlong Gao" <[email protected]>
To: "Zhouping Liu" <[email protected]>
Cc: "LTP List" <[email protected]>
Sent: Wednesday, April 17, 2013 11:26:43 AM
Subject: Re: [LTP] [PATCH v5 0/3] mm/thp: add two new caseQuoted 29 lines · Zhouping Liu
The patchset is desinged to test THP functionality.
when one process allocate hugepage aligned anonymous pages, kernel thread 'khugepaged' controlled by sysfs knobs
/sys/kernel/mm/transparent_hugepage/*will scan them, and make them as transparent hugepage if they are suited, you can find out how many transparent hugepages are there in one process from /proc/<pid>/smaps, among the file contents, 'AnonHugePages' entry stand for transparent hugepage.v1 to v2:
accepted Wanlong's suggestion, added some comment for '10s' added 'static' key word for single-file-only variant.v2 to v3:
added some comments for low memory system.v3 to v4:
Wanglong point out that the value of khugepaged/defrag is string type, not a numeric before applying the commite27e6151b154in v2.6.39-rc4, and I checked the code again, found the current cases thp0* don't be effected by khugepaged/defrag, so I removed the checking of khugepaged/defrag fromkhugepaged_scan_done().v4 to v5:
1. made some cleaup
2. updated 10s to 5s for each checking inkhugepaged_scan_done()
3. used SAFE_FILE_SCANF|PRINTF() instead ofwrite_file()
Quoted 6 lines
Quoted 2 lines
v5 to v6:
made a little cleanup.Applied this V6, thank you.
You may use the wrong --subject-prefix
yeah, thanks for your friendly correcting, I used the history command :(
Signature · 13 lines
Thanks, Zhouping ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list