From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D86F119E825; Thu, 15 Aug 2024 13:28:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723728496; cv=none; b=fcP/qqTQ/5wV5LcmO3HWMTOx8ymwRo4SzNeJYFNClI01U8C5E6AqJCTPZEwxVygrK8LJUzyPdalwdVc5ghkyH1VrNXemmbyiem5MBPZs366AUtVO19wSdR7ZdAGVt/Klv+IaR6NJG51zC7pwRZyfvWI40EgnP8xrjWQYdtzw6ys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723728496; c=relaxed/simple; bh=VFu/EBzrLRQ7bApp6xjLzV7Waq7KoTr985HxSAVBxS4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=abLPPepcStFeeiDxxP+v7Yfz5WWMKkycjojkyyxs6+ZBReBD7rOYuU3CGi6MPtbNW1YqgnSoPW2u2Pnk7TFN2NRPuS6YxHjPfFJIFlvb30d9YaIQ0LRX/Ag/cTvck+Dxih4+ztyvgCEjMF/oMWbz9UIxlJOyjSB0fa7CdI5SqS0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qkkda+9e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="qkkda+9e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27E54C32786; Thu, 15 Aug 2024 13:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723728496; bh=VFu/EBzrLRQ7bApp6xjLzV7Waq7KoTr985HxSAVBxS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qkkda+9eVXWCW8FDCybURhBSMWuU5WlO3lYpRyNZW3F72cSTCzWVeMsiP54zV0xDD tugkrBtUcx4iWRVhrA/7Sj5OJj3Dg1GUQFP50XMsKdAm3hqshd5TmdBlzU26B2CJN/ lroLRIFC/ZEFA8SsW1EVBzitJtKRVEZo5rigWFPY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guangguan Wang , Wen Gu , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 019/196] net/smc: set rmbs SG_MAX_SINGLE_ALLOC limitation only when CONFIG_ARCH_NO_SG_CHAIN is defined Date: Thu, 15 Aug 2024 15:22:16 +0200 Message-ID: <20240815131852.813292256@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240815131852.063866671@linuxfoundation.org> References: <20240815131852.063866671@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guangguan Wang [ Upstream commit 3ac14b9dfbd345e891d48d89f6c2fa519848f0f4 ] SG_MAX_SINGLE_ALLOC is used to limit maximum number of entries that will be allocated in one piece of scatterlist. When the entries of scatterlist exceeds SG_MAX_SINGLE_ALLOC, sg chain will be used. From commit 7c703e54cc71 ("arch: switch the default on ARCH_HAS_SG_CHAIN"), we can know that the macro CONFIG_ARCH_NO_SG_CHAIN is used to identify whether sg chain is supported. So, SMC-R's rmb buffer should be limited by SG_MAX_SINGLE_ALLOC only when the macro CONFIG_ARCH_NO_SG_CHAIN is defined. Fixes: a3fe3d01bd0d ("net/smc: introduce sg-logic for RMBs") Signed-off-by: Guangguan Wang Co-developed-by: Wen Gu Signed-off-by: Wen Gu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/smc/smc_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 691c1d9c4c560..6c19cc805abc1 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -666,7 +666,6 @@ int smc_conn_create(struct smc_sock *smc, bool is_smcd, int srv_first_contact, */ static u8 smc_compress_bufsize(int size, bool is_smcd, bool is_rmb) { - const unsigned int max_scat = SG_MAX_SINGLE_ALLOC * PAGE_SIZE; u8 compressed; if (size <= SMC_BUF_MIN_SIZE) @@ -676,9 +675,11 @@ static u8 smc_compress_bufsize(int size, bool is_smcd, bool is_rmb) compressed = min_t(u8, ilog2(size) + 1, is_smcd ? SMCD_DMBE_SIZES : SMCR_RMBE_SIZES); +#ifdef CONFIG_ARCH_NO_SG_CHAIN if (!is_smcd && is_rmb) /* RMBs are backed by & limited to max size of scatterlists */ - compressed = min_t(u8, compressed, ilog2(max_scat >> 14)); + compressed = min_t(u8, compressed, ilog2((SG_MAX_SINGLE_ALLOC * PAGE_SIZE) >> 14)); +#endif return compressed; } -- 2.43.0