Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3124046rwb; Mon, 15 Aug 2022 18:43:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR5LZgj0aSwAp17O9XEjSZKd8M7FAUlTdKdEeTmAdFnfqaEJJrkD7bnue7XwxJuI+rujR1Ti X-Received: by 2002:a05:6402:ea1:b0:443:d90a:5d31 with SMTP id h33-20020a0564020ea100b00443d90a5d31mr4770651eda.121.1660614210442; Mon, 15 Aug 2022 18:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614210; cv=none; d=google.com; s=arc-20160816; b=hUpIBLeN/TdigB3HmEOsLFymvL7ypBq4znuwnqLCwuLeioEjgLs1ihdbVvsQh5G0xP FZ7mRYZdsHRSbf62eQ9uDaoriaNWV1w6wpQLKPVVjdCxmVUJG/HFhtUQv2dM1R8LkYZe AABhpuLmOV1Ys3+wapvVcZAYFMXpLfnees6hFgevAWuDa04cLN+IFgOCO93vKcLxAtbJ E2jcvoNCx9Axg5E6Uz66nfZyrh9uLoQZGObgH1Q8ieJVhzfleUOUf2SiA96bjR7A2LJG tR7807G1jFygIgHJEeqiRMB0cEPPtlwzaBpJmwGQtfS0R6ilxjJAMgJLGWRApZsRyqpj MUhg== 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:subject:cc:to :from:dkim-signature; bh=a+oeBF7XU6l+hLbbfEy0wYhkNmUq8KmR3tPG9HveaCY=; b=WFe8ZpeijWip/Uq72b+HonXrtrEEQm+OTceQUkOF597LC/TPLgBqOm73n29FGml+BT eRw/xADtgndtwPKugHicqmskR5Fx/tH9K1btTPKeKjYgP04xU6+QY8e9Gt/lMIl5zeXN 5IvORAC/XygMi98WZ6rp3qB2YfukHFOcTxMYVpC4mhkigJBIGMT5lYq6ZHtGeSTFbKL9 cpccFP/isYNj07CeSDsAe8aL0zSj2OOqCtWucmoZdVG/jz+8KzXnGd7sJQsQ2TRWMX3B FYF8/nin/yIDhj5vgaiQKW13OXAOnYt+muB6l36jiFF2+S8ndwfkwp8fIIQr1ReBADIL 32mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vbShbruy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd17-20020a170907969100b0073156b6fe1csi9617211ejc.799.2022.08.15.18.43.05; Mon, 15 Aug 2022 18:43:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vbShbruy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344997AbiHPBHb (ORCPT + 99 others); Mon, 15 Aug 2022 21:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348546AbiHPBCS (ORCPT ); Mon, 15 Aug 2022 21:02:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDEAEB9FA7; Mon, 15 Aug 2022 13:50:53 -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 ams.source.kernel.org (Postfix) with ESMTPS id 26A31B811AB; Mon, 15 Aug 2022 20:50:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84FC4C433C1; Mon, 15 Aug 2022 20:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596650; bh=HPQ3uqaqAfVf4S6PuzQ/p3Xy42uW6oBrQE6d2Cc8B6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vbShbruym06Wk/ce8Td1N2yLBewE+rD5hhY5IAff2thIaIPh/Jbi9OQAYJzJUeFlU XL+7ZXR2SdaevIiyu5qPYZascLN+1Tpcr8mVM4lRvRQI9FUvfg/Bdf6kqOIHmzIy8Y iaZFszlHUqCNHdO7q4Lz6SX0fT8x9nNcNNYT+CUc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Mat Martineau , "David S. Miller" Subject: [PATCH 5.19 1146/1157] mptcp: refine memory scheduling Date: Mon, 15 Aug 2022 20:08:22 +0200 Message-Id: <20220815180526.349759462@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org From: Paolo Abeni commit 69d93daec026cdda98e29e8edb12534bfa5b1a9b upstream. Similar to commit 7c80b038d23e ("net: fix sk_wmem_schedule() and sk_rmem_schedule() errors"), let the MPTCP receive path schedule exactly the required amount of memory. Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/mptcp/protocol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -323,9 +323,10 @@ static bool mptcp_rmem_schedule(struct s struct mptcp_sock *msk = mptcp_sk(sk); int amt, amount; - if (size < msk->rmem_fwd_alloc) + if (size <= msk->rmem_fwd_alloc) return true; + size -= msk->rmem_fwd_alloc; amt = sk_mem_pages(size); amount = amt << SK_MEM_QUANTUM_SHIFT; msk->rmem_fwd_alloc += amount;