[LU-5397] optimize busy loop waiting in class_cleanup() Created: 23/Jul/14  Updated: 26/Jul/14  Resolved: 26/Jul/14

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.7.0

Type: Bug Priority: Minor
Reporter: Alexander Zarochentsev Assignee: WC Triage
Resolution: Fixed Votes: 0
Labels: patch

Severity: 3
Rank (Obsolete): 15022

 Description   

the following code from class_cleanup():

	/* wait for already-arrived-connections to finish. */
	while (obd->obd_conn_inprogress > 0) {
		spin_unlock(&obd->obd_dev_lock);

		cond_resched();

		spin_lock(&obd->obd_dev_lock);
	}
	spin_unlock(&obd->obd_dev_lock);

contains at least two defects (if not going to substitute busy loop waiting by another more suitable synchronisation mechanism) :

  1. spinlocks are not necessary for atomic access to obd_conn_inprogress field, reading is already atomic.
  2. yield() should be used instead of cond_resched()


 Comments   
Comment by Alexander Zarochentsev [ 23/Jul/14 ]

proposed fix http://review.whamcloud.com/#/c/11198/

Comment by Alexander Zarochentsev [ 23/Jul/14 ]

patch updated to have memory barrier instead of spinlocks.

Comment by Peter Jones [ 26/Jul/14 ]

Landed for 2.7

Generated at Sat Feb 10 01:51:08 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.