From: Roman Gushchin <guro@fb.com>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Song Liu <songliubraving@fb.com>,
Dennis Zhou <dennis@kernel.org>, <linux-kernel@vger.kernel.org>,
<kernel-team@fb.com>, Roman Gushchin <guro@fb.com>
Subject: [PATCH 3/4] md: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT
Date: Tue, 7 May 2019 10:01:49 -0700 [thread overview]
Message-ID: <20190507170150.64051-3-guro@fb.com> (raw)
In-Reply-To: <20190507170150.64051-1-guro@fb.com>
Percpu reference counters should now be initialized with the
PERCPU_REF_ALLOW_REINIT in order to allow switching them to the
percpu mode from the atomic mode.
To make percpu_ref_switch_to_percpu() call in set_in_sync()
succeed,let's initialize percpu refcounters with the
PERCU_REF_ALLOW_REINIT flag.
Signed-off-by: Roman Gushchin <guro@fb.com>
---
drivers/md/md.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 45ffa23fa85d..6b60211d0b3e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5245,7 +5245,8 @@ int mddev_init_writes_pending(struct mddev *mddev)
{
if (mddev->writes_pending.percpu_count_ptr)
return 0;
- if (percpu_ref_init(&mddev->writes_pending, no_op, 0, GFP_KERNEL) < 0)
+ if (percpu_ref_init(&mddev->writes_pending, no_op,
+ PERCPU_REF_ALLOW_REINIT, GFP_KERNEL) < 0)
return -ENOMEM;
/* We want to start with the refcount at zero */
percpu_ref_put(&mddev->writes_pending);
--
2.20.1
next prev parent reply other threads:[~2019-05-07 17:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 17:01 [PATCH 1/4] percpu_ref: introduce PERCPU_REF_ALLOW_REINIT flag Roman Gushchin
2019-05-07 17:01 ` [PATCH 2/4] io_uring: initialize percpu refcounters using PERCU_REF_ALLOW_REINIT Roman Gushchin
2019-05-07 17:01 ` Roman Gushchin [this message]
2019-05-07 17:01 ` [PATCH 4/4] percpu_ref: release percpu memory early without PERCPU_REF_ALLOW_REINIT Roman Gushchin
2019-05-09 16:53 ` [PATCH 1/4] percpu_ref: introduce PERCPU_REF_ALLOW_REINIT flag Tejun Heo
2019-05-09 17:52 ` Dennis Zhou
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=20190507170150.64051-3-guro@fb.com \
--to=guro@fb.com \
--cc=axboe@kernel.dk \
--cc=dennis@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=tj@kernel.org \
/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