From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
Song Liu <song@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Veronika Kabatova <vkabatov@redhat.com>,
linux-raid@vger.kernel.org, Sagi Grimberg <sagi@grimberg.me>,
Tejun Heo <tj@kernel.org>, Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH V5 1/3] percpu_ref: add percpu_ref_is_initialized for MD
Date: Mon, 28 Sep 2020 09:30:28 +0200 [thread overview]
Message-ID: <20200928073028.GA16536@lst.de> (raw)
In-Reply-To: <20200927062654.2750277-2-ming.lei@redhat.com>
On Sun, Sep 27, 2020 at 02:26:52PM +0800, Ming Lei wrote:
> MD code uses perpcu-refcount internal to check if this percpu-refcount
> variable is initialized, this way is a hack.
>
> Add percpu_ref_is_initialized for MD so that the hack can be avoided.
>
> Acked-by: Song Liu <song@kernel.org>
> Suggested-by: Jens Axboe <axboe@kernel.dk>
> Tested-by: Veronika Kabatova <vkabatov@redhat.com>
> Cc: Song Liu <song@kernel.org>
> Cc: linux-raid@vger.kernel.org
> Cc: Sagi Grimberg <sagi@grimberg.me>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Bart Van Assche <bvanassche@acm.org>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> drivers/md/md.c | 2 +-
> include/linux/percpu-refcount.h | 1 +
> lib/percpu-refcount.c | 6 ++++++
> 3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index de8419b7ae98..241ff618d84e 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -5631,7 +5631,7 @@ static void no_op(struct percpu_ref *r) {}
>
> int mddev_init_writes_pending(struct mddev *mddev)
> {
> - if (mddev->writes_pending.percpu_count_ptr)
> + if (percpu_ref_is_initialized(&mddev->writes_pending))
> return 0;
I'd much rather use a flag in the containing mddev structure then
exposing this new "API". That mddev code is pretty gross to be honest,
we should just initialize the percpu_ref once instea of such a hack.
next prev parent reply other threads:[~2020-09-28 7:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-27 6:26 [PATCH V5 0/3] percpu_ref & block: reduce memory footprint of percpu_ref in fast path Ming Lei
2020-09-27 6:26 ` [PATCH V5 1/3] percpu_ref: add percpu_ref_is_initialized for MD Ming Lei
2020-09-28 7:30 ` Christoph Hellwig [this message]
2020-09-27 6:26 ` [PATCH V5 2/3] percpu_ref: reduce memory footprint of percpu_ref in fast path Ming Lei
2020-09-27 6:26 ` [PATCH V5 3/3] block: move 'q_usage_counter' into front of 'request_queue' Ming Lei
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=20200928073028.GA16536@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=sagi@grimberg.me \
--cc=song@kernel.org \
--cc=tj@kernel.org \
--cc=vkabatov@redhat.com \
/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
all inboxes | Powered by JetHome®