From nobody Sun Feb 8 12:19:18 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:7824:0:0:0:0:0 with SMTP id p36csp427567jac; Fri, 15 Oct 2021 08:40:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzShDGy3cTkPJ+tdf+RcXiRQDZM5mjdHp1GhMzY/sJNjCpaa7+LPnqssYq9nknQku2l0HXC X-Received: by 2002:a05:6a00:2306:b0:44c:6d97:5a5e with SMTP id h6-20020a056a00230600b0044c6d975a5emr12122537pfh.84.1634312449597; Fri, 15 Oct 2021 08:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634312449; cv=none; d=google.com; s=arc-20160816; b=XlQzQtNa8B9GOQKpO/pd79aTTNp6LAEn6AJIcP0BHzT2x8MGvSyNqYfPIa6ov/oG77 t54ovKoEV8xmw5Rwwh29p9Gw9P/BLbNbtBmaynw7XTaKB1Tdto5fPN5MB+JnwYFKnwAH 4N3WxnoF6E3DszG2SMVUuEV40Sm1joMjRkLQ33J514OJOPrRirpwegjZEdGyciETLOBJ YeIyj16PPFgSHPoZhHWNQ9FnWs1lFmVYQ1qLmhLZjccRrkJztxL+kgezEwFENBYywgty SEGDvRKPW/wXOQnNFOgU/o5XceOEEMlK76GvfCvqtNLovRcBaS0Nc+qsccnfOX+IsL7q F0Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=1egjQgvve1wj1U6ZexQM4//Hlh3iOTX1wIEtAwnp8o0=; b=vCYgezMe/Uaqf/jRxR7rUvm/wp1jJvGDE34oWtPI2RwShsTL4WJc19ZEHMbkURBQuB n9OxA1BWRHdUW2skMn6qJlRM0vm/yr4gr5jQAFtg90wlccobD2G8W1MQ0QblyYZUdEpX 5Ws5d49QYfwuhYmZqKc3cxfQ6XqC2TlYaARI4w3GXKWy9Sh3+M5Tw5i0nYvv9ToduvgR widQnxNZiPiqo6SxGnisw2+rype43BI85PDezpWXkPrxWhkCPm702S+zTbtLpmed4Yc0 ay2lCkGP0oNrQgXpbXNbxuYMo+p8rpWDYZWbqMnaw6585F6UvLCfHjjEPq1780VR6kXe t3Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OdtjLLwy; spf=pass (google.com: domain of mptcp+bounces-2169-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2169-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id y126si8060432pfb.277.2021.10.15.08.40.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Oct 2021 08:40:49 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-2169-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OdtjLLwy; spf=pass (google.com: domain of mptcp+bounces-2169-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2169-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ewr.edge.kernel.org (Postfix) with ESMTPS id C714B1C0F5D for ; Fri, 15 Oct 2021 15:40:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3A142C81; Fri, 15 Oct 2021 15:40:43 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 9A0BD29CA for ; Fri, 15 Oct 2021 15:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634312441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1egjQgvve1wj1U6ZexQM4//Hlh3iOTX1wIEtAwnp8o0=; b=OdtjLLwytzDisVpsQ4/OAk2npz8wvO3XR1SLSWAUqBJ4wKHZeOCgUvfZwby2FFfW9uPWwZ EBqEdd50G8BCMJ8Qvwqu8FpYdXAg/zV6MzqlAjrViXpTbqad0+ZKKpCRvssgbS3oWnpviF u/WEScea7AcBdQhIvkA5c0FuD3zWIeI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-548-yuEhtIX-NIuFVIY-9twvOw-1; Fri, 15 Oct 2021 11:40:40 -0400 X-MC-Unique: yuEhtIX-NIuFVIY-9twvOw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA2F8801AFC for ; Fri, 15 Oct 2021 15:40:39 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30B07ADD7 for ; Fri, 15 Oct 2021 15:40:38 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-next v2 1/3] tcp: define macros for a couple reclaim thresholds Date: Fri, 15 Oct 2021 17:39:37 +0200 Message-Id: <0d3f747f3a1dcdc67e71fc93cc1d64eee9e6b803.1634312286.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A following patch is going to implment for the MPTCP protocol a similar reclaim schema, with different locking. Let's define a couple of macros for the used thresholds, so that the latter code will be more easily maintainable. Signed-off-by: Paolo Abeni Acked-by: Mat Martineau --- include/net/sock.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index d08ab55fa4a0..9c5d0502090f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1568,6 +1568,12 @@ static inline void sk_mem_charge(struct sock *sk, in= t size) sk->sk_forward_alloc -=3D size; } =20 +/* the following macros control control memory reclaiming in + * sk_mem_uncharge() + */ +#define SK_RECLAIM_THRESHOLD (1 << 21) +#define SK_RECLAIM_CHUNK (1 << 20) + static inline void sk_mem_uncharge(struct sock *sk, int size) { int reclaimable; @@ -1584,8 +1590,8 @@ static inline void sk_mem_uncharge(struct sock *sk, i= nt size) * If we reach 2 MBytes, reclaim 1 MBytes right now, there is * no need to hold that much forward allocation anyway. */ - if (unlikely(reclaimable >=3D 1 << 21)) - __sk_mem_reclaim(sk, 1 << 20); + if (unlikely(reclaimable >=3D SK_RECLAIM_THRESHOLD)) + __sk_mem_reclaim(sk, SK_RECLAIM_CHUNK); } =20 static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) --=20 2.26.3