Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3901391pxv; Mon, 19 Jul 2021 11:31:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXb+U9efaJathEizAfKuzGDPSqmLajazhJjEih2P3QJhPtvLk0JlZ9eQBgplP0Puw0bN+Q X-Received: by 2002:a17:906:17c2:: with SMTP id u2mr28638230eje.117.1626719372704; Mon, 19 Jul 2021 11:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626719372; cv=none; d=google.com; s=arc-20160816; b=Tal6SoK86dQJ4MKAp/LaJ/2ggcfB9CYqag/weepvuC9Qrj9kGjSsPCrJdzx5r9+VHv 3WHtbBAWvH2CQzJqIaXwiVb1hN3k7seW5mSLgJFFb3nOAvM/W+8ahipIwOV6R1v9guXv /8dYY8ioubsn/4mmPpNjmPt/2DKOLPOZOP5B7h6EXvWnhQYWrxWSqHCmRq0zG9yjC71r sXzRWzanzo0Knm/oODSgds6VEqXFfu0K8G2L6JNq4vORYD+ZwuDuZQIfWjOBlAJOhS2h K7mDKO5QIbyLzdvp9W303NW12/hWI3T7DYslqTWntEOq0X3BiGOsOKrzUjdJP/DfbHNi IlnA== 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 :message-id:date:subject:cc:to:from; bh=GA3/QiTItt2gpXXvxcGBKid0A8HmwwSQGF+13fq5Q6M=; b=uytBqwB15aNjbzMQy7jkLLW4YQzjWYh8S6Y0EPTpF0JJaHITi6J3pG8Tq5CVD2PZfO 12AzX1vh9di7tusd1y+sbeJDBpnVp0gr0stf4e4pXCNnxHWOZx6Z4evohFZP4an2oSym gS2/1zsxAgb7LrnfbtLsujgnfame5pskoqNlrgMjcPYeiLc7sEpx7Qr7LothT96mchHd vj1n33WemzjGyquD8sOlAXSJtvvgVr/aFTZDSu+2B7gqU5ngQLmG+ZvjXjl78CyyCst/ U8Yr0SBoHIsinECY3Nr3prlsYofuB/oTrJTI8Tqufj+rlJeqb0EeOJXDOMSOiZdeB3qX IN3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si7586864ejx.36.2021.07.19.11.29.08; Mon, 19 Jul 2021 11:29:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382562AbhGSRja (ORCPT + 99 others); Mon, 19 Jul 2021 13:39:30 -0400 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:37373 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348589AbhGSQVp (ORCPT ); Mon, 19 Jul 2021 12:21:45 -0400 Received: from localhost.localdomain ([80.15.159.30]) by mwinf5d82 with ME id X52H2500Q0feRjk0352JKU; Mon, 19 Jul 2021 19:02:19 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 19 Jul 2021 19:02:19 +0200 X-ME-IP: 80.15.159.30 From: Christophe JAILLET To: mustafa.ismail@intel.com, shiraz.saleem@intel.com, dledford@redhat.com, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] RDMA/irdma: Improve the way 'cqp_request' structures are cleaned when they are recycled Date: Mon, 19 Jul 2021 19:02:15 +0200 Message-Id: <7f93f2a2c2fd18ddfeb99339d175b85ffd1c6398.1626713915.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A set of IRDMA_CQP_SW_SQSIZE_2048 (i.e. 2048) 'cqp_request' are pre-allocated and zeroed in 'irdma_create_cqp()' (hw.c). These structures are managed with the 'cqp->cqp_avail_reqs' list which keeps track of available entries. In 'irdma_free_cqp_request()' (utils.c), when an entry is recycled and goes back to the 'cqp_avail_reqs' list, some fields are reseted. However, one of these fields, 'compl_info', is initialized within 'irdma_alloc_and_get_cqp_request()'. Move the corresponding memset to 'irdma_free_cqp_request()' so that the clean-up is done in only one place. This makes the logic more easy to understand. This also saves this memset in the case that the 'cqp_avail_reqs' list is empty and a new 'cqp_request' structure must be allocated. This memset is useless, because the structure is already kzalloc'ed. Signed-off-by: Christophe JAILLET --- drivers/infiniband/hw/irdma/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c index 5bbe44e54f9a..66711024d38b 100644 --- a/drivers/infiniband/hw/irdma/utils.c +++ b/drivers/infiniband/hw/irdma/utils.c @@ -445,7 +445,6 @@ struct irdma_cqp_request *irdma_alloc_and_get_cqp_request(struct irdma_cqp *cqp, cqp_request->waiting = wait; refcount_set(&cqp_request->refcnt, 1); - memset(&cqp_request->compl_info, 0, sizeof(cqp_request->compl_info)); return cqp_request; } @@ -475,6 +474,7 @@ void irdma_free_cqp_request(struct irdma_cqp *cqp, cqp_request->request_done = false; cqp_request->callback_fcn = NULL; cqp_request->waiting = false; + memset(&cqp_request->compl_info, 0, sizeof(cqp_request->compl_info)); spin_lock_irqsave(&cqp->req_lock, flags); list_add_tail(&cqp_request->list, &cqp->cqp_avail_reqs); -- 2.30.2