Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp888161imp; Wed, 20 Feb 2019 10:49:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IZGAICSRG1dOa6dewcnmVwvmpIX95S9zVIvYbDcXmMMZWz09YIWm69e2zhjl7kCBO2xzsz8 X-Received: by 2002:a62:e11a:: with SMTP id q26mr11574408pfh.187.1550688594035; Wed, 20 Feb 2019 10:49:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550688594; cv=none; d=google.com; s=arc-20160816; b=h9oj0wWUilCuP6gQtupZAL2gGdqPnndHpWc0u4W8dkhV6IhHnqM4nM7xjydQ61Zr3K sSUoRUbGKgnKZDftz+IzLovUjupzkPqmrG42kzJQDa1GPAiEPBEXCEVZ8g37vGqe5pcu t2NUWXB9Ha79G6+FAWrRUDmVT8lOXfw4p+RL0zkG8QCEfh4S5Ssm1RvJ+KDx+wI6VsEL J7udPzlVXYu31SRrxuW3rklnOYhive0jRsWamLHypHgzz+vnM6jLj+MSQV74R6eARf4r boUnF2yO+kQ5VqjPRm3eQwCHT4oQniwZsjR67S0mFOIWcDarOlYhzvMa29b4f8kcs4Xv uM+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:cc:to:from; bh=vAKCkTYju+ZGWyibrGC/M3jCyLTvU4bZF2KUctVEyQI=; b=mDyWWOv2JaFeViNJAbkl36y+JBTJ0adxkaEh1U/P9Lr05LncL7yH+GcaWUab9qCSSK oFKMtEaDDMVR5F2UGx4hu7doYvsivv1RJAHSAt+uRq2n1L65E8FVCExbZKgr4/aOMx9R 443pBpxFagxbitORtWoARdfHAYkrKuaKeGZzmMWmkKPcR1IiAnx3Y2DIPAuxQuzpVKiw fT4T5Jl6gPyN2yxsttqFrSHOmUa2IYc6pycG1L11obyDe5sUkltitHdWB7H/Xe93Rl9k yvrIsVfQ6c/D4MvdjV4053+m9sMN+oHlvJunZ7dtUyVxoA74LJ0eW17UHLFUeT6lPrYq qx/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si20000572plo.317.2019.02.20.10.49.37; Wed, 20 Feb 2019 10:49:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726412AbfBTSs6 (ORCPT + 99 others); Wed, 20 Feb 2019 13:48:58 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54602 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbfBTSs5 (ORCPT ); Wed, 20 Feb 2019 13:48:57 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1KIhiaO018243 for ; Wed, 20 Feb 2019 13:48:56 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qsaredby4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 20 Feb 2019 13:48:55 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Feb 2019 18:48:53 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 20 Feb 2019 18:48:50 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1KImm9a25100526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 20 Feb 2019 18:48:49 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B4E84A4059; Wed, 20 Feb 2019 18:48:48 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A1169A4055; Wed, 20 Feb 2019 18:48:48 +0000 (GMT) Received: from t480-pf1aa2c2 (unknown [9.145.51.103]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 20 Feb 2019 18:48:48 +0000 (GMT) Received: from bblock by t480-pf1aa2c2 with local (Exim 4.91) (envelope-from ) id 1gwWvH-0006QO-TC; Wed, 20 Feb 2019 19:48:47 +0100 From: Benjamin Block To: "James E . J . Bottomley" , "Martin K . Petersen" Cc: Benjamin Block , Steffen Maier , linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: replace GFP_ATOMIC with GFP_KERNEL for sdev allocation Date: Wed, 20 Feb 2019 19:48:47 +0100 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19022018-4275-0000-0000-00000311E696 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19022018-4276-0000-0000-0000382017E0 Message-Id: <20190220184847.24640-1-bblock@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-20_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902200129 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We had a test-report where, under memory pressure, adding LUNs to the systems would fail (the tests add LUNs strictly in sequence): [ 5525.853432] scsi 0:0:1:1088045124: Direct-Access IBM 2107900 .148 PQ: 0 ANSI: 5 [ 5525.853826] scsi 0:0:1:1088045124: alua: supports implicit TPGS [ 5525.853830] scsi 0:0:1:1088045124: alua: device naa.6005076303ffd32700000000000044da port group 0 rel port 43 [ 5525.853931] sd 0:0:1:1088045124: Attached scsi generic sg10 type 0 [ 5525.854075] sd 0:0:1:1088045124: [sdk] Disabling DIF Type 1 protection [ 5525.855495] sd 0:0:1:1088045124: [sdk] 2097152 512-byte logical blocks: (1.07 GB/1.00 GiB) [ 5525.855606] sd 0:0:1:1088045124: [sdk] Write Protect is off [ 5525.855609] sd 0:0:1:1088045124: [sdk] Mode Sense: ed 00 00 08 [ 5525.855795] sd 0:0:1:1088045124: [sdk] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 5525.857838] sdk: sdk1 [ 5525.859468] sd 0:0:1:1088045124: [sdk] Attached SCSI disk [ 5525.865073] sd 0:0:1:1088045124: alua: transition timeout set to 60 seconds [ 5525.865078] sd 0:0:1:1088045124: alua: port group 00 state A preferred supports tolusnA [ 5526.015070] sd 0:0:1:1088045124: alua: port group 00 state A preferred supports tolusnA [ 5526.015213] sd 0:0:1:1088045124: alua: port group 00 state A preferred supports tolusnA [ 5526.587439] scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured [ 5526.588562] scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured Looking at the code of scsi_alloc_sdev(), and all the calling contexts, there seems to be no reason to use GFP_ATMOIC here. All the different call-contexts use a mutex at some point, and nothing in between that requires no sleeping, as far as I could see. Additionally, the code that allocates the block queue for the device later (scsi_mq_alloc_queue()) already uses GFP_KERNEL. So replace it, and give the allocation a bit of a better chance to succeed, with more ways of reclaim. Signed-off-by: Benjamin Block --- drivers/scsi/scsi_scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index dd0d516f65e2..e49e6099b852 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -220,7 +220,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, - GFP_ATOMIC); + GFP_KERNEL); if (!sdev) goto out; -- 2.20.1