public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: "jianchao.wang" <jianchao.w.wang@oracle.com>
To: Ming Lei <ming.lei@redhat.com>, linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>,
	Kent Overstreet <kent.overstreet@gmail.com>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH 2/4] lib/percpu-refcount: introduce percpu_ref_resurge()
Date: Wed, 19 Sep 2018 13:19:10 +0800	[thread overview]
Message-ID: <242969d0-1370-b342-025d-a11b7f59d28f@oracle.com> (raw)
In-Reply-To: <20180918101946.13329-3-ming.lei@redhat.com>

Hi Ming

On 09/18/2018 06:19 PM, Ming Lei wrote:
> +		unsigned long __percpu *percpu_count;
> +
> +		WARN_ON_ONCE(__ref_is_percpu(ref, &percpu_count));
> +
> +		/* get one extra ref for avoiding race with .release */
> +		rcu_read_lock_sched();
> +		atomic_long_add(1, &ref->count);
> +		rcu_read_unlock_sched();
> +	}

The rcu_read_lock_sched here is redundant. We have been in the critical section
of a spin_lock_irqsave.

The atomic_long_add(1, &ref->count) may have two result.
1. ref->count > 1
   it will not drop to zero any more.
2. ref->count == 1
   it has dropped to zero and .release may be running.

Thanks
Jianchao

  parent reply	other threads:[~2018-09-19 10:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180918101946.13329-1-ming.lei@redhat.com>
2018-09-18 10:19 ` [PATCH 1/4] percpu-refcount: move zeroing of percpu part into percpu_ref_switch_to_atomic_rcu Ming Lei
2018-09-18 10:19 ` [PATCH 2/4] lib/percpu-refcount: introduce percpu_ref_resurge() Ming Lei
2018-09-18 12:50   ` Tejun Heo
2018-09-19  3:09     ` Ming Lei
2018-09-19  5:19   ` jianchao.wang [this message]
2018-09-19  7:55     ` Ming Lei
2018-09-19  8:01       ` Ming Lei
2018-09-18 10:19 ` [PATCH 3/4] blk-mq: introduce blk_mq_unfreeze_queue_no_drain_io Ming Lei
2018-09-18 10:19 ` [PATCH 4/4] nvme: don't drain IO in nvme_reset_work() 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=242969d0-1370-b342-025d-a11b7f59d28f@oracle.com \
    --to=jianchao.w.wang@oracle.com \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.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