Skip to contentSkip to conversation

move vm tools from Documentation/vm/ to tools/

PATCH In review Dave Young 7 participants 16 messages Feb 1, 2012 – Feb 3, 2012

Subsystems (2)
lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH 1/1 move vm tools from Documentation/vm/ to tools/

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

Also fixed several coding style problem.

---
 Documentation/vm/Makefile        |    8 -
 Documentation/vm/hugepage-mmap.c |   91 ----
 Documentation/vm/hugepage-shm.c  |   98 ----
 Documentation/vm/map_hugetlb.c   |   77 ---
 Documentation/vm/page-types.c    | 1100 --------------------------------------
 tools/vm/Makefile                |   11 +
 tools/vm/hugepage-mmap.c         |   91 ++++
 tools/vm/hugepage-shm.c          |   99 ++++
 tools/vm/map_hugetlb.c           |   77 +++
 tools/vm/page-types.c            | 1100 ++++++++++++++++++++++++++++++++++++++
 10 files changed, 1378 insertions(+), 1374 deletions(-)
 delete mode 100644 Documentation/vm/Makefile
 delete mode 100644 Documentation/vm/hugepage-mmap.c
 delete mode 100644 Documentation/vm/hugepage-shm.c
 delete mode 100644 Documentation/vm/map_hugetlb.c
 delete mode 100644 Documentation/vm/page-types.c
 create mode 100644 tools/vm/Makefile
 create mode 100644 tools/vm/hugepage-mmap.c
 create mode 100644 tools/vm/hugepage-shm.c
 create mode 100644 tools/vm/map_hugetlb.c
 create mode 100644 tools/vm/page-types.c
Documentation/vm/Makefile deleted +0 -8
deleted file mode 100644
index 3fa4d06..0000000
@@ -1,8 +0,0 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
-# List of programs to build
-hostprogs-y := page-types hugepage-mmap hugepage-shm map_hugetlb
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
Documentation/vm/hugepage-mmap.c deleted +0 -91

91 lines not on this page · raw message

Documentation/vm/hugepage-shm.c deleted +0 -98

98 lines not on this page · raw message

Documentation/vm/map_hugetlb.c deleted +0 -77

77 lines not on this page · raw message

Documentation/vm/page-types.c deleted +0 -1100

1,100 lines not on this page · raw message

tools/vm/Makefile new file +11 -0
new file mode 100644
index 0000000..b4f9fdd
@@ -0,0 +1,11 @@
+# Makefile for vm tools
+
+CC = $(CROSS_COMPILE)gcc
+CFLAGS = -Wall -Wextra
+
+all: page-types hugepage-mmap hugepage-shm map_hugetlb
+%: %.c
+	$(CC) $(CFLAGS) -o $@ $^
+
+clean:
+	$(RM) page-types hugepage-mmap hugepage-shm map_hugetlb
tools/vm/hugepage-mmap.c new file +91 -0

91 lines not on this page · raw message

tools/vm/hugepage-shm.c new file +99 -0

99 lines not on this page · raw message

tools/vm/map_hugetlb.c new file +77 -0

77 lines not on this page · raw message

tools/vm/page-types.c new file +1100 -0

1,100 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#1 lore raw
Quoted 3 lines · Dave Young

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

Well, hugepage-mmap, hugepage-shm, and map_hugetlb are examples, not really tools. So, only page-types is probably a tool, but I leave this to Fengguang to decide.

Quoted 2 lines

Also fixed several coding style problem.

Make it another patch for people to review. :)

[...]

Quoted 7 lines
tools/vm/Makefile new file +1 -0
new file mode 100644
index 0000000..b4f9fdd
@@ -0,0 +1,11 @@
+# Makefile for vm tools

tools/vm/Makefile line 11

Quoted 10 lines
tools/vm/Makefile new file +10 -0
+
+CC = $(CROSS_COMPILE)gcc
+CFLAGS = -Wall -Wextra
+
+all: page-types hugepage-mmap hugepage-shm map_hugetlb
+%: %.c
+	$(CC) $(CFLAGS) -o $@ $^
+
+clean:
+	$(RM) page-types hugepage-mmap hugepage-shm map_hugetlb

Is $(RM) defined?

author
#2 lore raw
Quoted 8 lines · Cong Wang
Quoted 3 lines · Dave Young

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

Well, hugepage-mmap, hugepage-shm, and map_hugetlb are examples, not really tools. So, only page-types is probably a tool, but I leave this to Fengguang to decide.

looks reasonable

Quoted 5 lines
Quoted 3 lines

Also fixed several coding style problem.

Make it another patch for people to review. :)

Will do

Quoted 13 lines

[...]

Quoted 11 lines
tools/vm/Makefile new file +5 -0
new file mode 100644
index 0000000..b4f9fdd
@@ -0,0 +1,11 @@
+# Makefile for vm tools
+
+CC = $(CROSS_COMPILE)gcc
+CFLAGS = -Wall -Wextra
+
Quoted 8 lines

tools/vm/Makefile line 11

Quoted 6 lines
tools/vm/Makefile new file +6 -0
+all: page-types hugepage-mmap hugepage-shm map_hugetlb
+%: %.c
+    $(CC) $(CFLAGS) -o $@ $^
+
+clean:
+    $(RM) page-types hugepage-mmap hugepage-shm map_hugetlb

Is $(RM) defined?

It's a predefined variables of GNU makefile, It Imply rule of 'rm -f'

Signature · 2 lines
Thanks
Dave
Acked-by on v1 1/1
#3 lore raw
In reply to Dave Young
Quoted 3 lines · Dave Young

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

For moving the code:

Quoted 1 line

Also fixed several coding style problem.

Can you please make that a separate patch?

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#4 lore raw
Quoted 5 lines · Pekka Enberg
Quoted 3 lines · Dave Young

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

Quoted 7 lines

For moving the code:

Quoted 1 line

Also fixed several coding style problem.

Can you please make that a separate patch?

Will do.

BTW, I think tools/slub/slabinfo.c should be included in tools/vm/ as well, will move it in v2 patch

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 9 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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#5 lore raw
Quoted 10 lines · Dave Young
Quoted 8 lines · Pekka Enberg
Quoted 3 lines · Dave Young

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

For moving the code:

I have no problem with the move -- actually I sent a similar patch long time ago to Andrew ;)

Will git-mv end up with a better commit?

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Also fixed several coding style problem.

Can you please make that a separate patch?

Will do.

BTW, I think tools/slub/slabinfo.c should be included in tools/vm/ as well, will move it in v2 patch

CC Christoph. Maybe not a big deal since it's already under tools/.

Thanks,
Fengguang

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw
Quoted 1 line · Wu Fengguang

Will git-mv end up with a better commit?

Just use

git format-patch -C

to generate the patch and it should be fine.

Quoted 4 lines
Quoted 2 lines

BTW, I think tools/slub/slabinfo.c should be included in tools/vm/ as well, will move it in v2 patch

CC Christoph. Maybe not a big deal since it's already under tools/.

I'm certainly fine with moving it to tools/vm.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#7 lore raw
Quoted 6 lines · Pekka Enberg
Quoted 1 line · Wu Fengguang

Will git-mv end up with a better commit?

Just use

git format-patch -C

good idea, patch looks clean with -C. So there should be no much problem for review. Also because there's also Makefile changes, I want to still send as one patch with all changes. How do you think?

Quoted 9 lines

to generate the patch and it should be fine.

Quoted 4 lines
Quoted 2 lines

BTW, I think tools/slub/slabinfo.c should be included in tools/vm/ as well, will move it in v2 patch

CC Christoph. Maybe not a big deal since it's already under tools/.

I'm certainly fine with moving it to tools/vm.

Signature · 9 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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#8 lore raw
In reply to Wu Fengguang
Quoted 8 lines · Wu Fengguang
Quoted 7 lines · Dave Young
Quoted 5 lines · Pekka Enberg
Quoted 3 lines · Dave Young

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

For moving the code:

I have no problem with the move -- actually I sent a similar patch long time ago to Andrew ;)

Good to know, then do you mind I add your signed-off line?

Quoted 22 lines

Will git-mv end up with a better commit?

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Also fixed several coding style problem.

Can you please make that a separate patch?

Will do.

BTW, I think tools/slub/slabinfo.c should be included in tools/vm/ as well, will move it in v2 patch

CC Christoph. Maybe not a big deal since it's already under tools/.

Thanks,
Fengguang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 9 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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#9 lore raw
In reply to Wu Fengguang
Quoted 4 lines · Wu Fengguang
Quoted 2 lines

BTW, I think tools/slub/slabinfo.c should be included in tools/vm/ as well, will move it in v2 patch

CC Christoph. Maybe not a big deal since it's already under tools/.

Sure. You have my blessing.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#10 lore raw
In reply to Dave Young
Quoted 4 lines · On Wed, 1 Feb 2012 14:34:20 +0800 Dave Young <[email protected]> wrote:

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

It would be nice to covert these into simple pass/fail tests and promote them to tools/testing/selftests/.

#11 lore raw
Quoted 10 lines · Andrew Morton
Quoted 4 lines · On Wed, 1 Feb 2012 14:34:20 +0800 Dave Young <[email protected]> wrote:

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

It would be nice to covert these into simple pass/fail tests and promote them to tools/testing/selftests/.

Andrew, I'm not clear about this, do you means to selftest hugepage-mmap.c, hugepage-shm.c and map_hugetlb.c? I think slabinfo and page-types should stay in tools/vm/. Can you explain a bit?

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Signature · 2 lines
Regards
Dave
#12 lore raw
Quoted 9 lines · Dave Young
Quoted 8 lines · Andrew Morton
Quoted 4 lines · On Wed, 1 Feb 2012 14:34:20 +0800 Dave Young<[email protected]> wrote:

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

Quoted 7 lines
Quoted 2 lines

It would be nice to covert these into simple pass/fail tests and promote them to tools/testing/selftests/.

Andrew, I'm not clear about this, do you means to selftest hugepage-mmap.c, hugepage-shm.c and map_hugetlb.c? I think slabinfo and page-types should stay in tools/vm/. Can you explain a bit?

Hey,

Check the comments in these files:

/*
* hugepage-mmap:
*
* Example of using huge page memory in a user application using the mmap
* system call.

/*
* hugepage-shm:
*
* Example of using huge page memory in a user application using Sys V
shared
* memory system calls. In this example the app is requesting 256MB of
* memory that is backed by huge pages. The application uses the flag
* SHM_HUGETLB in the shmget system call to inform the kernel that it is
* requesting huge pages.

/*
* Example of using hugepage memory in a user application using the mmap
* system call with MAP_HUGETLB flag.

All of them are examples, not tests, not tools, thus Documentation/ is the best place for them.

maintainer
#13 lore raw
Quoted 40 lines · On Thu, 02 Feb 2012 15:32:55 +0800 Cong Wang <[email protected]> wrote:
Quoted 9 lines · Dave Young
Quoted 8 lines · Andrew Morton
Quoted 4 lines · On Wed, 1 Feb 2012 14:34:20 +0800 Dave Young<[email protected]> wrote:

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

Quoted 7 lines
Quoted 2 lines

It would be nice to covert these into simple pass/fail tests and promote them to tools/testing/selftests/.

Andrew, I'm not clear about this, do you means to selftest hugepage-mmap.c, hugepage-shm.c and map_hugetlb.c? I think slabinfo and page-types should stay in tools/vm/. Can you explain a bit?

Hey,

Check the comments in these files:

/*
* hugepage-mmap:
*
* Example of using huge page memory in a user application using the mmap
* system call.

/*
* hugepage-shm:
*
* Example of using huge page memory in a user application using Sys V
shared
* memory system calls. In this example the app is requesting 256MB of
* memory that is backed by huge pages. The application uses the flag
* SHM_HUGETLB in the shmget system call to inform the kernel that it is
* requesting huge pages.

Quoted 6 lines

/*
* Example of using hugepage memory in a user application using the mmap
* system call with MAP_HUGETLB flag.

All of them are examples, not tests, not tools, thus Documentation/ is the best place for them.

um, read the code? All three programs are exactly pass/fail selftests.

They are very simplistic selftests and perhaps one day we'll write more sophisticated selftest code. If we were to do this then these files over in tools/vm would become obsolete. So we should put these into tools/testing/selftests/ on day one.

maintainer
#14 lore raw
In reply to Dave Young
Quoted 9 lines · On Thu, 2 Feb 2012 10:13:43 +0800 Dave Young <[email protected]> wrote:
Quoted 8 lines · Andrew Morton
Quoted 4 lines · On Wed, 1 Feb 2012 14:34:20 +0800 Dave Young <[email protected]> wrote:

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

Quoted 5 lines
Quoted 2 lines

It would be nice to covert these into simple pass/fail tests and promote them to tools/testing/selftests/.

Andrew, I'm not clear about this, do you means to selftest hugepage-mmap.c, hugepage-shm.c and map_hugetlb.c?

Those ones can go into selftests.

Quoted 1 line

I think slabinfo and page-types should stay in tools/vm/.

Yes, those are tools, not selftests.

author
#15 lore raw
Quoted 15 lines · Andrew Morton
Quoted 12 lines · On Thu, 2 Feb 2012 10:13:43 +0800 Dave Young <[email protected]> wrote:
Quoted 10 lines · Andrew Morton
Quoted 4 lines · On Wed, 1 Feb 2012 14:34:20 +0800 Dave Young <[email protected]> wrote:

tools/ is the better place for vm tools which are used by many people. Moving them to tools also make them open to more users instead of hide in Documentation folder.

It would be nice to covert these into simple pass/fail tests and promote them to tools/testing/selftests/.

Quoted 8 lines
Quoted 2 lines

Andrew, I'm not clear about this, do you means to selftest hugepage-mmap.c, hugepage-shm.c and map_hugetlb.c?

Those ones can go into selftests.

Quoted 1 line

I think slabinfo and page-types should stay in tools/vm/.

Yes, those are tools, not selftests.

Great, thanks for explain, will do

Signature · 2 lines
Thanks
Dave