Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: John Garry <john.garry@linux.dev>
To: Bart Van Assche <bvanassche@acm.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Hannes Reinecke <hare@kernel.org>
Subject: Re: [PATCH] scsi: core: Micro-optimize the hot path
Date: Mon, 28 Sep 2026 09:58:48 +0100	[thread overview]
Message-ID: <a7faf316-b2a0-4c82-98bd-157fe3187cc5@linux.dev> (raw)
In-Reply-To: <1ac0d4d0c06e55943e188d0dee9b6f2475715f21.1790359761.git.bvanassche@acm.org>

On 9/25/26 19:09, Bart Van Assche wrote:

nit: I think that the subject can be more specific, like "don't 
unnecessarily init scmd->eh_entry"

> Every code path that inserts scmd->eh_entry into a list uses
> list_add_tail() (see also scsi_abort_command() and scsi_eh_scmd_add()).
> list_add_tail() overwrites the next and prev pointers. Hence, the only
> code that depends on the initialization of scmd->eh_entry is the
> BUG_ON(!list_empty(&scmd->eh_entry)) statement in scsi_abort_command().
> Remove this statement because scsi_timeout() already prevents
> scsi_abort_command() from being called twice for the same command by
> setting SCMD_STATE_COMPLETE. Remove the scmd->eh_entry initialization
> because the only statement that relied on this initialization has been
> removed.
> 
> Cc: John Garry <john.garry@linux.dev>
> Cc: Hannes Reinecke <hare@kernel.org>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Seems fine, so:
Reviewed-by: John Garry <john.garry@linux.dev>

> ---
>   drivers/scsi/scsi_error.c | 1 -
>   drivers/scsi/scsi_lib.c   | 3 ---
>   2 files changed, 4 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 2e0b1909dc69..75442d60c30e 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -270,7 +270,6 @@ scsi_abort_command(struct scsi_cmnd *scmd)
>   	spin_lock_irqsave(&shost->host_lock, flags);
>   	if (shost->eh_deadline != -1 && !shost->last_reset)
>   		shost->last_reset = jiffies;
> -	BUG_ON(!list_empty(&scmd->eh_entry));
>   	list_add_tail(&scmd->eh_entry, &shost->eh_abort_list);
>   	spin_unlock_irqrestore(&shost->host_lock, flags);
>   
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index db64470f5229..f695a6605815 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1322,7 +1322,6 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
>   	}
>   
>   	cmd->device = dev;
> -	INIT_LIST_HEAD(&cmd->eh_entry);
>   	INIT_DELAYED_WORK(&cmd->abort_work, scmd_eh_abort_handler);
>   }
>   
> @@ -1590,8 +1589,6 @@ static void scsi_complete(struct request *rq)
>   		return;
>   	}
>   
> -	INIT_LIST_HEAD(&cmd->eh_entry);
> -
>   	atomic_inc(&cmd->device->iodone_cnt);
>   	if (cmd->result)
>   		atomic_inc(&cmd->device->ioerr_cnt);


  reply	other threads:[~2026-09-28  8:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 18:09 [PATCH] scsi: core: Micro-optimize the hot path Bart Van Assche
2026-09-28  8:58 ` John Garry [this message]
2026-10-03  9:16 ` Hannes Reinecke
2026-10-03 13:49 ` Martin K. Petersen (Oracle)

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=a7faf316-b2a0-4c82-98bd-157fe3187cc5@linux.dev \
    --to=john.garry@linux.dev \
    --cc=bvanassche@acm.org \
    --cc=hare@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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