The patch titled Subject: fault-inject: avoid call to random32() if fault injection is disabled has been added to the -mm tree. Its filename is fault-inject-avoid-call-to-random32-if-fault-injection-is-disabled.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Anton Blanchard <anton@xxxxxxxxx> 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@xxxxxxxxx> Acked-by: Akinobu Mita <akinobu.mita@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- 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; _ Subject: Subject: fault-inject: avoid call to random32() if fault injection is disabled Patches currently in -mm which might be from anton@xxxxxxxxx are fault-inject-avoid-call-to-random32-if-fault-injection-is-disabled.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html