Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp926270rwb; Fri, 23 Sep 2022 06:08:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wSgS6ctZnTsYo2TzsYiYCuajO4/utTsxXlllX9NO0CQqTTVkLGZvBUQ2A8latp55vMNJk X-Received: by 2002:a17:907:a079:b0:770:78cb:6650 with SMTP id ia25-20020a170907a07900b0077078cb6650mr6942409ejc.515.1663938494436; Fri, 23 Sep 2022 06:08:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663938494; cv=none; d=google.com; s=arc-20160816; b=ZZRpMF2AcOJIcbWYkbAfKZeJNq40nK8c2Zl6QixKHb7CtYN9Lozs9YtPnuJ5+HYaxf EM2S5bJHcm9DRD7IKyg2CJ1ObTrPboQbXjssxLy4vXammAY8DGTzUZueEwjBLw+1mY6d SnQ5XGE0D6y/KGXZzO1DNoquPD4WkdtJJX3Hke6UwxG6OeiXSN6NstxSd4oEcdOW0AKX 1we3hlBvqr9PU75sS87p9tKHo49s4eq9jpXwxAYW75fYrvbjdHWuvlFRuPUbu7gxJThK hM8q2FI4Ws4kH/E+FIdRYlje9tAV00cSwgmcwjdVzi2haPoyZwpJZf7liP0K3CBDmyns t0Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=qPrTFJDYkX5KznHl2xyoD41ekYFo8NXtqTZgOOTEgnA=; b=uQpky3q7VWXyDd9cljf/W2SxBU0nf3ufHeDUnGpVzhYCE8DOxKurDQ0cV0I+9pA2Ph VPjRjBlqaNLWHW8NCpy3Cs9676jRVEq8HN65bKA3sMgwo6nRWF56hpcOugiWXwD6T7jB eEhkGkVp1aKOIuM8iDcIDFblZKBayGFmrcJps/zr0yUTtunwYso7aYaR7F+xbmL9RzsT R5n738R5hlZU8JaaGmglBC8UW6UdQHuAd/UpVT1cGf1sbq2Xom+di8CYfDoGNfGDFZf2 NJ669lNr2rEKmoyk6xPDbjAM1lLUWlSXDdR1aGK0PegR752Wlo7lPOWwc0FGttkC/FdI QmBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ka20-20020a170907991400b00780e89aecd1si6849206ejc.849.2022.09.23.06.07.23; Fri, 23 Sep 2022 06:08:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231533AbiIWNGe (ORCPT + 99 others); Fri, 23 Sep 2022 09:06:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbiIWNGe (ORCPT ); Fri, 23 Sep 2022 09:06:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C46B713A38E for ; Fri, 23 Sep 2022 06:06:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 615C861B83 for ; Fri, 23 Sep 2022 13:06:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA256C433C1; Fri, 23 Sep 2022 13:06:31 +0000 (UTC) Subject: [PATCH v1 5/6] xprtrdma: Memory allocation should be allowed to fail during connect From: Chuck Lever To: anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Date: Fri, 23 Sep 2022 09:06:30 -0400 Message-ID: <166393839078.1029362.125219349582981782.stgit@morisot.1015granger.net> In-Reply-To: <166393821144.1029362.9036806277307694311.stgit@morisot.1015granger.net> References: <166393821144.1029362.9036806277307694311.stgit@morisot.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org An attempt to establish a connection can always fail and then be retried. GFP_KERNEL allocation is not necessary here. Like MR allocation, establishing a connection is always done in a worker thread. The new GFP flags align with the flags that would be returned by rpc_task_gfp_mask() in this case. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/verbs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 4a7b87e9e47c..7ca58cb65e27 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -372,7 +372,7 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) struct rpcrdma_ep *ep; int rc; - ep = kzalloc(sizeof(*ep), GFP_KERNEL); + ep = kzalloc(sizeof(*ep), XPRTRDMA_GFP_FLAGS); if (!ep) return -ENOTCONN; ep->re_xprt = &r_xprt->rx_xprt; @@ -605,7 +605,7 @@ static struct rpcrdma_sendctx *rpcrdma_sendctx_create(struct rpcrdma_ep *ep) struct rpcrdma_sendctx *sc; sc = kzalloc(struct_size(sc, sc_sges, ep->re_attr.cap.max_send_sge), - GFP_KERNEL); + XPRTRDMA_GFP_FLAGS); if (!sc) return NULL; @@ -628,7 +628,7 @@ static int rpcrdma_sendctxs_create(struct rpcrdma_xprt *r_xprt) * Sends are posted. */ i = r_xprt->rx_ep->re_max_requests + RPCRDMA_MAX_BC_REQUESTS; - buf->rb_sc_ctxs = kcalloc(i, sizeof(sc), GFP_KERNEL); + buf->rb_sc_ctxs = kcalloc(i, sizeof(sc), XPRTRDMA_GFP_FLAGS); if (!buf->rb_sc_ctxs) return -ENOMEM;