Re: [PATCH 4/4] target: re-use the command S/G list for single-task commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2011-10-18 at 06:57 -0400, Christoph Hellwig wrote:
> plain text document attachment (target-optimize-single-sgls)
> If we only have a single task per command (which at least in my testing
> is the by far most common case) we do not have to allocate a new per-task
> S/G list but can reuse the one from the command.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> 

A very nice optimization for the single task case, but you would be
surprised how many uber fast flash backends end up using max_sectors=128
and use task_count > 1 for normal large block operation..   :)

> Index: lio-core/drivers/target/target_core_transport.c
> ===================================================================
> --- lio-core.orig/drivers/target/target_core_transport.c	2011-10-18 12:28:49.444351865 +0200
> +++ lio-core/drivers/target/target_core_transport.c	2011-10-18 12:28:53.465359432 +0200
> @@ -3531,7 +3531,8 @@ static void transport_free_dev_tasks(str
>  		 */
>  		del_timer_sync(&task->task_timer);
>  
> -		kfree(task->task_sg);
> +		if (task->task_sg != cmd->t_data_sg)
> +			kfree(task->task_sg);
>  
>  		list_del(&task->t_list);
>  

Folding in the following change to your original patch to address a
double memory free with BIDI operation.

Thanks Christoph!

--nab

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index dd49f44..467e9f43 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -3553,7 +3553,8 @@ static void transport_free_dev_tasks(struct se_cmd *cmd)
                 */
                del_timer_sync(&task->task_timer);
 
-               if (task->task_sg != cmd->t_data_sg)
+               if (task->task_sg != cmd->t_data_sg &&
+                   task->task_sg != cmd->t_bidi_data_sg)
                        kfree(task->task_sg);
 
                list_del(&task->t_list);


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux