* [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
@ 2015-12-28 7:20 Han Pingtian
0 siblings, 0 replies; 8+ messages in thread
From: Han Pingtian @ 2015-12-28 7:20 UTC (permalink / raw)
To: ltp-list
Looks like there is no such a case "OVERCOMMIT" in oom(), so we can just
remove it.
Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
---
testcases/kernel/mem/include/mem.h | 7 +++----
testcases/kernel/mem/lib/mem.c | 2 +-
testcases/kernel/mem/oom/oom01.c | 4 ++--
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index 4a18799..041c437 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -32,10 +32,9 @@ static inline void clean_node(unsigned long *array)
#define LENGTH (3UL<<30)
#define TESTMEM (1UL<<30)
-#define OVERCOMMIT 1
-#define NORMAL 2
-#define MLOCK 3
-#define KSM 4
+#define NORMAL 1
+#define MLOCK 2
+#define KSM 3
long overcommit;
void oom(int testcase, int lite, int retcode, int allow_sigkill);
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index cee4e91..56104cb 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -110,7 +110,7 @@ out:
* oom - allocates memory according to specified testcase and checks
* desired outcome (e.g. child killed, operation failed with ENOMEM)
* @testcase: selects how child allocates memory
- * valid choices are: OVERCOMMIT, NORMAL, MLOCK and KSM
+ * valid choices are: NORMAL, MLOCK and KSM
* @lite: if non-zero, child makes only single TESTMEM+MB allocation
* if zero, child keeps allocating memory until it gets killed
* or some operation fails
diff --git a/testcases/kernel/mem/oom/oom01.c b/testcases/kernel/mem/oom/oom01.c
index 712d7b5..e39394b 100644
--- a/testcases/kernel/mem/oom/oom01.c
+++ b/testcases/kernel/mem/oom/oom01.c
@@ -58,12 +58,12 @@ int main(int argc, char *argv[])
/* we expect mmap to fail before OOM is hit */
set_sys_tune("overcommit_memory", 2, 1);
- oom(OVERCOMMIT, 0, ENOMEM, 0);
+ oom(NORMAL, 0, ENOMEM, 0);
/* with overcommit_memory set to 0 or 1 there's no
* guarantee that mmap fails before OOM */
set_sys_tune("overcommit_memory", 0, 1);
- oom(OVERCOMMIT, 0, ENOMEM, 1);
+ oom(NORMAL, 0, ENOMEM, 1);
set_sys_tune("overcommit_memory", 1, 1);
testoom(0, 0, ENOMEM, 1);
--
1.9.3
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
@ 2015-12-28 7:49 Han Pingtian
2016-01-07 11:57 ` Jan Stancek
2016-01-26 14:14 ` Cyril Hrubis
0 siblings, 2 replies; 8+ messages in thread
From: Han Pingtian @ 2015-12-28 7:49 UTC (permalink / raw)
To: ltp
Looks like there is no such a case "OVERCOMMIT" in oom(), so we can just
remove it.
Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
---
testcases/kernel/mem/include/mem.h | 7 +++----
testcases/kernel/mem/lib/mem.c | 2 +-
testcases/kernel/mem/oom/oom01.c | 4 ++--
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index 4a18799..041c437 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -32,10 +32,9 @@ static inline void clean_node(unsigned long *array)
#define LENGTH (3UL<<30)
#define TESTMEM (1UL<<30)
-#define OVERCOMMIT 1
-#define NORMAL 2
-#define MLOCK 3
-#define KSM 4
+#define NORMAL 1
+#define MLOCK 2
+#define KSM 3
long overcommit;
void oom(int testcase, int lite, int retcode, int allow_sigkill);
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index cee4e91..56104cb 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -110,7 +110,7 @@ out:
* oom - allocates memory according to specified testcase and checks
* desired outcome (e.g. child killed, operation failed with ENOMEM)
* @testcase: selects how child allocates memory
- * valid choices are: OVERCOMMIT, NORMAL, MLOCK and KSM
+ * valid choices are: NORMAL, MLOCK and KSM
* @lite: if non-zero, child makes only single TESTMEM+MB allocation
* if zero, child keeps allocating memory until it gets killed
* or some operation fails
diff --git a/testcases/kernel/mem/oom/oom01.c b/testcases/kernel/mem/oom/oom01.c
index 712d7b5..e39394b 100644
--- a/testcases/kernel/mem/oom/oom01.c
+++ b/testcases/kernel/mem/oom/oom01.c
@@ -58,12 +58,12 @@ int main(int argc, char *argv[])
/* we expect mmap to fail before OOM is hit */
set_sys_tune("overcommit_memory", 2, 1);
- oom(OVERCOMMIT, 0, ENOMEM, 0);
+ oom(NORMAL, 0, ENOMEM, 0);
/* with overcommit_memory set to 0 or 1 there's no
* guarantee that mmap fails before OOM */
set_sys_tune("overcommit_memory", 0, 1);
- oom(OVERCOMMIT, 0, ENOMEM, 1);
+ oom(NORMAL, 0, ENOMEM, 1);
set_sys_tune("overcommit_memory", 1, 1);
testoom(0, 0, ENOMEM, 1);
--
1.9.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
2015-12-28 7:49 Han Pingtian
@ 2016-01-07 11:57 ` Jan Stancek
2016-01-07 14:54 ` Cyril Hrubis
2016-01-08 6:59 ` Han Pingtian
2016-01-26 14:14 ` Cyril Hrubis
1 sibling, 2 replies; 8+ messages in thread
From: Jan Stancek @ 2016-01-07 11:57 UTC (permalink / raw)
To: ltp
----- Original Message -----
> From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> To: ltp@lists.linux.it
> Sent: Monday, 28 December, 2015 8:49:19 AM
> Subject: [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
>
> Looks like there is no such a case "OVERCOMMIT" in oom(), so we can just
> remove it.
>
> Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Looks good to me, regards,
Jan
> ---
> testcases/kernel/mem/include/mem.h | 7 +++----
> testcases/kernel/mem/lib/mem.c | 2 +-
> testcases/kernel/mem/oom/oom01.c | 4 ++--
> 3 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/testcases/kernel/mem/include/mem.h
> b/testcases/kernel/mem/include/mem.h
> index 4a18799..041c437 100644
> --- a/testcases/kernel/mem/include/mem.h
> +++ b/testcases/kernel/mem/include/mem.h
> @@ -32,10 +32,9 @@ static inline void clean_node(unsigned long *array)
>
> #define LENGTH (3UL<<30)
> #define TESTMEM (1UL<<30)
> -#define OVERCOMMIT 1
> -#define NORMAL 2
> -#define MLOCK 3
> -#define KSM 4
> +#define NORMAL 1
> +#define MLOCK 2
> +#define KSM 3
>
> long overcommit;
> void oom(int testcase, int lite, int retcode, int allow_sigkill);
> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index cee4e91..56104cb 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -110,7 +110,7 @@ out:
> * oom - allocates memory according to specified testcase and checks
> * desired outcome (e.g. child killed, operation failed with ENOMEM)
> * @testcase: selects how child allocates memory
> - * valid choices are: OVERCOMMIT, NORMAL, MLOCK and KSM
> + * valid choices are: NORMAL, MLOCK and KSM
> * @lite: if non-zero, child makes only single TESTMEM+MB allocation
> * if zero, child keeps allocating memory until it gets killed
> * or some operation fails
> diff --git a/testcases/kernel/mem/oom/oom01.c
> b/testcases/kernel/mem/oom/oom01.c
> index 712d7b5..e39394b 100644
> --- a/testcases/kernel/mem/oom/oom01.c
> +++ b/testcases/kernel/mem/oom/oom01.c
> @@ -58,12 +58,12 @@ int main(int argc, char *argv[])
>
> /* we expect mmap to fail before OOM is hit */
> set_sys_tune("overcommit_memory", 2, 1);
> - oom(OVERCOMMIT, 0, ENOMEM, 0);
> + oom(NORMAL, 0, ENOMEM, 0);
>
> /* with overcommit_memory set to 0 or 1 there's no
> * guarantee that mmap fails before OOM */
> set_sys_tune("overcommit_memory", 0, 1);
> - oom(OVERCOMMIT, 0, ENOMEM, 1);
> + oom(NORMAL, 0, ENOMEM, 1);
>
> set_sys_tune("overcommit_memory", 1, 1);
> testoom(0, 0, ENOMEM, 1);
> --
> 1.9.3
>
>
> --
> Mailing list info: http://lists.linux.it/listinfo/ltp
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
2016-01-07 11:57 ` Jan Stancek
@ 2016-01-07 14:54 ` Cyril Hrubis
2016-01-08 6:59 ` Han Pingtian
1 sibling, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2016-01-07 14:54 UTC (permalink / raw)
To: ltp
Hi!
> Reviewed-by: Jan Stancek <jstancek@redhat.com>
>
> Looks good to me, regards,
Looks correct to me as well.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
2016-01-07 11:57 ` Jan Stancek
2016-01-07 14:54 ` Cyril Hrubis
@ 2016-01-08 6:59 ` Han Pingtian
2016-01-08 7:42 ` Jan Stancek
1 sibling, 1 reply; 8+ messages in thread
From: Han Pingtian @ 2016-01-08 6:59 UTC (permalink / raw)
To: ltp
On Thu, Jan 07, 2016 at 06:57:20AM -0500, Jan Stancek wrote:
>
>
> ----- Original Message -----
> > From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> > To: ltp@lists.linux.it
> > Sent: Monday, 28 December, 2015 8:49:19 AM
> > Subject: [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
> >
> > Looks like there is no such a case "OVERCOMMIT" in oom(), so we can just
> > remove it.
> >
> > Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
>
> Reviewed-by: Jan Stancek <jstancek@redhat.com>
>
> Looks good to me, regards,
> Jan
>
Hi Jan,
Thanks for reviewing! I have another question: I think when
"overcommit_memory" being set to 1, mmap() will always succeed. It's
that correct? I read the code of kernel, looks like in
__vm_enough_memory(), if sysctl_overcommit_memory == OVERCOMMIT_ALWAYS,
it will always return 0. So I think in oom01.c, we should call the
testoom() as testoom(0, 0, 0, 1).
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
2016-01-08 6:59 ` Han Pingtian
@ 2016-01-08 7:42 ` Jan Stancek
2016-01-11 6:08 ` Han Pingtian
0 siblings, 1 reply; 8+ messages in thread
From: Jan Stancek @ 2016-01-08 7:42 UTC (permalink / raw)
To: ltp
----- Original Message -----
> From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Friday, 8 January, 2016 7:59:41 AM
> Subject: Re: [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
>
> On Thu, Jan 07, 2016 at 06:57:20AM -0500, Jan Stancek wrote:
> >
> >
> > ----- Original Message -----
> > > From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> > > To: ltp@lists.linux.it
> > > Sent: Monday, 28 December, 2015 8:49:19 AM
> > > Subject: [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from
> > > oom()
> > >
> > > Looks like there is no such a case "OVERCOMMIT" in oom(), so we can just
> > > remove it.
> > >
> > > Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
> >
> > Reviewed-by: Jan Stancek <jstancek@redhat.com>
> >
> > Looks good to me, regards,
> > Jan
> >
> Hi Jan,
>
> Thanks for reviewing! I have another question: I think when
> "overcommit_memory" being set to 1, mmap() will always succeed. It's
> that correct? I read the code of kernel, looks like in
> __vm_enough_memory(), if sysctl_overcommit_memory == OVERCOMMIT_ALWAYS,
> it will always return 0. So I think in oom01.c, we should call the
> testoom() as testoom(0, 0, 0, 1).
It can also fail if you reach max_map_count (or if map size is too big, but
that shouldn't be the case in this test).
This is current call in oom01:
testoom(0, 0, ENOMEM, 1);
Third parameter (retcode) does not apply only to mmap().
If you look at testoom(), it makes 3 tests:
oom(NORMAL, lite, retcode, allow_sigkill);
oom(MLOCK, lite, retcode, allow_sigkill);
oom(KSM, lite, retcode, allow_sigkill);
oom() compares that retcode to exit code of alloc_mem(),
which will exit when either of these 3 fails: mmap, mlock or madvise.
Regards,
Jan
>
>
> Thanks.
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
2016-01-08 7:42 ` Jan Stancek
@ 2016-01-11 6:08 ` Han Pingtian
0 siblings, 0 replies; 8+ messages in thread
From: Han Pingtian @ 2016-01-11 6:08 UTC (permalink / raw)
To: ltp
On Fri, Jan 08, 2016 at 02:42:18AM -0500, Jan Stancek wrote:
>
>
>
>
> ----- Original Message -----
> > From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> > To: "Jan Stancek" <jstancek@redhat.com>
> > Cc: ltp@lists.linux.it
> > Sent: Friday, 8 January, 2016 7:59:41 AM
> > Subject: Re: [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
> >
> > On Thu, Jan 07, 2016 at 06:57:20AM -0500, Jan Stancek wrote:
> > >
> > >
> > > ----- Original Message -----
> > > > From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> > > > To: ltp@lists.linux.it
> > > > Sent: Monday, 28 December, 2015 8:49:19 AM
> > > > Subject: [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from
> > > > oom()
> > > >
> > > > Looks like there is no such a case "OVERCOMMIT" in oom(), so we can just
> > > > remove it.
> > > >
> > > > Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
> > >
> > > Reviewed-by: Jan Stancek <jstancek@redhat.com>
> > >
> > > Looks good to me, regards,
> > > Jan
> > >
> > Hi Jan,
> >
> > Thanks for reviewing! I have another question: I think when
> > "overcommit_memory" being set to 1, mmap() will always succeed. It's
> > that correct? I read the code of kernel, looks like in
> > __vm_enough_memory(), if sysctl_overcommit_memory == OVERCOMMIT_ALWAYS,
> > it will always return 0. So I think in oom01.c, we should call the
> > testoom() as testoom(0, 0, 0, 1).
>
> It can also fail if you reach max_map_count (or if map size is too big, but
> that shouldn't be the case in this test).
>
> This is current call in oom01:
> testoom(0, 0, ENOMEM, 1);
>
> Third parameter (retcode) does not apply only to mmap().
> If you look at testoom(), it makes 3 tests:
> oom(NORMAL, lite, retcode, allow_sigkill);
> oom(MLOCK, lite, retcode, allow_sigkill);
> oom(KSM, lite, retcode, allow_sigkill);
>
> oom() compares that retcode to exit code of alloc_mem(),
> which will exit when either of these 3 fails: mmap, mlock or madvise.
>
Got it and thanks! I didn't know there is a vm.max_map_count.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
2015-12-28 7:49 Han Pingtian
2016-01-07 11:57 ` Jan Stancek
@ 2016-01-26 14:14 ` Cyril Hrubis
1 sibling, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2016-01-26 14:14 UTC (permalink / raw)
To: ltp
Hi!
> Looks like there is no such a case "OVERCOMMIT" in oom(), so we can just
> remove it.
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-01-26 14:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-28 7:20 [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom() Han Pingtian
-- strict thread matches above, loose matches on Subject: below --
2015-12-28 7:49 Han Pingtian
2016-01-07 11:57 ` Jan Stancek
2016-01-07 14:54 ` Cyril Hrubis
2016-01-08 6:59 ` Han Pingtian
2016-01-08 7:42 ` Jan Stancek
2016-01-11 6:08 ` Han Pingtian
2016-01-26 14:14 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox