Re: [PATCH 1/2 -mm] fault-injection: safer defaults, trivial optimization, cleanup

2006-11-28 Thread Andrew Morton
On Tue, 28 Nov 2006 14:50:45 -0800
Don Mullis <[EMAIL PROTECTED]> wrote:

> On Tue, 2006-11-28 at 13:37 -0800, Andrew Morton wrote:
> 
> > We'd prefer one-patch-per-concept, please. This all sounds like about
> > six patches.
> 
> Understood.
> 
> > We _could_ merge this patch as-is, but it means that when this stuff
> > finally hits mainline it would go in as a nice sequence of logical patches,
> > followed by a random thing which is splattered all over all the preceding
> > patches.
> 
> Does this argue for a respin of the original patches, folding in
> content from this one, rather than splitting it into an additional six to
> be appended to the series?

If the fixes are one-patch-per-concept, and if the original patch series is
one-patch-per-concept (it is) then I can usually insert the fixups in the
right place, later fold each into its appropriate base patch and everything
lands in git squeaky-clean.

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


Re: [PATCH 1/2 -mm] fault-injection: safer defaults, trivial optimization, cleanup

2006-11-28 Thread Don Mullis
On Tue, 2006-11-28 at 13:37 -0800, Andrew Morton wrote:

> We'd prefer one-patch-per-concept, please. This all sounds like about
> six patches.

Understood.

> We _could_ merge this patch as-is, but it means that when this stuff
> finally hits mainline it would go in as a nice sequence of logical patches,
> followed by a random thing which is splattered all over all the preceding
> patches.

Does this argue for a respin of the original patches, folding in
content from this one, rather than splitting it into an additional six to
be appended to the series?

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


Re: [PATCH 1/2 -mm] fault-injection: safer defaults, trivial optimization, cleanup

2006-11-28 Thread Andrew Morton
On Mon, 27 Nov 2006 23:44:26 -0800
Don Mullis <[EMAIL PROTECTED]> wrote:

> Set /debug/fail*/* defaults supposed most likely to please a new user.
> Clamp /debug/fail*/stacktrace-depth to MAX_STACK_TRACE_DEPTH.
> 
> In should_fail(), move stack-unwinding test past cheaper tests (performance
> gain not quantified).  Simplify logic; eliminate goto.
> Use bool/true/false consistently.
> 
> Correct and disambiguate documentation.

We'd prefer one-patch-per-concept, please. This all sounds like about
six patches.

We _could_ merge this patch as-is, but it means that when this stuff
finally hits mainline it would go in as a nice sequence of logical patches,
followed by a random thing which is splattered all over all the preceding
patches.
-
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/


Re: [PATCH 1/2 -mm] fault-injection: safer defaults, trivial optimization, cleanup

2006-11-28 Thread Andrew Morton
On Mon, 27 Nov 2006 23:44:26 -0800
Don Mullis [EMAIL PROTECTED] wrote:

 Set /debug/fail*/* defaults supposed most likely to please a new user.
 Clamp /debug/fail*/stacktrace-depth to MAX_STACK_TRACE_DEPTH.
 
 In should_fail(), move stack-unwinding test past cheaper tests (performance
 gain not quantified).  Simplify logic; eliminate goto.
 Use bool/true/false consistently.
 
 Correct and disambiguate documentation.

We'd prefer one-patch-per-concept, please. This all sounds like about
six patches.

We _could_ merge this patch as-is, but it means that when this stuff
finally hits mainline it would go in as a nice sequence of logical patches,
followed by a random thing which is splattered all over all the preceding
patches.
-
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/


Re: [PATCH 1/2 -mm] fault-injection: safer defaults, trivial optimization, cleanup

2006-11-28 Thread Don Mullis
On Tue, 2006-11-28 at 13:37 -0800, Andrew Morton wrote:

 We'd prefer one-patch-per-concept, please. This all sounds like about
 six patches.

Understood.

 We _could_ merge this patch as-is, but it means that when this stuff
 finally hits mainline it would go in as a nice sequence of logical patches,
 followed by a random thing which is splattered all over all the preceding
 patches.

Does this argue for a respin of the original patches, folding in
content from this one, rather than splitting it into an additional six to
be appended to the series?

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


Re: [PATCH 1/2 -mm] fault-injection: safer defaults, trivial optimization, cleanup

2006-11-28 Thread Andrew Morton
On Tue, 28 Nov 2006 14:50:45 -0800
Don Mullis [EMAIL PROTECTED] wrote:

 On Tue, 2006-11-28 at 13:37 -0800, Andrew Morton wrote:
 
  We'd prefer one-patch-per-concept, please. This all sounds like about
  six patches.
 
 Understood.
 
  We _could_ merge this patch as-is, but it means that when this stuff
  finally hits mainline it would go in as a nice sequence of logical patches,
  followed by a random thing which is splattered all over all the preceding
  patches.
 
 Does this argue for a respin of the original patches, folding in
 content from this one, rather than splitting it into an additional six to
 be appended to the series?

If the fixes are one-patch-per-concept, and if the original patch series is
one-patch-per-concept (it is) then I can usually insert the fixups in the
right place, later fold each into its appropriate base patch and everything
lands in git squeaky-clean.

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


[PATCH 1/2 -mm] fault-injection: safer defaults, trivial optimization, cleanup

2006-11-27 Thread Don Mullis
Set /debug/fail*/* defaults supposed most likely to please a new user.
Clamp /debug/fail*/stacktrace-depth to MAX_STACK_TRACE_DEPTH.

In should_fail(), move stack-unwinding test past cheaper tests (performance
gain not quantified).  Simplify logic; eliminate goto.
Use bool/true/false consistently.

Correct and disambiguate documentation.

Signed-off-by: Don Mullis <[EMAIL PROTECTED]>
Cc: Akinobu Mita <[EMAIL PROTECTED]>
---
 Documentation/fault-injection/failmodule.sh   |4 -
 Documentation/fault-injection/fault-injection.txt |   39 +--
 include/linux/fault-inject.h  |3 
 lib/fault-inject.c|   74 +-
 mm/page_alloc.c   |2 
 mm/slab.c |1 
 6 files changed, 71 insertions(+), 52 deletions(-)

Index: linux-2.6.18/mm/slab.c
===
--- linux-2.6.18.orig/mm/slab.c
+++ linux-2.6.18/mm/slab.c
@@ -3111,6 +3111,7 @@ static struct failslab_attr {
 
 } failslab = {
.attr = FAULT_ATTR_INITIALIZER,
+   .ignore_gfp_wait = 1,
 };
 
 static int __init setup_failslab(char *str)
Index: linux-2.6.18/include/linux/fault-inject.h
===
--- linux-2.6.18.orig/include/linux/fault-inject.h
+++ linux-2.6.18/include/linux/fault-inject.h
@@ -52,12 +52,13 @@ struct fault_attr {
.times = ATOMIC_INIT(1),\
.require_end = ULONG_MAX,   \
.stacktrace_depth = 32, \
+   .verbose = 2,   \
}
 
 #define DECLARE_FAULT_ATTR(name) struct fault_attr name = 
FAULT_ATTR_INITIALIZER
 int setup_fault_attr(struct fault_attr *attr, char *str);
 void should_fail_srandom(unsigned long entropy);
-int should_fail(struct fault_attr *attr, ssize_t size);
+bool should_fail(struct fault_attr *attr, ssize_t size);
 
 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
 
Index: linux-2.6.18/lib/fault-inject.c
===
--- linux-2.6.18.orig/lib/fault-inject.c
+++ linux-2.6.18/lib/fault-inject.c
@@ -48,11 +48,13 @@ static void fail_dump(struct fault_attr 
 
 #define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)
 
-static int fail_task(struct fault_attr *attr, struct task_struct *task)
+static bool fail_task(struct fault_attr *attr, struct task_struct *task)
 {
return !in_interrupt() && task->make_it_fail;
 }
 
+#define MAX_STACK_TRACE_DEPTH 32
+
 #ifdef CONFIG_STACK_UNWIND
 
 static asmlinkage int fail_stacktrace_callback(struct unwind_frame_info *info,
@@ -68,15 +70,15 @@ static asmlinkage int fail_stacktrace_ca
break;
if (attr->reject_start <= UNW_PC(info) &&
   UNW_PC(info) < attr->reject_end)
-   return 0;
+   return false;
if (attr->require_start <= UNW_PC(info) &&
   UNW_PC(info) < attr->require_end)
-   found = 1;
+   found = true;
}
return found;
 }
 
-static int fail_stacktrace(struct fault_attr *attr)
+static bool fail_stacktrace(struct fault_attr *attr)
 {
struct unwind_frame_info info;
 
@@ -85,9 +87,7 @@ static int fail_stacktrace(struct fault_
 
 #elif defined(CONFIG_STACKTRACE)
 
-#define MAX_STACK_TRACE_DEPTH 32
-
-static int fail_stacktrace(struct fault_attr *attr)
+static bool fail_stacktrace(struct fault_attr *attr)
 {
struct stack_trace trace;
int depth = attr->stacktrace_depth;
@@ -100,8 +100,7 @@ static int fail_stacktrace(struct fault_
 
trace.nr_entries = 0;
trace.entries = entries;
-   trace.max_entries = (depth < MAX_STACK_TRACE_DEPTH) ?
-   depth : MAX_STACK_TRACE_DEPTH;
+   trace.max_entries = depth;
trace.skip = 1;
trace.all_contexts = 0;
 
@@ -109,26 +108,26 @@ static int fail_stacktrace(struct fault_
for (n = 0; n < trace.nr_entries; n++) {
if (attr->reject_start <= entries[n] &&
   entries[n] < attr->reject_end)
-   return 0;
+   return false;
if (attr->require_start <= entries[n] &&
   entries[n] < attr->require_end)
-   found = 1;
+   found = true;
}
return found;
 }
 
 #else
 
-static inline int fail_stacktrace(struct fault_attr *attr)
+static inline bool fail_stacktrace(struct fault_attr *attr)
 {
-   static int firsttime = 1;
+   static bool firsttime = true;
 
if (firsttime) {
printk(KERN_WARNING
"This architecture does not implement save_stack_trace()\n");
-

[PATCH 1/2 -mm] fault-injection: safer defaults, trivial optimization, cleanup

2006-11-27 Thread Don Mullis
Set /debug/fail*/* defaults supposed most likely to please a new user.
Clamp /debug/fail*/stacktrace-depth to MAX_STACK_TRACE_DEPTH.

In should_fail(), move stack-unwinding test past cheaper tests (performance
gain not quantified).  Simplify logic; eliminate goto.
Use bool/true/false consistently.

Correct and disambiguate documentation.

Signed-off-by: Don Mullis [EMAIL PROTECTED]
Cc: Akinobu Mita [EMAIL PROTECTED]
---
 Documentation/fault-injection/failmodule.sh   |4 -
 Documentation/fault-injection/fault-injection.txt |   39 +--
 include/linux/fault-inject.h  |3 
 lib/fault-inject.c|   74 +-
 mm/page_alloc.c   |2 
 mm/slab.c |1 
 6 files changed, 71 insertions(+), 52 deletions(-)

Index: linux-2.6.18/mm/slab.c
===
--- linux-2.6.18.orig/mm/slab.c
+++ linux-2.6.18/mm/slab.c
@@ -3111,6 +3111,7 @@ static struct failslab_attr {
 
 } failslab = {
.attr = FAULT_ATTR_INITIALIZER,
+   .ignore_gfp_wait = 1,
 };
 
 static int __init setup_failslab(char *str)
Index: linux-2.6.18/include/linux/fault-inject.h
===
--- linux-2.6.18.orig/include/linux/fault-inject.h
+++ linux-2.6.18/include/linux/fault-inject.h
@@ -52,12 +52,13 @@ struct fault_attr {
.times = ATOMIC_INIT(1),\
.require_end = ULONG_MAX,   \
.stacktrace_depth = 32, \
+   .verbose = 2,   \
}
 
 #define DECLARE_FAULT_ATTR(name) struct fault_attr name = 
FAULT_ATTR_INITIALIZER
 int setup_fault_attr(struct fault_attr *attr, char *str);
 void should_fail_srandom(unsigned long entropy);
-int should_fail(struct fault_attr *attr, ssize_t size);
+bool should_fail(struct fault_attr *attr, ssize_t size);
 
 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
 
Index: linux-2.6.18/lib/fault-inject.c
===
--- linux-2.6.18.orig/lib/fault-inject.c
+++ linux-2.6.18/lib/fault-inject.c
@@ -48,11 +48,13 @@ static void fail_dump(struct fault_attr 
 
 #define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)
 
-static int fail_task(struct fault_attr *attr, struct task_struct *task)
+static bool fail_task(struct fault_attr *attr, struct task_struct *task)
 {
return !in_interrupt()  task-make_it_fail;
 }
 
+#define MAX_STACK_TRACE_DEPTH 32
+
 #ifdef CONFIG_STACK_UNWIND
 
 static asmlinkage int fail_stacktrace_callback(struct unwind_frame_info *info,
@@ -68,15 +70,15 @@ static asmlinkage int fail_stacktrace_ca
break;
if (attr-reject_start = UNW_PC(info) 
   UNW_PC(info)  attr-reject_end)
-   return 0;
+   return false;
if (attr-require_start = UNW_PC(info) 
   UNW_PC(info)  attr-require_end)
-   found = 1;
+   found = true;
}
return found;
 }
 
-static int fail_stacktrace(struct fault_attr *attr)
+static bool fail_stacktrace(struct fault_attr *attr)
 {
struct unwind_frame_info info;
 
@@ -85,9 +87,7 @@ static int fail_stacktrace(struct fault_
 
 #elif defined(CONFIG_STACKTRACE)
 
-#define MAX_STACK_TRACE_DEPTH 32
-
-static int fail_stacktrace(struct fault_attr *attr)
+static bool fail_stacktrace(struct fault_attr *attr)
 {
struct stack_trace trace;
int depth = attr-stacktrace_depth;
@@ -100,8 +100,7 @@ static int fail_stacktrace(struct fault_
 
trace.nr_entries = 0;
trace.entries = entries;
-   trace.max_entries = (depth  MAX_STACK_TRACE_DEPTH) ?
-   depth : MAX_STACK_TRACE_DEPTH;
+   trace.max_entries = depth;
trace.skip = 1;
trace.all_contexts = 0;
 
@@ -109,26 +108,26 @@ static int fail_stacktrace(struct fault_
for (n = 0; n  trace.nr_entries; n++) {
if (attr-reject_start = entries[n] 
   entries[n]  attr-reject_end)
-   return 0;
+   return false;
if (attr-require_start = entries[n] 
   entries[n]  attr-require_end)
-   found = 1;
+   found = true;
}
return found;
 }
 
 #else
 
-static inline int fail_stacktrace(struct fault_attr *attr)
+static inline bool fail_stacktrace(struct fault_attr *attr)
 {
-   static int firsttime = 1;
+   static bool firsttime = true;
 
if (firsttime) {
printk(KERN_WARNING
This architecture does not implement save_stack_trace()\n);
-   firsttime = 0;
+