Skip to contentSkip to conversation

Add a test program for variable page sizes in mmap/shmget v2

PATCH In review Andi Kleen 4 participants 6 messages Nov 8, 2012 – Nov 12, 2012

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Add a test program for variable page sizes in mmap/shmget v2

From: Andi Kleen <[email protected]>

Not hooked up to the harness so far, because it usually needs special boot options for 1GB pages.

v2: Add more sanity checks. Disable debug output. Improve comment.
Delete shm segment by default.

---
 tools/testing/selftests/vm/Makefile    |    4 +-
 tools/testing/selftests/vm/thuge-gen.c |  254 ++++++++++++++++++++++++++++++++
 2 files changed, 256 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/vm/thuge-gen.c
tools/testing/selftests/vm/Makefile +2 -2
index b336b24..7300d07 100644
@@ -1,9 +1,9 @@
 # Makefile for vm selftests
 
 CC = $(CROSS_COMPILE)gcc
-CFLAGS = -Wall -Wextra
+CFLAGS = -Wall
 
-all: hugepage-mmap hugepage-shm  map_hugetlb
+all: hugepage-mmap hugepage-shm  map_hugetlb thuge-gen
 %: %.c
 	$(CC) $(CFLAGS) -o $@ $^
 
tools/testing/selftests/vm/thuge-gen.c new file +254 -0

254 lines not on this page · raw message

Signature · 7 lines
1.7.7.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer
#1 lore raw
Quoted 4 lines · On Thu, 8 Nov 2012 13:01:26 -0800 Andi Kleen <[email protected]> wrote:

From: Andi Kleen <[email protected]>

Not hooked up to the harness so far, because it usually needs special boot options for 1GB pages.

This isn't the case from my reading: we *can* hook it up now?

tools/testing/selftests/vm/Makefile line 4

Quoted 9 lines

index b336b24..7300d07 100644

tools/testing/selftests/vm/Makefile +1 -1
@@ -1,9 +1,9 @@
 # Makefile for vm selftests
 
 CC = $(CROSS_COMPILE)gcc
-CFLAGS = -Wall -Wextra
+CFLAGS = -Wall

Why this? It doesn't change anything with my gcc so I think I'll revert that.

Quoted 3 lines

...

Also...

I just tried a `make run_vmtests' and it fell on its face. There's a little comment in there saying "please run as root", but we don't *want* that. The selftests should be runnable as non-root and should, where unavoidable, emit a warning and proceed if elevated permissions are required.

I tried running it as root and my workstation hung, requiring a reboot. Won't be doing that again.

Dave, could you please have a dig at this sometime?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 9 lines · Andrew Morton
Quoted 4 lines · On Thu, 8 Nov 2012 13:01:26 -0800 Andi Kleen <[email protected]> wrote:

From: Andi Kleen <[email protected]>

Not hooked up to the harness so far, because it usually needs special boot options for 1GB pages.

This isn't the case from my reading: we *can* hook it up now?

Yes, but also need to set the sysctls.

Quoted 6 lines
Quoted 6 lines

index b336b24..7300d07 100644

tools/testing/selftests/vm/Makefile +0 -0
@@ -1,9 +1,9 @@
 # Makefile for vm selftests
 
Quoted 6 lines

tools/testing/selftests/vm/Makefile line 4

Quoted 3 lines
tools/testing/selftests/vm/Makefile +1 -1
 CC = $(CROSS_COMPILE)gcc
-CFLAGS = -Wall -Wextra
+CFLAGS = -Wall

Why this? It doesn't change anything with my gcc so I think I'll revert that.

There were lots of warnings with signed/unsigned comparisons on my gcc (4.6) and since I personally consider those useless I just disabled the warning.

Quoted 6 lines

I just tried a `make run_vmtests' and it fell on its face. There's a little comment in there saying "please run as root", but we don't *want* that. The selftests should be runnable as non-root and should, where unavoidable, emit a warning and proceed if elevated permissions are required.

My test requires root. That is only the ipc test requires root. To be honest I have no idea why but I don't claim to understand why ipcperms() does all the weird stuff it does.

Quoted 3 lines

I tried running it as root and my workstation hung, requiring a reboot. Won't be doing that again.

My test system didn't hang FWIW.

-Andi

Signature · 7 lines
[email protected] -- Speaking for myself only

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer
#3 lore raw
Quoted 4 lines · On Thu, 8 Nov 2012 14:01:50 -0800 Andi Kleen <[email protected]> wrote:
Quoted 3 lines · Andrew Morton

On Thu, 8 Nov 2012 13:01:26 -0800
Andi Kleen <[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

From: Andi Kleen <[email protected]>

Not hooked up to the harness so far, because it usually needs special boot options for 1GB pages.

This isn't the case from my reading: we *can* hook it up now?

Yes, but also need to set the sysctls.

That doesn't sound terribly involved?

Quoted 13 lines
Quoted 6 lines
Quoted 6 lines

index b336b24..7300d07 100644

tools/testing/selftests/vm/Makefile +0 -0
@@ -1,9 +1,9 @@
 # Makefile for vm selftests
 
Quoted 6 lines

tools/testing/selftests/vm/Makefile line 4

Quoted 3 lines
tools/testing/selftests/vm/Makefile +1 -1
 CC = $(CROSS_COMPILE)gcc
-CFLAGS = -Wall -Wextra
+CFLAGS = -Wall

Why this? It doesn't change anything with my gcc so I think I'll revert that.

Quoted 3 lines

There were lots of warnings with signed/unsigned comparisons on my gcc (4.6) and since I personally consider those useless I just disabled the warning.

eh, OK, I'll update the changelog.

Quoted 13 lines
Quoted 6 lines

I just tried a `make run_vmtests' and it fell on its face. There's a little comment in there saying "please run as root", but we don't *want* that. The selftests should be runnable as non-root and should, where unavoidable, emit a warning and proceed if elevated permissions are required.

My test requires root. That is only the ipc test requires root. To be honest I have no idea why but I don't claim to understand why ipcperms() does all the weird stuff it does.

Quoted 1 line
Quoted 4 lines
Quoted 2 lines

I tried running it as root and my workstation hung, requiring a reboot. Won't be doing that again.

My test system didn't hang FWIW.

It wasn't thuge-gen which hung. It happened really early in run_vmtests, perhaps setting nr_hugepages.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
Quoted 4 lines
Quoted 1 line

My test system didn't hang FWIW.

It wasn't thuge-gen which hung. It happened really early in run_vmtests, perhaps setting nr_hugepages.

I mean it didn't hang for the full script.

Ah this causes compaction so if you have a lot of fragmented memory it may run for a lot time with very long latencies, but inhibiting page faults of other processes.

It probably would have recovered.

it's a general problem that others are complaining about too.

-Andi

Signature · 7 lines
[email protected] -- Speaking for myself only

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#5 lore raw
In reply to Andrew Morton
Quoted 27 lines · Andrew Morton
Quoted 4 lines · On Thu, 8 Nov 2012 13:01:26 -0800 Andi Kleen <[email protected]> wrote:

From: Andi Kleen <[email protected]>

Not hooked up to the harness so far, because it usually needs special boot options for 1GB pages.

This isn't the case from my reading: we *can* hook it up now?

tools/testing/selftests/vm/Makefile line 4

Quoted 9 lines

index b336b24..7300d07 100644

tools/testing/selftests/vm/Makefile +1 -1
@@ -1,9 +1,9 @@
 # Makefile for vm selftests
 
 CC = $(CROSS_COMPILE)gcc
-CFLAGS = -Wall -Wextra
+CFLAGS = -Wall

Why this? It doesn't change anything with my gcc so I think I'll revert that.

Quoted 3 lines

...

Quoted 7 lines

Also...

I just tried a `make run_vmtests' and it fell on its face. There's a little comment in there saying "please run as root", but we don't *want* that. The selftests should be runnable as non-root and should, where unavoidable, emit a warning and proceed if elevated permissions are required.

Hi andrew:
below code need root, I agree warning in case non-root is good, If you like I can fix it.

echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages

Quoted 5 lines

I tried running it as root and my workstation hung, requiring a reboot. Won't be doing that again.

Dave, could you please have a dig at this sometime?

I can not reproduce the hang, will keep an eye on this.

Signature · 8 lines
Thanks
Dave

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>