All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged] fault-inject-avoid-call-to-random32-if-fault-injection-is-disabled.patch removed from -mm tree
@ 2012-06-21 19:25 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2012-06-21 19:25 UTC (permalink / raw)
  To: anton, akinobu.mita, mm-commits


The patch titled
     Subject: fault-inject: avoid call to random32() if fault injection is disabled
has been removed from the -mm tree.  Its filename was
     fault-inject-avoid-call-to-random32-if-fault-injection-is-disabled.patch

This patch was dropped because it was merged into mainline or a subsystem tree

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
From: Anton Blanchard <anton@samba.org>
Subject: fault-inject: avoid call to random32() if fault injection is disabled

After enabling CONFIG_FAILSLAB I noticed random32 in profiles even if slub
fault injection wasn't enabled at runtime.

should_fail forces a comparison against random32() even if probability is
0:

        if (attr->probability <= random32() % 100)
                return false;

Add a check up front for probability == 0 and avoid all of the more
complicated checks.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/fault-inject.c |    4 ++++
 1 file changed, 4 insertions(+)

diff -puN lib/fault-inject.c~fault-inject-avoid-call-to-random32-if-fault-injection-is-disabled lib/fault-inject.c
--- a/lib/fault-inject.c~fault-inject-avoid-call-to-random32-if-fault-injection-is-disabled
+++ a/lib/fault-inject.c
@@ -101,6 +101,10 @@ static inline bool fail_stacktrace(struc
 
 bool should_fail(struct fault_attr *attr, ssize_t size)
 {
+	/* No need to check any other properties if the probability is 0 */
+	if (attr->probability == 0)
+		return false;
+
 	if (attr->task_filter && !fail_task(attr, current))
 		return false;
 
_

Patches currently in -mm which might be from anton@samba.org are

origin.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-06-21 19:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-21 19:25 [merged] fault-inject-avoid-call-to-random32-if-fault-injection-is-disabled.patch removed from -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.