public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Farrell <paf@cray.com>
To: NeilBrown <neilb@suse.com>, Oleg Drokin <oleg.drokin@intel.com>,
	"Andreas Dilger" <andreas.dilger@intel.com>,
	James Simmons <jsimmons@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	lustre <lustre-devel@lists.lustre.org>
Subject: Re: [lustre-devel] [PATCH 08/16] staging: lustre: open code polling loop instead of using l_wait_event()
Date: Mon, 18 Dec 2017 20:55:10 +0000	[thread overview]
Message-ID: <D65D86E7.C5E12%paf@cray.com> (raw)
In-Reply-To: <151358148008.5099.7316878897181140635.stgit@noble>

The lov_check_and_wait_active wait is usually (always?) going to be
asynchronous from userspace and probably shouldn¹t contribute to load.

So I guess that means schedule_timeout_idle.

On 12/18/17, 1:18 AM, "lustre-devel on behalf of NeilBrown"
<lustre-devel-bounces@lists.lustre.org on behalf of neilb@suse.com> wrote:

>Two places that LWI_TIMEOUT_INTERVAL() is used, the outcome is a
>simple polling loop that polls every second for some event (with a
>limit).
>
>So write a simple loop to make this more apparent.
>
>Signed-off-by: NeilBrown <neilb@suse.com>
>---
> drivers/staging/lustre/lustre/llite/llite_lib.c |   11 +++++------
> drivers/staging/lustre/lustre/lov/lov_request.c |   12 +++++-------
> 2 files changed, 10 insertions(+), 13 deletions(-)
>
>diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c
>b/drivers/staging/lustre/lustre/llite/llite_lib.c
>index 33dc15e9aebb..f6642fa30428 100644
>--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
>+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
>@@ -1984,8 +1984,7 @@ void ll_umount_begin(struct super_block *sb)
> 	struct ll_sb_info *sbi = ll_s2sbi(sb);
> 	struct obd_device *obd;
> 	struct obd_ioctl_data *ioc_data;
>-	wait_queue_head_t waitq;
>-	struct l_wait_info lwi;
>+	int cnt = 0;
> 
> 	CDEBUG(D_VFSTRACE, "VFS Op: superblock %p count %d active %d\n", sb,
> 	       sb->s_count, atomic_read(&sb->s_active));
>@@ -2021,10 +2020,10 @@ void ll_umount_begin(struct super_block *sb)
> 	 * and then continue. For now, we just periodically checking for vfs
> 	 * to decrement mnt_cnt and hope to finish it within 10sec.
> 	 */
>-	init_waitqueue_head(&waitq);
>-	lwi = LWI_TIMEOUT_INTERVAL(10 * HZ,
>-				   HZ, NULL, NULL);
>-	l_wait_event(waitq, may_umount(sbi->ll_mnt.mnt), &lwi);
>+	while (cnt < 10 && !may_umount(sbi->ll_mnt.mnt)) {
>+		schedule_timeout_uninterruptible(HZ);
>+		cnt ++;
>+	}
> 
> 	schedule();
> }
>diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c
>b/drivers/staging/lustre/lustre/lov/lov_request.c
>index fb3b7a7fa32a..c1e58fcc30b3 100644
>--- a/drivers/staging/lustre/lustre/lov/lov_request.c
>+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
>@@ -99,8 +99,7 @@ static int lov_check_set(struct lov_obd *lov, int idx)
>  */
> static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx)
> {
>-	wait_queue_head_t waitq;
>-	struct l_wait_info lwi;
>+	int cnt = 0;
> 	struct lov_tgt_desc *tgt;
> 	int rc = 0;
> 
>@@ -125,11 +124,10 @@ static int lov_check_and_wait_active(struct lov_obd
>*lov, int ost_idx)
> 
> 	mutex_unlock(&lov->lov_lock);
> 
>-	init_waitqueue_head(&waitq);
>-	lwi = LWI_TIMEOUT_INTERVAL(obd_timeout * HZ,
>-				   HZ, NULL, NULL);
>-
>-	rc = l_wait_event(waitq, lov_check_set(lov, ost_idx), &lwi);
>+	while (cnt < obd_timeout && !lov_check_set(lov, ost_idx)) {
>+		schedule_timeout_uninterruptible(HZ);
>+		cnt ++;
>+	}
> 	if (tgt->ltd_active)
> 		return 1;
> 
>
>
>_______________________________________________
>lustre-devel mailing list
>lustre-devel@lists.lustre.org
>http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

  reply	other threads:[~2017-12-18 20:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18  7:17 [PATCH SERIES 5: 00/16] staging: lustre: use standard wait_event macros NeilBrown
2017-12-18  7:17 ` [PATCH 02/16] staging: lustre: replace simple cases of l_wait_event() with wait_event() NeilBrown
2017-12-18 17:48   ` [lustre-devel] " Patrick Farrell
2017-12-18 21:37     ` NeilBrown
2017-12-18 18:03   ` Patrick Farrell
2017-12-19 10:37     ` Dilger, Andreas
2017-12-19 20:49       ` NeilBrown
2017-12-18  7:17 ` [PATCH 03/16] staging: lustre: discard cfs_time_seconds() NeilBrown
2017-12-18  7:17 ` [PATCH 04/16] staging: lustre: use wait_event_timeout() where appropriate NeilBrown
2017-12-18 20:23   ` [lustre-devel] " Patrick Farrell
2017-12-18  7:17 ` [PATCH 01/16] staging: lustre: discard SVC_SIGNAL and related functions NeilBrown
2017-12-18  7:18 ` [PATCH 14/16] staging: lustre: use explicit poll loop in ptlrpc_service_unlink_rqbd NeilBrown
2017-12-18  7:18 ` [PATCH 16/16] staging: lustre: remove l_wait_event from ptlrpc_set_wait NeilBrown
2017-12-18  7:18 ` [PATCH 10/16] staging: lustre: remove back_to_sleep() and use loops NeilBrown
2017-12-18  7:18 ` [PATCH 08/16] staging: lustre: open code polling loop instead of using l_wait_event() NeilBrown
2017-12-18 20:55   ` Patrick Farrell [this message]
2017-12-18  7:18 ` [PATCH 12/16] staging: lustre: use wait_event_timeout in ptlrpcd() NeilBrown
2017-12-18  7:18 ` [PATCH 07/16] staging: lustre: simplify waiting in ldlm_completion_ast() NeilBrown
2017-12-18  7:18 ` [PATCH 11/16] staging: lustre: make polling loop in ptlrpc_unregister_bulk more obvious NeilBrown
2017-12-18 21:03   ` [lustre-devel] " Patrick Farrell
2017-12-18  7:18 ` [PATCH 13/16] staging: lustre: improve waiting in sptlrpc_req_refresh_ctx NeilBrown
2017-12-18  7:18 ` [PATCH 09/16] staging: lustre: simplify waiting in ptlrpc_invalidate_import() NeilBrown
2017-12-18  7:18 ` [PATCH 05/16] staging: lustre: introduce and use l_wait_event_abortable() NeilBrown
2017-12-18  7:18 ` [PATCH 15/16] staging: lustre: use explicit poll loop in ptlrpc_unregister_reply NeilBrown
2017-12-18 21:09   ` [lustre-devel] " Patrick Farrell
2017-12-18  7:18 ` [PATCH 06/16] staging: lustre: simplify l_wait_event when intr handler but no timeout NeilBrown

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=D65D86E7.C5E12%paf@cray.com \
    --to=paf@cray.com \
    --cc=andreas.dilger@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.com \
    --cc=oleg.drokin@intel.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