From patchwork Tue Oct 27 13:51:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 312729 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 EAEB0C388F9 for ; Tue, 27 Oct 2020 15:07:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1F902072E for ; Tue, 27 Oct 2020 15:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811251; bh=aFd9ur7hT0GIQZTgRmYM7KH2SdNLqiNpKrUw14nKtlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AMpRzGm/T2GimGEnO0wtitZ+sDjJDvX0OifNlgztvGaIKady1b+NtRx9DbjJiMewB YwrTwc9Gg+bO9C+bKgysugrteVbGDYfKFPsXLrCWvVyqFJSlPdMcn1cBzDFnudL5Qc flKQAQIqvuNdj3gsXflRq8vy7o7eb+oZsrcPqg5Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1793620AbgJ0PH2 (ORCPT ); Tue, 27 Oct 2020 11:07:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:37118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1789780AbgJ0PCu (ORCPT ); Tue, 27 Oct 2020 11:02:50 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C900B207DE; Tue, 27 Oct 2020 15:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810970; bh=aFd9ur7hT0GIQZTgRmYM7KH2SdNLqiNpKrUw14nKtlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ymqPsNy9AktUWLu0YyqDF5Zb8EgaLFTKiyeCEiLiSt2Q5wFueGbDaU6JmgxrwNOk/ EHH+8crdiG8pWVwIqNMwgKdk0wa9a20iN6YNSTsDZE0qQso2qZMcliZnb1noVuB1CJ a8OQdrSSpptiHFN2Kj5E5X8x2ax0v3b6ogkXnC70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.8 328/633] rcutorture: Properly set rcu_fwds for OOM handling Date: Tue, 27 Oct 2020 14:51:11 +0100 Message-Id: <20201027135538.064671987@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Paul E. McKenney [ Upstream commit c8fa63714763b7795a3f5fb7ed6d000763e6dccc ] The conversion of rcu_fwds to dynamic allocation failed to actually allocate the required structure. This commit therefore allocates it, frees it, and updates rcu_fwds accordingly. While in the area, it abstracts the cleanup actions into rcu_torture_fwd_prog_cleanup(). Fixes: 5155be9994e5 ("rcutorture: Dynamically allocate rcu_fwds structure") Reported-by: kernel test robot Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/rcutorture.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index efb792e13fca9..23ec68d8ff3aa 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2154,9 +2154,20 @@ static int __init rcu_torture_fwd_prog_init(void) return -ENOMEM; spin_lock_init(&rfp->rcu_fwd_lock); rfp->rcu_fwd_cb_tail = &rfp->rcu_fwd_cb_head; + rcu_fwds = rfp; return torture_create_kthread(rcu_torture_fwd_prog, rfp, fwd_prog_task); } +static void rcu_torture_fwd_prog_cleanup(void) +{ + struct rcu_fwd *rfp; + + torture_stop_kthread(rcu_torture_fwd_prog, fwd_prog_task); + rfp = rcu_fwds; + rcu_fwds = NULL; + kfree(rfp); +} + /* Callback function for RCU barrier testing. */ static void rcu_torture_barrier_cbf(struct rcu_head *rcu) { @@ -2360,7 +2371,7 @@ rcu_torture_cleanup(void) show_rcu_gp_kthreads(); rcu_torture_barrier_cleanup(); - torture_stop_kthread(rcu_torture_fwd_prog, fwd_prog_task); + rcu_torture_fwd_prog_cleanup(); torture_stop_kthread(rcu_torture_stall, stall_task); torture_stop_kthread(rcu_torture_writer, writer_task);