From patchwork Tue Jun 4 08:23:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 10974421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9821E13AD for ; Tue, 4 Jun 2019 08:23:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B306285FD for ; Tue, 4 Jun 2019 08:23:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F828285D5; Tue, 4 Jun 2019 08:23:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15420285FD for ; Tue, 4 Jun 2019 08:23:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726867AbfFDIXc (ORCPT ); Tue, 4 Jun 2019 04:23:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54960 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726795AbfFDIXc (ORCPT ); Tue, 4 Jun 2019 04:23:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84623368E3; Tue, 4 Jun 2019 08:23:32 +0000 (UTC) Received: from localhost (ovpn-8-18.pek2.redhat.com [10.72.8.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2051160570; Tue, 4 Jun 2019 08:23:26 +0000 (UTC) From: Ming Lei To: linux-scsi@vger.kernel.org, "Martin K . Petersen" Cc: James Bottomley , Ming Lei , Christoph Hellwig , Bart Van Assche , "Ewan D . Milne" , Hannes Reinecke , Guenter Roeck Subject: [PATCH 1/2] scsi: core: don't pre-allocate small SGL in case of NO_SG_CHAIN Date: Tue, 4 Jun 2019 16:23:07 +0800 Message-Id: <20190604082308.5575-2-ming.lei@redhat.com> In-Reply-To: <20190604082308.5575-1-ming.lei@redhat.com> References: <20190604082308.5575-1-ming.lei@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 04 Jun 2019 08:23:32 +0000 (UTC) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The pre-allocated small SGL depends on SG_CHAIN, so if the ARCH doesn't support SG_CHAIN, pre-allocation of small SGL can't work at all. Fixes this issue by not using small pre-allocation in case of NO_SG_CHAIN. Cc: Christoph Hellwig Cc: Bart Van Assche Cc: Ewan D. Milne Cc: Hannes Reinecke Cc: Guenter Roeck Fixes: c3288dd8c232 ("scsi: core: avoid pre-allocating big SGL for data") Reported-by: Guenter Roeck Signed-off-by: Ming Lei Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6e81258471fa..9ef632963740 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -44,9 +44,13 @@ * Size of integrity metadata is usually small, 1 inline sg should * cover normal cases. */ +#ifndef CONFIG_ARCH_NO_SG_CHAIN #define SCSI_INLINE_PROT_SG_CNT 1 - #define SCSI_INLINE_SG_CNT 2 +#else +#define SCSI_INLINE_PROT_SG_CNT 0 +#define SCSI_INLINE_SG_CNT 0 +#endif static struct kmem_cache *scsi_sdb_cache; static struct kmem_cache *scsi_sense_cache;