Skip to contentSkip to conversation

syscalls/setrlimit06: lower RLIMIT_CPU parameters

PATCH New Jan Stancek 3 participants 8 messages Feb 10, 2020 – Feb 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/setrlimit06: lower RLIMIT_CPU parameters

Lower the parameters so that test completes faster where possible.

This also increases alarm timer slightly, which in combination with lower RLIMIT_CPU aims to avoid false positives in environments with high steal time, where it can take multiple of wall clock seconds to spend single second on a cpu.

---
 testcases/kernel/syscalls/setrlimit/setrlimit06.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/setrlimit/setrlimit06.c +3 -3
index 726b26841583..3e5bf1d4253d 100644
@@ -59,8 +59,8 @@ static void verify_setrlimit(void)
 	pid = SAFE_FORK();
 	if (!pid) {
 		struct rlimit rlim = {
-			.rlim_cur = 2,
-			.rlim_max = 3,
+			.rlim_cur = 1,
+			.rlim_max = 2,
 		};
 
 		TEST(setrlimit(RLIMIT_CPU, &rlim));
@@ -70,7 +70,7 @@ static void verify_setrlimit(void)
 			exit(1);
 		}
 
-		alarm(10);
+		alarm(20);
 
 		while (1);
 	}
Signature · 1 line
2.18.1
#1 lore raw

PATCH 1/1 syscalls/setrlimit06: lower RLIMIT_CPU parameters

Hi Jan,

It looks good to me and thanks a lot for your improvement. :-)

Best Regards,

Xiao Yang

Quoted 36 lines · Jan Stancek

Lower the parameters so that test completes faster where possible.

This also increases alarm timer slightly, which in combination with lower RLIMIT_CPU aims to avoid false positives in environments with high steal time, where it can take multiple of wall clock seconds to spend single second on a cpu.

---
  testcases/kernel/syscalls/setrlimit/setrlimit06.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/setrlimit/setrlimit06.c +3 -3
index 726b26841583..3e5bf1d4253d 100644
@@ -59,8 +59,8 @@ static void verify_setrlimit(void)
  	pid = SAFE_FORK();
  	if (!pid) {
  		struct rlimit rlim = {
-			.rlim_cur = 2,
-			.rlim_max = 3,
+			.rlim_cur = 1,
+			.rlim_max = 2,
  		};
 
  		TEST(setrlimit(RLIMIT_CPU, &rlim));
@@ -70,7 +70,7 @@ static void verify_setrlimit(void)
  			exit(1);
  		}
 
-		alarm(10);
+		alarm(20);
 
  		while (1);
  	}
#2 lore raw

PATCH 1/1 syscalls/setrlimit06: lower RLIMIT_CPU parameters

In reply to Jan Stancek
Quoted 7 lines · Jan Stancek

Lower the parameters so that test completes faster where possible.

This also increases alarm timer slightly, which in combination with lower RLIMIT_CPU aims to avoid false positives in environments with high steal time, where it can take multiple of wall clock seconds to spend single second on a cpu.

This patch could reduce the test failure possibility, but I'm afraid it can't fix the problem radically, because with `stress -c 20' to overload an s390x system(2cpus) in the background then setrlimit06(patched) still easily gets failed:
setrlimit06.c:98: FAIL: Got only SIGXCPU after reaching both limit

Another way I can think of is to raise the priority before its running, not sure if that will disturb the original test but from my test, it always gets a pass even with too much overload.

testcases/kernel/syscalls/setrlimit/setrlimit06.c +4 -0
@@ -25,6 +25,7 @@
 #include <sys/wait.h>
 #include <stdlib.h>
 #include <sys/mman.h>
+#include <sys/resource.h>
 
 #include "tst_test.h"
 
@@ -37,6 +38,8 @@ static void sighandler(int sig)
 
 static void setup(void)
 {
+       setpriority(PRIO_PROCESS, 0, -20);
+
        SAFE_SIGNAL(SIGXCPU, sighandler);
 
        end = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE,
@@ -110,6 +113,7 @@ static void verify_setrlimit(void)
 }
 
 static struct tst_test test = {
+       .needs_root = 1,
        .test_all = verify_setrlimit,
        .setup = setup,
        .cleanup = cleanup,
Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200211/df7aaa60/attachment.htm>
#3 lore raw

PATCH 1/1 syscalls/setrlimit06: lower RLIMIT_CPU parameters

----- Original Message -----

Quoted 16 lines · Jan Stancek
Quoted 8 lines

Lower the parameters so that test completes faster where possible.

This also increases alarm timer slightly, which in combination with lower RLIMIT_CPU aims to avoid false positives in environments with high steal time, where it can take multiple of wall clock seconds to spend single second on a cpu.

This patch could reduce the test failure possibility, but I'm afraid it can't fix the problem radically, because with `stress -c 20' to overload an s390x system(2cpus) in the background then setrlimit06(patched) still easily gets failed:
setrlimit06.c:98: FAIL: Got only SIGXCPU after reaching both limit

Quoted 3 lines

Another way I can think of is to raise the priority before its running, not sure if that will disturb the original test but from my test, it always gets a pass even with too much overload.

Is this in addition to my patch? Because on its own I don't see how this will help when load is coming from different guests.

Quoted 33 lines
testcases/kernel/syscalls/setrlimit/setrlimit06.c +4 -1
@@ -25,6 +25,7 @@
 #include <sys/wait.h>
 #include <stdlib.h>
 #include <sys/mman.h>
+#include <sys/resource.h>
 
 #include "tst_test.h"
 
@@ -37,6 +38,8 @@ static void sighandler(int sig)
 
 static void setup(void)
 {
+       setpriority(PRIO_PROCESS, 0, -20);
+
        SAFE_SIGNAL(SIGXCPU, sighandler);
 
        end = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE,
@@ -110,6 +113,7 @@ static void verify_setrlimit(void)
 }
 
 static struct tst_test test = {
+       .needs_root = 1,
        .test_all = verify_setrlimit,
        .setup = setup,
        .cleanup = cleanup,
 
--

Regards,
Li Wang

#4 lore raw

PATCH 1/1 syscalls/setrlimit06: lower RLIMIT_CPU parameters

Quoted 20 lines · Jan Stancek

----- Original Message -----

Quoted 12 lines · Jan Stancek
Quoted 8 lines

Lower the parameters so that test completes faster where possible.

This also increases alarm timer slightly, which in combination with lower RLIMIT_CPU aims to avoid false positives in environments with high steal time, where it can take multiple of wall clock seconds to spend single second on a cpu.

This patch could reduce the test failure possibility, but I'm afraid it can't fix the problem radically, because with `stress -c 20' to overload

an

Quoted 4 lines

s390x system(2cpus) in the background then setrlimit06(patched) still easily gets failed:
setrlimit06.c:98: FAIL: Got only SIGXCPU after reaching both limit

Quoted 8 lines
Quoted 1 line

Another way I can think of is to raise the priority before its running,

not

Quoted 2 lines

sure if that will disturb the original test but from my test, it always gets a pass even with too much overload.

Is this in addition to my patch? Because on its own I don't see how this will help when load is coming from different guests.

Yes, this is only solving for itself loads. Besides the high steal time, that's another reason I guess it causes the same failure, so do you think it makes sense to merge two methods together?

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200211/e6aadb11/attachment.htm>
#5 lore raw

PATCH 1/1 syscalls/setrlimit06: lower RLIMIT_CPU parameters

----- Original Message -----

Quoted 27 lines · Jan Stancek
Quoted 26 lines

----- Original Message -----

Quoted 12 lines · Jan Stancek
Quoted 8 lines

Lower the parameters so that test completes faster where possible.

This also increases alarm timer slightly, which in combination with lower RLIMIT_CPU aims to avoid false positives in environments with high steal time, where it can take multiple of wall clock seconds to spend single second on a cpu.

This patch could reduce the test failure possibility, but I'm afraid it can't fix the problem radically, because with `stress -c 20' to overload

an

Quoted 5 lines

s390x system(2cpus) in the background then setrlimit06(patched) still easily gets failed:
setrlimit06.c:98: FAIL: Got only SIGXCPU after reaching both limit

Another way I can think of is to raise the priority before its running,

not

Quoted 2 lines

sure if that will disturb the original test but from my test, it always gets a pass even with too much overload.

Quoted 7 lines
Quoted 3 lines

Is this in addition to my patch? Because on its own I don't see how this will help when load is coming from different guests.

Yes, this is only solving for itself loads. Besides the high steal time, that's another reason I guess it causes the same failure, so do you think it makes sense to merge two methods together?

For now I'd go with just original patch. Until there is parallel test execution, there shouldn't be any local load during this test.

#6 lore raw

PATCH 1/1 syscalls/setrlimit06: lower RLIMIT_CPU parameters

Quoted 41 lines · Jan Stancek

----- Original Message -----

Quoted 6 lines · Jan Stancek
Quoted 5 lines

----- Original Message -----

Quoted 1 line

On Mon, Feb 10, 2020 at 8:47 PM Jan Stancek <[email protected]>

Quoted 10 lines · wrote:
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines

Lower the parameters so that test completes faster where possible.

This also increases alarm timer slightly, which in combination with lower RLIMIT_CPU aims to avoid false positives in environments with high steal time, where it can take multiple of wall clock seconds to spend single second on a cpu.

This patch could reduce the test failure possibility, but I'm afraid

it

Quoted 1 line
Quoted 1 line
Quoted 1 line

can't fix the problem radically, because with `stress -c 20' to

overload

Quoted 4 lines
Quoted 4 lines

an

Quoted 3 lines

s390x system(2cpus) in the background then setrlimit06(patched) still easily gets failed:
setrlimit06.c:98: FAIL: Got only SIGXCPU after reaching both

limit

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Another way I can think of is to raise the priority before its

running,

Quoted 2 lines
Quoted 2 lines

not

Quoted 1 line

sure if that will disturb the original test but from my test, it

always

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

gets a pass even with too much overload.

Is this in addition to my patch? Because on its own I don't see how

this

Quoted 3 lines
Quoted 2 lines

will help when load is coming from different guests.

Quoted 8 lines
Quoted 3 lines

Yes, this is only solving for itself loads. Besides the high steal time, that's another reason I guess it causes the same failure, so do you think it makes sense to merge two methods together?

For now I'd go with just original patch. Until there is parallel test execution,
there shouldn't be any local load during this test.

Ok sure. Let's apply the original first, then keep watching the status in the next testing.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200211/61b15011/attachment.htm>
#7 lore raw

PATCH 1/1 syscalls/setrlimit06: lower RLIMIT_CPU parameters

----- Original Message -----

Quoted 2 lines

Ok sure. Let's apply the original first, then keep watching the status in the next testing.

Pushed.