Skip to contentSkip to conversation

mm, vmacache: Add kconfig VMACACHE_SHIFT

PATCH In review WANG Chao 5 participants 8 messages Jan 22, 2015 – Jan 24, 2015

Subsystems (3)
lore
Share & tools
lore

WANG Chao

author
#0 lore raw

PATCH 1/1 mm, vmacache: Add kconfig VMACACHE_SHIFT

Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the number of slots vma cache has for each thread. Range is chosen 0-4 (1-16 slots) to consider both overhead and performance penalty. Default is 2 (4 slots) as it originally is, which provides good enough balance.

---
 include/linux/sched.h | 2 +-
 mm/Kconfig            | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
include/linux/sched.h +1 -1
index 8db31ef..56fd96d 100644
@@ -134,7 +134,7 @@ struct perf_event_context;
 struct blk_plug;
 struct filename;
 
-#define VMACACHE_BITS 2
+#define VMACACHE_BITS CONFIG_VMACACHE_SHIFT
 #define VMACACHE_SIZE (1U << VMACACHE_BITS)
 #define VMACACHE_MASK (VMACACHE_SIZE - 1)
 
mm/Kconfig +7 -0
index 1d1ae6b..7b82a52 100644
@@ -618,3 +618,10 @@ config MAX_STACK_SIZE_MB
 	  changed to a smaller value in which case that is used.
 
 	  A sane initial value is 80 MB.
+
+config VMACACHE_SHIFT
+	int "Number of slots in per-thread VMA cache (as a power of 2)"
+	range 0 4
+	default 2
+	help
+	  This is the number of slots VMA cache has for each thread.
Signature · 7 lines
2.1.0

--
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>
#1 lore raw
Quoted 5 lines · WANG Chao

Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the number of slots vma cache has for each thread. Range is chosen 0-4 (1-16 slots) to consider both overhead and performance penalty. Default is 2 (4 slots) as it originally is, which provides good enough balance.

Nack. I don't feel comfortable making scalability features of core code configurable.

Thanks,
Davidlohr

--
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>

author
#2 lore raw

Hi, Davidlohr

Quoted 9 lines · Davidlohr Bueso
Quoted 5 lines · WANG Chao

Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the number of slots vma cache has for each thread. Range is chosen 0-4 (1-16 slots) to consider both overhead and performance penalty. Default is 2 (4 slots) as it originally is, which provides good enough balance.

Nack. I don't feel comfortable making scalability features of core code configurable.

Out of respect, is this a general rule not making scalability features of core code configurable?

Thanks
WANG Chao

--
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>

#3 lore raw
Quoted 10 lines · WANG Chao

Hi, Davidlohr

Quoted 7 lines · Davidlohr Bueso
Quoted 5 lines · WANG Chao

Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the number of slots vma cache has for each thread. Range is chosen 0-4 (1-16 slots) to consider both overhead and performance penalty. Default is 2 (4 slots) as it originally is, which provides good enough balance.

Quoted 5 lines
Quoted 2 lines

Nack. I don't feel comfortable making scalability features of core code configurable.

Out of respect, is this a general rule not making scalability features of core code configurable?

I doubt its a rule, just common sense. Users have no business configuring such low level details. The optimizations need to transparently work for everyone.

Thanks,
Davidlohr

--
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 14 lines · Davidlohr Bueso
Quoted 13 lines · WANG Chao

Hi, Davidlohr

Quoted 9 lines · Davidlohr Bueso
Quoted 5 lines · WANG Chao

Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the number of slots vma cache has for each thread. Range is chosen 0-4 (1-16 slots) to consider both overhead and performance penalty. Default is 2 (4 slots) as it originally is, which provides good enough balance.

Nack. I don't feel comfortable making scalability features of core code configurable.

Quoted 6 lines
Quoted 2 lines

Out of respect, is this a general rule not making scalability features of core code configurable?

I doubt its a rule, just common sense. Users have no business configuring such low level details. The optimizations need to transparently work for everyone.

There may sometimes be a good reason for making this kind of thing configurable, but since there were no performance numbers in the changelog, I have not seen any such reason for this particular change :)

--
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>

author
#5 lore raw
Quoted 18 lines · Rik van Riel
Quoted 17 lines · Davidlohr Bueso
Quoted 15 lines · WANG Chao

Hi, Davidlohr

Quoted 9 lines · Davidlohr Bueso
Quoted 5 lines · WANG Chao

Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the number of slots vma cache has for each thread. Range is chosen 0-4 (1-16 slots) to consider both overhead and performance penalty. Default is 2 (4 slots) as it originally is, which provides good enough balance.

Nack. I don't feel comfortable making scalability features of core code configurable.

Out of respect, is this a general rule not making scalability features of core code configurable?

Quoted 8 lines
Quoted 3 lines

I doubt its a rule, just common sense. Users have no business configuring such low level details. The optimizations need to transparently work for everyone.

There may sometimes be a good reason for making this kind of thing configurable, but since there were no performance numbers in the changelog, I have not seen any such reason for this particular change :)

True. I didn't run any kind of benchmark, thus no numbers here. This is purely hypothetical.

I'm glad to run some tests. For the sake of consistency, could you please show me a hint how do you measure at the first place? I can do hit-rate, but I don't know how you measure cpu cycles. Could you elaborate?

Thanks
WANG Chao

--
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>

#6 lore raw
Quoted 27 lines · WANG Chao
Quoted 18 lines · Rik van Riel
Quoted 18 lines · Davidlohr Bueso
Quoted 17 lines
Quoted 17 lines · WANG Chao
Quoted 15 lines
Quoted 15 lines

Hi, Davidlohr

Quoted 9 lines · Davidlohr Bueso
Quoted 9 lines · WANG Chao
Quoted 5 lines
Quoted 5 lines

Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the number of slots vma cache has for each thread. Range is chosen 0-4 (1-16 slots) to consider both overhead and performance penalty. Default is 2 (4 slots) as it originally is, which provides good enough balance.

Nack. I don't feel comfortable making scalability features of core code configurable.

Out of respect, is this a general rule not making scalability features of core code configurable?

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

I doubt its a rule, just common sense. Users have no business configuring such low level details. The optimizations need to transparently work for everyone.

There may sometimes be a good reason for making this kind of thing configurable, but since there were no performance numbers in the changelog, I have not seen any such reason for this particular change :)

Quoted 7 lines

True. I didn't run any kind of benchmark, thus no numbers here. This is purely hypothetical.

I'm glad to run some tests. For the sake of consistency, could you please show me a hint how do you measure at the first place? I can do hit-rate, but I don't know how you measure cpu cycles. Could you elaborate?

I don't think there's a need to look for problems where there are none.

Have you observed a performance issue that might be improved by changing the shift here?

Thanks,
Sasha

--
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>

#7 lore raw
In reply to WANG Chao
Quoted 3 lines · WANG Chao

Add a new kconfig option VMACACHE_SHIFT (as a power of 2) to specify the number of slots vma cache has for each thread. Range is chosen 0-4 (1-16 slots) to consider both overhead and performance penalty. Default is 2

One could say that overhead and performance penalty is the same thing. Please elaborate?

Also, got any performance numbers to share for workloads benefiting from more/less than the default?

Quoted 26 lines

(4 slots) as it originally is, which provides good enough balance.

---
  include/linux/sched.h | 2 +-
  mm/Kconfig            | 7 +++++++
  2 files changed, 8 insertions(+), 1 deletion(-)
include/linux/sched.h +1 -1
index 8db31ef..56fd96d 100644
@@ -134,7 +134,7 @@ struct perf_event_context;
  struct blk_plug;
  struct filename;
 
-#define VMACACHE_BITS 2
+#define VMACACHE_BITS CONFIG_VMACACHE_SHIFT
  #define VMACACHE_SIZE (1U << VMACACHE_BITS)
  #define VMACACHE_MASK (VMACACHE_SIZE - 1)
 
mm/Kconfig +0 -0
index 1d1ae6b..7b82a52 100644

mm/Kconfig config MAX_STACK_SIZE_MB · line 627

Quoted 10 lines
mm/Kconfig +7 -0
@@ -618,3 +618,10 @@ config MAX_STACK_SIZE_MB
  	  changed to a smaller value in which case that is used.
 
  	  A sane initial value is 80 MB.
+
+config VMACACHE_SHIFT
+	int "Number of slots in per-thread VMA cache (as a power of 2)"
+	range 0 4
+	default 2
+	help
+	  This is the number of slots VMA cache has for each thread.

As a user, I wouldn't find this informative enough to make the decision.

--
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>