Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3090030rwb; Mon, 15 Aug 2022 17:53:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR6dUhFDBWBFFuGu43u65Q6pmTnqOKrBLhpbUhmms71pLOCaq9vVGbAQxum5yYWzbIApakZ0 X-Received: by 2002:a05:6402:35c:b0:43c:8f51:130 with SMTP id r28-20020a056402035c00b0043c8f510130mr16521498edw.393.1660611186976; Mon, 15 Aug 2022 17:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611186; cv=none; d=google.com; s=arc-20160816; b=KAziUzSwK9QuduLJ4IRGaIeZFbKt3K9/PxEtXp+flRKEuJqPzA8UWpSzzz+zu1jaJW BIkYJY5HF+9K/biXcSdHTCoEJLrAiSi6Hy3bbrqK3ap/B9caoDNt9ZQx4DHtSrXn04NL IA0it18JJDcuVKf1W2oFUA5tKUsciY4L5g6gWNH3d42vsIEq5V83Nqtpy43HW63dRw9J +zOkdQFUe0ppbUKOA/uohJtjhWLEHxiYkav4GJDaWkmUBccPRIOBO6dbxjDcwY3rzq12 zmkqQselddbTOXcfA+FGh1K1aoIbDFVpEjtHcQ1qh5/8zBR4th9iCjeAVZGFW2+6L9Gl DW0A== 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=QvUb86x0C8GF/Vs1yW1sss12lamn/WqnKpX0VzOml6CuaLRhvkOnvq4dnwnDKXxRtu m8uAU6qAbKkNimBMYPgiMOOtdzHoLm7XA7zVjZWy2jqs9rbNXbCNBLP00iPbelO/Kvhm SW+Vn4xyic2DqJdEgazYnfGD0mT8VDAqch9ioflWB3CJnqkNiCd1JH+LLIHiUUjUdQmq Fms9jPk1jbBQaf7N7g3DYuBCn4Sj163JQxAdHhi/R+O27E+WEou+klUmwdunBXcst0zY TMNeWtgY7pxjfr096mxAwa84RPQ0XdOjqSUwFbv4ZiqHNKYBojXN+VQ5lHh7iKKC9jgL 98Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A+A6i+uW; 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 f5-20020a056402194500b00443e3fe7ca2si1697109edz.263.2022.08.15.17.52.41; Mon, 15 Aug 2022 17:53:06 -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=A+A6i+uW; 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 S1354694AbiHOXtb (ORCPT + 99 others); Mon, 15 Aug 2022 19:49:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354152AbiHOXnk (ORCPT ); Mon, 15 Aug 2022 19:43:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A8EA8688C; Mon, 15 Aug 2022 13:13:58 -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 sin.source.kernel.org (Postfix) with ESMTPS id 1EAC0CE12C5; Mon, 15 Aug 2022 20:13:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE059C433D6; Mon, 15 Aug 2022 20:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594434; bh=HPQ3uqaqAfVf4S6PuzQ/p3Xy42uW6oBrQE6d2Cc8B6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A+A6i+uW4cNheT+2uiJ4SP4aJjYwdGX2IO/0viOOcwWnE2mfGRulsy8Nmxk595nb6 poRvT3fF+FH+C+JYUqaQwFKEwZcBaOfFGWn89ST6oK1Amc968MCARCggsJPQYKBlFo qlaG2ySYGs6i/gwSfm22NSFTdJmIFFkOJ13LFWDo= 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.18 1082/1095] mptcp: refine memory scheduling Date: Mon, 15 Aug 2022 20:08:01 +0200 Message-Id: <20220815180513.787011365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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;