Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-5397

optimize busy loop waiting in class_cleanup()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.7.0
    • None
    • 3
    • 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()

      Attachments

        Activity

          People

            wc-triage WC Triage
            zam Alexander Zarochentsev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: