diff options
author | James Smart <James.Smart@Emulex.Com> | 2008-06-14 22:52:53 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-07-12 09:22:28 -0400 |
commit | 5e9d9b8276980fc5dfa88ce34f6ec88ce3026232 (patch) | |
tree | 30b495edab629068f929a32f88a66ad705687f34 /drivers/scsi/lpfc/lpfc_init.c | |
parent | 0d2b6b83030d6a88cbf7db57f84f2daf0e0b251b (diff) |
[SCSI] lpfc 8.2.7 : Rework the worker thread
Rework of the worker thread to make it more efficient.
Make a finer-grain notfication of pending work so less time is
spent checking conditions. Also made other general cleanups.
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 6fcddda58512..53cedbafffba 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -551,18 +551,18 @@ static void | |||
551 | lpfc_hb_timeout(unsigned long ptr) | 551 | lpfc_hb_timeout(unsigned long ptr) |
552 | { | 552 | { |
553 | struct lpfc_hba *phba; | 553 | struct lpfc_hba *phba; |
554 | uint32_t tmo_posted; | ||
554 | unsigned long iflag; | 555 | unsigned long iflag; |
555 | 556 | ||
556 | phba = (struct lpfc_hba *)ptr; | 557 | phba = (struct lpfc_hba *)ptr; |
557 | spin_lock_irqsave(&phba->pport->work_port_lock, iflag); | 558 | spin_lock_irqsave(&phba->pport->work_port_lock, iflag); |
558 | if (!(phba->pport->work_port_events & WORKER_HB_TMO)) | 559 | tmo_posted = phba->pport->work_port_events & WORKER_HB_TMO; |
560 | if (!tmo_posted) | ||
559 | phba->pport->work_port_events |= WORKER_HB_TMO; | 561 | phba->pport->work_port_events |= WORKER_HB_TMO; |
560 | spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); | 562 | spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag); |
561 | 563 | ||
562 | spin_lock_irqsave(&phba->hbalock, iflag); | 564 | if (!tmo_posted) |
563 | if (phba->work_wait) | 565 | lpfc_worker_wake_up(phba); |
564 | wake_up(phba->work_wait); | ||
565 | spin_unlock_irqrestore(&phba->hbalock, iflag); | ||
566 | return; | 566 | return; |
567 | } | 567 | } |
568 | 568 | ||
@@ -2104,6 +2104,9 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
2104 | phba->work_ha_mask = (HA_ERATT|HA_MBATT|HA_LATT); | 2104 | phba->work_ha_mask = (HA_ERATT|HA_MBATT|HA_LATT); |
2105 | phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); | 2105 | phba->work_ha_mask |= (HA_RXMASK << (LPFC_ELS_RING * 4)); |
2106 | 2106 | ||
2107 | /* Initialize the wait queue head for the kernel thread */ | ||
2108 | init_waitqueue_head(&phba->work_waitq); | ||
2109 | |||
2107 | /* Startup the kernel thread for this host adapter. */ | 2110 | /* Startup the kernel thread for this host adapter. */ |
2108 | phba->worker_thread = kthread_run(lpfc_do_work, phba, | 2111 | phba->worker_thread = kthread_run(lpfc_do_work, phba, |
2109 | "lpfc_worker_%d", phba->brd_no); | 2112 | "lpfc_worker_%d", phba->brd_no); |