lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
	Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 27/29] lustre: various: only use wake_up_all() on exclusive waitqs
Date: Sun, 25 Apr 2021 16:08:34 -0400	[thread overview]
Message-ID: <1619381316-7719-28-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1619381316-7719-1-git-send-email-jsimmons@infradead.org>

From: Mr NeilBrown <neilb@suse.de>

wake_up_all() is not necessary of wait_queues which are not the
subject of an exclusive waiter.  When all waiters are non-exclusive,
wake_up() will wake them all up.

Use of wake_up_all() suggests to the reader that the queue is subject
to exclusive waits.  When that is not the case, the usage can cause
confusion.

So change all wake_up_all() on non-exclusive waitqueues to wake_up().

The only wait_queues on which exclusive waits are requested are:
ws_waitq         ibs_waitq        kss_waitq         ksnd_connd_waitq
blp_waitq        imp_replay_waitq cl_mod_rpcs_waitq cl_cache_waiters
cl_destroy_waitq scp_waitq

All others now only use wake_up().

WC-bug-id: https://jira.whamcloud.com/browse/LU-14352
Lustre-commit: 1f4e9f0f4f483dc9 ("LU-14352 various: only use wake_up_all() on exclusive waitqs")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/41289
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ldlm/ldlm_lock.c       | 6 +++---
 fs/lustre/llite/pcc.c            | 2 +-
 fs/lustre/lov/lov_io.c           | 4 ++--
 fs/lustre/mdc/mdc_changelog.c    | 8 ++++----
 fs/lustre/obdclass/cl_io.c       | 2 +-
 fs/lustre/obdclass/lu_object.c   | 2 +-
 fs/lustre/osc/osc_io.c           | 2 +-
 fs/lustre/osc/osc_page.c         | 6 +++---
 fs/lustre/ptlrpc/sec_bulk.c      | 2 +-
 fs/lustre/ptlrpc/service.c       | 2 +-
 net/lnet/klnds/o2iblnd/o2iblnd.c | 4 ++--
 net/lnet/klnds/socklnd/socklnd.c | 4 ++--
 net/lnet/lnet/peer.c             | 2 +-
 13 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/fs/lustre/ldlm/ldlm_lock.c b/fs/lustre/ldlm/ldlm_lock.c
index c872455..8201e28 100644
--- a/fs/lustre/ldlm/ldlm_lock.c
+++ b/fs/lustre/ldlm/ldlm_lock.c
@@ -1217,7 +1217,7 @@ void ldlm_lock_fail_match_locked(struct ldlm_lock *lock)
 {
 	if ((lock->l_flags & LDLM_FL_FAIL_NOTIFIED) == 0) {
 		lock->l_flags |= LDLM_FL_FAIL_NOTIFIED;
-		wake_up_all(&lock->l_waitq);
+		wake_up(&lock->l_waitq);
 	}
 }
 
@@ -1231,7 +1231,7 @@ void ldlm_lock_fail_match_locked(struct ldlm_lock *lock)
 void ldlm_lock_allow_match_locked(struct ldlm_lock *lock)
 {
 	ldlm_set_lvb_ready(lock);
-	wake_up_all(&lock->l_waitq);
+	wake_up(&lock->l_waitq);
 }
 EXPORT_SYMBOL(ldlm_lock_allow_match_locked);
 
@@ -1752,7 +1752,7 @@ void ldlm_cancel_callback(struct ldlm_lock *lock)
 		}
 		/* only canceller can set bl_done bit */
 		ldlm_set_bl_done(lock);
-		wake_up_all(&lock->l_waitq);
+		wake_up(&lock->l_waitq);
 	} else if (!ldlm_is_bl_done(lock)) {
 		/*
 		 * The lock is guaranteed to have been canceled once
diff --git a/fs/lustre/llite/pcc.c b/fs/lustre/llite/pcc.c
index 297189c9..b259fa5 100644
--- a/fs/lustre/llite/pcc.c
+++ b/fs/lustre/llite/pcc.c
@@ -1566,7 +1566,7 @@ static void pcc_io_fini(struct inode *inode)
 
 	LASSERT(pcci && atomic_read(&pcci->pcci_active_ios) > 0);
 	if (atomic_dec_and_test(&pcci->pcci_active_ios))
-		wake_up_all(&pcci->pcci_waitq);
+		wake_up(&pcci->pcci_waitq);
 }
 
 ssize_t pcc_file_read_iter(struct kiocb *iocb,
diff --git a/fs/lustre/lov/lov_io.c b/fs/lustre/lov/lov_io.c
index 7da0047..1d5ea41 100644
--- a/fs/lustre/lov/lov_io.c
+++ b/fs/lustre/lov/lov_io.c
@@ -651,7 +651,7 @@ static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
 
 	LASSERT(atomic_read(&lov->lo_active_ios) > 0);
 	if (atomic_dec_and_test(&lov->lo_active_ios))
-		wake_up_all(&lov->lo_waitq);
+		wake_up(&lov->lo_waitq);
 }
 
 static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio,
@@ -1674,7 +1674,7 @@ static void lov_empty_io_fini(const struct lu_env *env,
 	struct lov_object *lov = cl2lov(ios->cis_obj);
 
 	if (atomic_dec_and_test(&lov->lo_active_ios))
-		wake_up_all(&lov->lo_waitq);
+		wake_up(&lov->lo_waitq);
 }
 
 static int lov_empty_io_submit(const struct lu_env *env,
diff --git a/fs/lustre/mdc/mdc_changelog.c b/fs/lustre/mdc/mdc_changelog.c
index f671f465..ef6d4f9 100644
--- a/fs/lustre/mdc/mdc_changelog.c
+++ b/fs/lustre/mdc/mdc_changelog.c
@@ -256,7 +256,7 @@ static int chlg_read_cat_process_cb(const struct lu_env *env,
 	crs->crs_rec_count++;
 	mutex_unlock(&crs->crs_lock);
 
-	wake_up_all(&crs->crs_waitq_cons);
+	wake_up(&crs->crs_waitq_cons);
 
 	return 0;
 }
@@ -347,7 +347,7 @@ static int chlg_load(void *args)
 	if (rc < 0)
 		crs->crs_err = rc;
 
-	wake_up_all(&crs->crs_waitq_cons);
+	wake_up(&crs->crs_waitq_cons);
 
 	if (llh)
 		llog_cat_close(NULL, llh);
@@ -420,7 +420,7 @@ static ssize_t chlg_read(struct file *file, char __user *buff, size_t count,
 
 	if (written_total > 0) {
 		rc = written_total;
-		wake_up_all(&crs->crs_waitq_prod);
+		wake_up(&crs->crs_waitq_prod);
 	} else if (rc == 0) {
 		rc = crs->crs_err;
 	}
@@ -464,7 +464,7 @@ static int chlg_set_start_offset(struct chlg_reader_state *crs, u64 offset)
 	}
 
 	mutex_unlock(&crs->crs_lock);
-	wake_up_all(&crs->crs_waitq_prod);
+	wake_up(&crs->crs_waitq_prod);
 	return 0;
 }
 
diff --git a/fs/lustre/obdclass/cl_io.c b/fs/lustre/obdclass/cl_io.c
index 27804d3..ca4d387 100644
--- a/fs/lustre/obdclass/cl_io.c
+++ b/fs/lustre/obdclass/cl_io.c
@@ -1187,7 +1187,7 @@ void cl_sync_io_note(const struct lu_env *env, struct cl_sync_io *anchor,
 		 * the wakeup ensures cl_sync_io_wait() doesn't complete
 		 * before the wakeup completes.
 		 */
-		wake_up_all_locked(&anchor->csi_waitq);
+		wake_up_locked(&anchor->csi_waitq);
 		if (end_io)
 			end_io(env, anchor);
 		if (anchor->csi_aio)
diff --git a/fs/lustre/obdclass/lu_object.c b/fs/lustre/obdclass/lu_object.c
index fcf0739..419cb74 100644
--- a/fs/lustre/obdclass/lu_object.c
+++ b/fs/lustre/obdclass/lu_object.c
@@ -398,7 +398,7 @@ static void lu_object_free(const struct lu_env *env, struct lu_object *o)
 	}
 
 	if (waitqueue_active(wq))
-		wake_up_all(wq);
+		wake_up(wq);
 }
 
 /**
diff --git a/fs/lustre/osc/osc_io.c b/fs/lustre/osc/osc_io.c
index 3be3cfe..ce64cf8 100644
--- a/fs/lustre/osc/osc_io.c
+++ b/fs/lustre/osc/osc_io.c
@@ -437,7 +437,7 @@ void osc_io_iter_fini(const struct lu_env *env,
 		oio->oi_is_active = 0;
 		LASSERT(atomic_read(&osc->oo_nr_ios) > 0);
 		if (atomic_dec_and_test(&osc->oo_nr_ios))
-			wake_up_all(&osc->oo_io_waitq);
+			wake_up(&osc->oo_io_waitq);
 	}
 }
 EXPORT_SYMBOL(osc_io_iter_fini);
diff --git a/fs/lustre/osc/osc_page.c b/fs/lustre/osc/osc_page.c
index c59a5ac..8b25329a 100644
--- a/fs/lustre/osc/osc_page.c
+++ b/fs/lustre/osc/osc_page.c
@@ -679,7 +679,7 @@ long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli,
 	atomic_dec(&cli->cl_lru_shrinkers);
 	if (count > 0) {
 		atomic_long_add(count, cli->cl_lru_left);
-		wake_up_all(&osc_lru_waitq);
+		wake_up(&osc_lru_waitq);
 	}
 	return count > 0 ? count : rc;
 }
@@ -890,7 +890,7 @@ unsigned long osc_lru_reserve(struct client_obd *cli, unsigned long npages)
 void osc_lru_unreserve(struct client_obd *cli, unsigned long npages)
 {
 	atomic_long_add(npages, cli->cl_lru_left);
-	wake_up_all(&osc_lru_waitq);
+	wake_up(&osc_lru_waitq);
 }
 
 /**
@@ -987,7 +987,7 @@ void osc_dec_unstable_pages(struct ptlrpc_request *req)
 						&cli->cl_cache->ccc_unstable_nr);
 	LASSERT(unstable_count >= 0);
 	if (!unstable_count)
-		wake_up_all(&cli->cl_cache->ccc_unstable_waitq);
+		wake_up(&cli->cl_cache->ccc_unstable_waitq);
 
 	if (waitqueue_active(&osc_lru_waitq))
 		(void)ptlrpcd_queue_work(cli->cl_lru_work);
diff --git a/fs/lustre/ptlrpc/sec_bulk.c b/fs/lustre/ptlrpc/sec_bulk.c
index 9548721..ef127b8 100644
--- a/fs/lustre/ptlrpc/sec_bulk.c
+++ b/fs/lustre/ptlrpc/sec_bulk.c
@@ -304,7 +304,7 @@ static inline void enc_pools_wakeup(void)
 
 	if (unlikely(page_pools.epp_waitqlen)) {
 		LASSERT(waitqueue_active(&page_pools.epp_waitq));
-		wake_up_all(&page_pools.epp_waitq);
+		wake_up(&page_pools.epp_waitq);
 	}
 }
 
diff --git a/fs/lustre/ptlrpc/service.c b/fs/lustre/ptlrpc/service.c
index 070eecc..1057892 100644
--- a/fs/lustre/ptlrpc/service.c
+++ b/fs/lustre/ptlrpc/service.c
@@ -2465,7 +2465,7 @@ static void ptlrpc_stop_hr_threads(void)
 		if (!hrp->hrp_thrs)
 			continue; /* uninitialized */
 		for (j = 0; j < hrp->hrp_nthrs; j++)
-			wake_up_all(&hrp->hrp_thrs[j].hrt_waitq);
+			wake_up(&hrp->hrp_thrs[j].hrt_waitq);
 	}
 
 	cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) {
diff --git a/net/lnet/klnds/o2iblnd/o2iblnd.c b/net/lnet/klnds/o2iblnd/o2iblnd.c
index 782e29b..0c43969 100644
--- a/net/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/net/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2520,8 +2520,8 @@ static void kiblnd_base_shutdown(void)
 		cfs_percpt_for_each(sched, i, kiblnd_data.kib_scheds)
 			wake_up_all(&sched->ibs_waitq);
 
-		wake_up_all(&kiblnd_data.kib_connd_waitq);
-		wake_up_all(&kiblnd_data.kib_failover_waitq);
+		wake_up(&kiblnd_data.kib_connd_waitq);
+		wake_up(&kiblnd_data.kib_failover_waitq);
 
 		wait_var_event_warning(&kiblnd_data.kib_nthreads,
 				       !atomic_read(&kiblnd_data.kib_nthreads),
diff --git a/net/lnet/klnds/socklnd/socklnd.c b/net/lnet/klnds/socklnd/socklnd.c
index 141da88..54c5e2c 100644
--- a/net/lnet/klnds/socklnd/socklnd.c
+++ b/net/lnet/klnds/socklnd/socklnd.c
@@ -1799,12 +1799,12 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id)
 		/* flag threads to terminate; wake and wait for them to die */
 		ksocknal_data.ksnd_shuttingdown = 1;
 		wake_up_all(&ksocknal_data.ksnd_connd_waitq);
-		wake_up_all(&ksocknal_data.ksnd_reaper_waitq);
+		wake_up(&ksocknal_data.ksnd_reaper_waitq);
 
 		if (ksocknal_data.ksnd_schedulers) {
 			cfs_percpt_for_each(sched, i,
 					    ksocknal_data.ksnd_schedulers)
-					wake_up_all(&sched->kss_waitq);
+					    wake_up_all(&sched->kss_waitq);
 		}
 
 		wait_var_event_warning(&ksocknal_data.ksnd_nthreads,
diff --git a/net/lnet/lnet/peer.c b/net/lnet/lnet/peer.c
index c833e34..36e52df 100644
--- a/net/lnet/lnet/peer.c
+++ b/net/lnet/lnet/peer.c
@@ -2131,7 +2131,7 @@ static void lnet_peer_discovery_complete(struct lnet_peer *lp)
 	spin_lock(&lp->lp_lock);
 	list_splice_init(&lp->lp_dc_pendq, &pending_msgs);
 	spin_unlock(&lp->lp_lock);
-	wake_up_all(&lp->lp_dc_waitq);
+	wake_up(&lp->lp_dc_waitq);
 
 	if (lp->lp_rtr_refcount > 0)
 		lnet_router_discovery_complete(lp);
-- 
1.8.3.1

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

  parent reply	other threads:[~2021-04-25 20:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25 20:08 [lustre-devel] [PATCH 00/29] lustre: Update to OpenSFS tree as of April 25, 2020 James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 01/29] lnet: socklnd: use sockaddr instead of u32 addresses James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 02/29] lnet: allow creation of IPv6 socket James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 03/29] lnet: allow lnet_connect() to use IPv6 addresses James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 04/29] lnet: handle possiblity of IPv6 being unavailable James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 05/29] lnet: socklnd: remove tcp bonding James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 06/29] lnet: socklnd: replace route construct James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 07/29] lustre: readahead: limit over reservation James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 08/29] lustre: clio: fix hang on urgent cached pages James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 09/29] lustre: uapi: add mdt_hash_name James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 10/29] lustre: mdc: set fid2path RPC interruptible James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 11/29] lustre: include: remove references to Sun Trademark James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 12/29] lnet: o2iblnd: Use REMOTE_DROPPED for ECONNREFUSED James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 13/29] lustre: lmv: reduce struct lmv_obd size James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 14/29] lustre: uapi: remove obsolete ioctls James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 15/29] lustre: lmv: don't include struct lu_qos_rr in client James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 16/29] lnet: libcfs: fix setting of debug_path James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 17/29] lnet: Use lr_hops for avoid_asym_router_failure James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 18/29] lnet: Leverage peer aliveness more efficiently James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 19/29] lustre: mdt: mkdir should return -EEXIST if exists James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 20/29] lnet: o2iblnd: don't resend if there's no listener James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 21/29] lnet: obi2lnd: don't try to reconnect " James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 22/29] lustre: osc: fall back to vmalloc for large RPCs James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 23/29] lustre: ldlm: discard l_lock from struct ldlm_lock James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 24/29] lustre: llite: do fallocate() size checks under lock James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 25/29] lustre: misc: limit CDEBUG console message frequency James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 26/29] lustre: fallocate: Add punch mode to fallocate James Simmons
2021-04-25 20:08 ` James Simmons [this message]
2021-04-25 20:08 ` [lustre-devel] [PATCH 28/29] lnet: remove references to Sun Trademark James Simmons
2021-04-25 20:08 ` [lustre-devel] [PATCH 29/29] lustre: " James Simmons

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=1619381316-7719-28-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=green@whamcloud.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.de \
    --subject='Re: [lustre-devel] [PATCH 27/29] lustre: various: only use wake_up_all() on exclusive waitqs' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).