public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: paulmck@kernel.org
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
	mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: [PATCH tip/core/rcu 09/14] rcutorture: Properly set rcu_fwds for OOM handling
Date: Mon, 31 Aug 2020 11:04:01 -0700	[thread overview]
Message-ID: <20200831180406.494-9-paulmck@kernel.org> (raw)
In-Reply-To: <20200831180348.GA416@paulmck-ThinkPad-P72>

From: "Paul E. McKenney" <paulmck@kernel.org>

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 <rong.a.chen@intel.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 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 c8206ff..7942be4 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -2148,9 +2148,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)
 {
@@ -2448,7 +2459,7 @@ rcu_torture_cleanup(void)
 	show_rcu_gp_kthreads();
 	rcu_torture_read_exit_cleanup();
 	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);
 
-- 
2.9.5


  parent reply	other threads:[~2020-08-31 18:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 18:03 [PATCH tip/core/rcu 0/14] Torture-test updates for v5.10 Paul E. McKenney
2020-08-31 18:03 ` [PATCH tip/core/rcu 01/14] rcutorture: Remove KCSAN stubs paulmck
2020-08-31 18:03 ` [PATCH tip/core/rcu 02/14] rcutorture: Output number of elapsed grace periods paulmck
2020-08-31 18:03 ` [PATCH tip/core/rcu 03/14] torture: document --allcpus argument added to the kvm.sh script paulmck
2020-08-31 18:03 ` [PATCH tip/core/rcu 04/14] locktorture: Make function torture_percpu_rwsem_init() static paulmck
2020-08-31 18:03 ` [PATCH tip/core/rcu 05/14] rcutorture: Replace HTTP links with HTTPS ones paulmck
2020-08-31 18:03 ` [PATCH tip/core/rcu 06/14] torture: Update initrd documentation paulmck
2020-08-31 18:03 ` [PATCH tip/core/rcu 07/14] rcutorture: Add CONFIG_PROVE_RCU_LIST to TREE05 paulmck
2020-08-31 18:04 ` [PATCH tip/core/rcu 08/14] torture: Add kvm.sh --help and update help message paulmck
2020-08-31 18:04 ` paulmck [this message]
2020-08-31 18:04 ` [PATCH tip/core/rcu 10/14] rcutorture: Properly synchronize with OOM notifier paulmck
2020-08-31 18:04 ` [PATCH tip/core/rcu 11/14] refperf: Avoid null pointer dereference when buf fails to allocate paulmck
2020-08-31 18:04 ` [PATCH tip/core/rcu 12/14] rcutorture: Hoist OOM registry up one level paulmck
2020-08-31 18:04 ` [PATCH tip/core/rcu 13/14] rcutorture: Allow pointer leaks to test diagnostic code paulmck
2020-08-31 18:04 ` [PATCH tip/core/rcu 14/14] torture: Add gdb support paulmck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200831180406.494-9-paulmck@kernel.org \
    --to=paulmck@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox