All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	Mike Christie <michaelc@cs.wisc.edu>,
	Hannes Reinecke <hare@suse.de>,
	James Bottomley <James.Bottomley@suse.de>,
	Konrad Rzeszutek Wilk <konrad@darnok.org>,
	Boaz Harrosh <bharrosh@panasas.com>,
	Richard Sharpe <realrichardsharpe@gmail.com>
Subject: Re: [PATCH] tcm: Convert to cpu_relax() for atomic_read() in tight loops
Date: Fri, 10 Sep 2010 08:32:00 +0200	[thread overview]
Message-ID: <4C89D0E0.4000803@gmail.com> (raw)
In-Reply-To: <1284067768-23863-1-git-send-email-nab@linux-iscsi.org>

On 09/09/2010 11:29 PM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
> 
> Greetings all,
> 
> This patch converts the following functions from within shutdown and release
> path code to use cpu_relax() instead of msleep() while doing atomic_read() in
> a tight loop waiting for various PR and MIB reference count(s) to return to zero:
> 
> 	*) core_update_device_list_for_node() + struct se_dev_entry->pr_ref_count
> 	*) core_release_port() + struct se_port->sep_tg_pt_ref_cnt
> 	*) se_dev_stop() + struct se_hba->dev_mib_access_count
> 	*) __core_scsi3_free_registration() + struct t10_pr_registration->pr_res_holders
> 	*) core_tpg_wait_for_nacl_pr_ref() + struct se_node_acl->acl_pr_ref_count
> 	*) core_tpg_wait_for_mib_ref() + struct se_node_acl->mib_ref_count
> 	*) core_tpg_deregister() + struct se_portal_group->tpg_pr_ref_count
> 	*) transport_deregister_session() + struct se_session->mib_ref_count
> 
> Thanks to Konrad Rzeszutek Wilk for mentioning cpu_relax() usage!
> 
> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
> ---
>  drivers/target/target_core_device.c    |    6 +++---
>  drivers/target/target_core_pr.c        |    2 +-
>  drivers/target/target_core_tpg.c       |    6 +++---
>  drivers/target/target_core_transport.c |    2 +-
>  4 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
> index 665b8e2..459f0f8 100644
> --- a/drivers/target/target_core_device.c
> +++ b/drivers/target/target_core_device.c
> @@ -532,7 +532,7 @@ int core_update_device_list_for_node(
>  	 */
>  	spin_unlock_irq(&nacl->device_list_lock);
>  	while (atomic_read(&deve->pr_ref_count) != 0)
> -		msleep(100);
> +		cpu_relax();
>  	spin_lock_irq(&nacl->device_list_lock);
>  	/*
>  	 * Disable struct se_dev_entry LUN ACL mapping

Why would you want to convert those to busy-waiting? This should rather
be converted to wait_event/wake_up, right?

thanks,
-- 
js

  reply	other threads:[~2010-09-10  6:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-09 21:29 [PATCH] tcm: Convert to cpu_relax() for atomic_read() in tight loops Nicholas A. Bellinger
2010-09-10  6:32 ` Jiri Slaby [this message]
2010-09-10 19:13   ` Nicholas A. Bellinger

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=4C89D0E0.4000803@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=James.Bottomley@suse.de \
    --cc=bharrosh@panasas.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=konrad@darnok.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=nab@linux-iscsi.org \
    --cc=realrichardsharpe@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.