From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26472C433DF for ; Fri, 9 Oct 2020 06:38:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C547922251 for ; Fri, 9 Oct 2020 06:38:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wC4Qo28t"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="G2tYAQJA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731995AbgJIGiB (ORCPT ); Fri, 9 Oct 2020 02:38:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731973AbgJIGfb (ORCPT ); Fri, 9 Oct 2020 02:35:31 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33163C0613D4; Thu, 8 Oct 2020 23:35:31 -0700 (PDT) Date: Fri, 09 Oct 2020 06:35:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1602225329; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NH7+qz70uuA7M/8J/NzK8S8LxVhvl7LNyP0PTc/zHRc=; b=wC4Qo28tXXtLs+Y4Wsn8Foii5xIg8ffUYyA/UXzPBX1iKHZrM7WQpCuT1/01f3XtlsMB0U 9v1OgQnyNsmYJaF7FglgSqmJUfQ2i/aWdSpefyZOCWlNTFwlYNgufLVGUQIUohfAd0s8V+ 0jtaA1/3kmy1pP3fWNjJ4+B8TKclZFvawW4jN6WyPFmpKK83MiDukPe4ak7xgq4HV3npjt iag73poABfpdUBY7umhLCtmIXxuNnG0PzPZOy3vSrL3IiwJNcsUGbEyk0OuPdA1ksShras 61mNn5xNdFZXk++4QvfBgGfI9zLy2imMIcMBVdxksPE6MaHfcbPa1wNjmrdaIQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1602225329; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NH7+qz70uuA7M/8J/NzK8S8LxVhvl7LNyP0PTc/zHRc=; b=G2tYAQJA57+NeN/cU1pMi3n8pG0D4+U7QrUoYUw+K7IRopePsQQR4STg/9t7qxDTsEjBDx nqV9wTgnQLqP4+Aw== From: "tip-bot2 for Paul E. McKenney" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/rcu] scftorture: Consolidate scftorture_invoke_one() check and kfree() Cc: "Paul E. McKenney" , x86 , LKML MIME-Version: 1.0 Message-ID: <160222532907.7002.3852636641253580280.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the core/rcu branch of tip: Commit-ID: 676e5469643e716df7f39ef77ba8f09c85b0c4f8 Gitweb: https://git.kernel.org/tip/676e5469643e716df7f39ef77ba8f09c85b0c4f8 Author: Paul E. McKenney AuthorDate: Wed, 01 Jul 2020 14:13:02 -07:00 Committer: Paul E. McKenney CommitterDate: Mon, 24 Aug 2020 18:38:35 -07:00 scftorture: Consolidate scftorture_invoke_one() check and kfree() This commit moves checking of the ->scfc_out field and the freeing of the scf_check structure down below the end of switch statement, thus saving a few lines of code. Signed-off-by: Paul E. McKenney --- kernel/scftorture.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/kernel/scftorture.c b/kernel/scftorture.c index 0d7299d..f220cd3 100644 --- a/kernel/scftorture.c +++ b/kernel/scftorture.c @@ -289,7 +289,7 @@ static void scf_handler_1(void *scfc_in) static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_random_state *trsp) { uintptr_t cpu; - int ret; + int ret = 0; struct scf_check *scfcp = NULL; struct scf_selector *scfsp = scf_sel_rand(trsp); @@ -322,11 +322,7 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra else scfp->n_single_ofl++; kfree(scfcp); - } else if (scfcp && scfsp->scfs_wait) { - if (WARN_ON_ONCE(!scfcp->scfc_out)) - atomic_inc(&n_mb_out_errs); // Leak rather than trash! - else - kfree(scfcp); + scfcp = NULL; } break; case SCF_PRIM_MANY: @@ -341,12 +337,6 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra scfcp->scfc_in = true; } smp_call_function_many(cpu_online_mask, scf_handler, scfcp, scfsp->scfs_wait); - if (scfcp) { - if (WARN_ON_ONCE(!scfcp->scfc_out)) - atomic_inc(&n_mb_out_errs); // Leak rather than trash! - else - kfree(scfcp); - } break; case SCF_PRIM_ALL: if (scfsp->scfs_wait) @@ -360,14 +350,14 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra scfcp->scfc_in = true; } smp_call_function(scf_handler, scfcp, scfsp->scfs_wait); - if (scfcp) { - if (WARN_ON_ONCE(!scfcp->scfc_out)) - atomic_inc(&n_mb_out_errs); // Leak rather than trash! - else - kfree(scfcp); - } break; } + if (scfcp && scfsp->scfs_wait) { + if (WARN_ON_ONCE(!scfcp->scfc_out)) + atomic_inc(&n_mb_out_errs); // Leak rather than trash! + else + kfree(scfcp); + } if (use_cpus_read_lock) cpus_read_unlock(); else