From patchwork Fri Jun 2 08:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Wu X-Patchwork-Id: 13264830 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 04B37D304 for ; Fri, 2 Jun 2023 08:11:58 +0000 (UTC) Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9160EB for ; Fri, 2 Jun 2023 01:11:56 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-256531ad335so1387788a91.0 for ; Fri, 02 Jun 2023 01:11:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1685693516; x=1688285516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iCepPOl9mp4meHusGBh1Wos+X24ELWJG4xhc1EAvakM=; b=akVOHUmEY2HrSn8sCzEPkJCFaO4u/D8Dl9fqbknyN67dHYkE9iTOGSKXYoTJp6cVCd JRl8C39ECchyPoiYpI/L8CS3Bn86nSsQnpFshC4ZMefWpdMj0zzc6//2p2olbGZ2xWTL 1bQXup3D0YO7GRokeldNi9fgYYhlqHntQbM6BpJy04r8p7E4nCjFY16KmEXA2chJkH17 m6LIljvVpIUuddw7o4NcWuHZP2Hw6BQBMPCqmzvnsRrHSvuKCVsLrhDbPDn8dsaov90H bOXS93BM+3QrLj9jFZtV+yrsJzn3pOKUGkUfUicRFlygWh/gPgOc0/Ypcg4bN+tt9Dfl WQpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685693516; x=1688285516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iCepPOl9mp4meHusGBh1Wos+X24ELWJG4xhc1EAvakM=; b=aJKSvQdvIYgBFhwBOM7ct85qrfZe36bFx2gubPShGp9fO7ThvJtvMFs7qaAt8g+7Tr CsV151Rz1ME0VePMBx5D6UmUJNnjwmkyLmw7387XrCwSmhflhDpDZcIB2UU1OYDKfslF Uwy8D/CXrMsTMA2ePFTO9gBwHu2SXzU8OZssDpG93tKQaLiYyAcMnu0z3o7LkAPThqEf yqFw6c98R2MrPxw1nS+EHZ657pKUUv/Gwv5a0EPy6tsnox3BIS2JZKI5BG5VDv48mQs9 a9FMhPcZz3Efu5jjsO5ZbPLKfdG+rfIAn5syzmx4XPihbUo7E+BCGZ1B0mC41S3OjNcI fy9g== X-Gm-Message-State: AC+VfDyW5LerhJhEzbw0NdEoh2cUbk9BGYIuzWs0+tx5joRnoUCAHbqw CvBrIiMzVRajJ7iXqyi9msi1CQ== X-Google-Smtp-Source: ACHHUZ5DwYTBIaQBiPoaru74ouktiUFZQ/5VNR/JoQ2bzJ9gjHqpW8vuV2nlRo37pxM4NQD552U2Cw== X-Received: by 2002:a17:902:c94b:b0:1b1:a9e7:5d4b with SMTP id i11-20020a170902c94b00b001b1a9e75d4bmr2030133pla.22.1685693516240; Fri, 02 Jun 2023 01:11:56 -0700 (PDT) Received: from C02DV8HUMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id ij9-20020a170902ab4900b001b025aba9edsm703570plb.220.2023.06.02.01.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 01:11:55 -0700 (PDT) From: Abel Wu To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Johannes Weiner , Michal Hocko , Vladimir Davydov , Shakeel Butt , Muchun Song Cc: Simon Horman , netdev@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Wu Subject: [PATCH net-next v5 1/3] net-memcg: Fold dependency into memcg pressure cond Date: Fri, 2 Jun 2023 16:11:33 +0800 Message-Id: <20230602081135.75424-2-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230602081135.75424-1-wuyun.abel@bytedance.com> References: <20230602081135.75424-1-wuyun.abel@bytedance.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The callers of mem_cgroup_under_socket_pressure() should always make sure that (mem_cgroup_sockets_enabled && sk->sk_memcg) is true. So instead of coding around all the callsites, put the dependencies into mem_cgroup_under_socket_pressure() to avoid redundancy and possibly bugs. This change might also introduce slight function call overhead *iff* the function gets expanded in the future. But for now this change doesn't make binaries different (checked by vimdiff) except the one net/ipv4/tcp_input.o (by scripts/bloat-o-meter), which is probably negligible to performance: add/remove: 0/0 grow/shrink: 1/2 up/down: 5/-5 (0) Function old new delta tcp_grow_window 573 578 +5 tcp_try_rmem_schedule 1083 1081 -2 tcp_check_space 324 321 -3 Total: Before=44647, After=44647, chg +0.00% So folding the dependencies into mem_cgroup_under_socket_pressure() is generally a good thing and provides better readablility. Signed-off-by: Abel Wu --- include/linux/memcontrol.h | 2 ++ include/net/sock.h | 3 +-- include/net/tcp.h | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 222d7370134c..a1aead140ff8 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1743,6 +1743,8 @@ void mem_cgroup_sk_alloc(struct sock *sk); void mem_cgroup_sk_free(struct sock *sk); static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) { + if (!mem_cgroup_sockets_enabled || !memcg) + return false; if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) && memcg->tcpmem_pressure) return true; do { diff --git a/include/net/sock.h b/include/net/sock.h index 656ea89f60ff..3f63253ee092 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1414,8 +1414,7 @@ static inline bool sk_under_memory_pressure(const struct sock *sk) if (!sk->sk_prot->memory_pressure) return false; - if (mem_cgroup_sockets_enabled && sk->sk_memcg && - mem_cgroup_under_socket_pressure(sk->sk_memcg)) + if (mem_cgroup_under_socket_pressure(sk->sk_memcg)) return true; return !!*sk->sk_prot->memory_pressure; diff --git a/include/net/tcp.h b/include/net/tcp.h index 14fa716cac50..d4c358bc0c52 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -259,8 +259,7 @@ extern unsigned long tcp_memory_pressure; /* optimized version of sk_under_memory_pressure() for TCP sockets */ static inline bool tcp_under_memory_pressure(const struct sock *sk) { - if (mem_cgroup_sockets_enabled && sk->sk_memcg && - mem_cgroup_under_socket_pressure(sk->sk_memcg)) + if (mem_cgroup_under_socket_pressure(sk->sk_memcg)) return true; return READ_ONCE(tcp_memory_pressure); From patchwork Fri Jun 2 08:11:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Wu X-Patchwork-Id: 13264831 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 5ED658BF6 for ; Fri, 2 Jun 2023 08:12:04 +0000 (UTC) Received: from mail-oo1-xc2b.google.com (mail-oo1-xc2b.google.com [IPv6:2607:f8b0:4864:20::c2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6AD019B for ; Fri, 2 Jun 2023 01:12:02 -0700 (PDT) Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-558565cc58fso1355684eaf.0 for ; Fri, 02 Jun 2023 01:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1685693522; x=1688285522; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aMgEeyTxt1Bo6VDZUGwQjdkhsPRlWxhl30gajyLXBa4=; b=VjphZxOIejuEYZEGuPwwC4pDQ7lIV7K/XG9vcSDLCRxCWGgGi5PSze6VUYd11+IAs0 Kuul4CNsZBFvMYso/aMxRk0DUCPanLD16zAl1A0vODdrCeOViOsELz9IBaR8oTw6UPca Sh5kimkJvKN5Y60CS7Fgx05CnVMkFs3LUuQK4GRlUFaU64P6G3aEXHniXJomFeuNh7RV 2g9IxHPICSZ3vQb4CogF4QAJdPmhaXCbiWb/5M6aqzDmAghY5ZlzepkhiMb7IttTe7uY mULWUSkeYlsAYa+W5goQyWu6i+nF1szs/G1oDUjv5o+ae9/cGIFhbicxvEJ9GU8G5HDk p57A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685693522; x=1688285522; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aMgEeyTxt1Bo6VDZUGwQjdkhsPRlWxhl30gajyLXBa4=; b=AycqeSTdOP9zPpYKfp3/sy3BSJ7FvNrYAKSSGnnSCk/XwfmlyFvJFWE12Ab0ntwrsz hV6w5snDTMKISDlJ+ILYAF/Ld6jeFcujpDXPOlt0z7SqhTcXm1ZRVKqRxih86PL0kpSL nww+wJ+qOFTJK/SVlvglWz3CEumTuj3BP8aQkSKHA9IV/mj4Eua5f49fYowJ/0OfJu8p U/oCAKT10P4AVireqmpx1Iv4I1WfbsWuMnkeAdIe9sYqAHaHohURUYaolmYK3wx3NCXx KufAX5V2sFLvJ5705cvh1QBAi8SU0WjJCPITPuBqAFit0fEevCxj/d1oayZrHnvv5VFU aKFw== X-Gm-Message-State: AC+VfDz+/yNualApV1HWVB885v6cdhm+XFHv9rRky9Xe7gQ4RyF161xM OpURnhr7wXjcv3wteV4aFs1sYg== X-Google-Smtp-Source: ACHHUZ4A27qjlFy5d7fB7UgzYv64hzjwk6Uq2zWiwMXFJiJaGOxm7+lY8w3gnnmpSkd1sTF3hYYqJw== X-Received: by 2002:a05:6808:198:b0:398:9ee4:1dac with SMTP id w24-20020a056808019800b003989ee41dacmr1647685oic.32.1685693522017; Fri, 02 Jun 2023 01:12:02 -0700 (PDT) Received: from C02DV8HUMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id ij9-20020a170902ab4900b001b025aba9edsm703570plb.220.2023.06.02.01.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 01:12:01 -0700 (PDT) From: Abel Wu To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Johannes Weiner , Michal Hocko , Vladimir Davydov , Shakeel Butt , Muchun Song Cc: Simon Horman , netdev@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Wu Subject: [PATCH net-next v5 2/3] sock: Always take memcg pressure into consideration Date: Fri, 2 Jun 2023 16:11:34 +0800 Message-Id: <20230602081135.75424-3-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230602081135.75424-1-wuyun.abel@bytedance.com> References: <20230602081135.75424-1-wuyun.abel@bytedance.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The sk_under_memory_pressure() is called to check whether there is memory pressure related to this socket. But now it ignores the net- memcg's pressure if the proto of the socket doesn't care about the global pressure, which may put burden on its memcg compaction or reclaim path (also remember that socket memory is un-reclaimable). So always check the memcg's vm status to alleviate memstalls when it's in pressure. Signed-off-by: Abel Wu --- include/net/sock.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 3f63253ee092..ad1895ffbc4a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1411,13 +1411,11 @@ static inline bool sk_has_memory_pressure(const struct sock *sk) static inline bool sk_under_memory_pressure(const struct sock *sk) { - if (!sk->sk_prot->memory_pressure) - return false; - if (mem_cgroup_under_socket_pressure(sk->sk_memcg)) return true; - return !!*sk->sk_prot->memory_pressure; + return sk->sk_prot->memory_pressure && + *sk->sk_prot->memory_pressure; } static inline long From patchwork Fri Jun 2 08:11:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Wu X-Patchwork-Id: 13264832 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 75EB48474 for ; Fri, 2 Jun 2023 08:12:10 +0000 (UTC) Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D70501BD for ; Fri, 2 Jun 2023 01:12:08 -0700 (PDT) Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-19f6f8c840bso1827408fac.3 for ; Fri, 02 Jun 2023 01:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1685693527; x=1688285527; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jiy6rp/teLKUThWdNiCcsRgTjbB074BNeS/UwKIzIT4=; b=FcENutYDdzs+NLTMwlqtxPI7kQe9B9F3492UNa2AvSZ3MxWSDDRKB0NjErfj07Cy+I lcryEwsmuLr/Rna0uvSCsg0jGws2Kih7hnkAQCxmrKEko+IRebwiaimFfWQF9D6EnRg5 WMt2jLz+Fry5HFMXqRkTZFteE1adrdDLaaTNVhiEDH0oZFH6nmmDOxD1vED/7hp4clg7 i5VonGkD7Z9+DL2kJT9JGCGy1JkMDhSAZbQA3e3hkKE8ho2Ne1ZAsG7XARqmAqSrku1h HS24GS0ml598fRcd3JAWW/6zZ4GINKyFqP9OU8xiW38noVicpGBYIs5cmmN4isHizMin XsvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685693527; x=1688285527; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jiy6rp/teLKUThWdNiCcsRgTjbB074BNeS/UwKIzIT4=; b=W4Jr84dkAwJKd2N+BKvCqo4r/f2Ppf7Jtp5wwDlE21YEo4hhtlujAhVc0AMPtxpwhc U4/wZOL6rhXkFX3XpJSAMIxvWwZxQjRt6ZgzLQqYza9KpDrRjeO0FjT2j3ZMHrk2Bz9M w6LlhSR4k3WmDGO/S1RL9UYtV3c3xeBR1ldVY9n0S0T8HtUTD981Lj5EFN4H22rabpX5 s+nWoOjAngQQrjiOQURMbVV9MapghxRMq147PHlQEIFCptehFjgewPXjqUvW9KxqK0ZF DUjnbs+FlyCj0x2I2kwoZcFlER+437mtAu1q2sIxk5it/Sn/X1SM3Kv0tGQEbW37TaSb 8MDw== X-Gm-Message-State: AC+VfDx9dnq2Pgv+B0p7gHwD/3BcGtrEIf59Kdur8hnZpAj7INsOqQIE rJFJprDirvNK7LqsAJkhJB/qiQ== X-Google-Smtp-Source: ACHHUZ7CNQtcusWmTYjr7kkqOWjT8K7czNAqdYl2iTFd0Z0fE8k2zcGs/Fog4KFmH0pAmQ29q/PNvQ== X-Received: by 2002:a05:6870:a8b0:b0:163:3be0:1195 with SMTP id eb48-20020a056870a8b000b001633be01195mr1715224oab.11.1685693527679; Fri, 02 Jun 2023 01:12:07 -0700 (PDT) Received: from C02DV8HUMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id ij9-20020a170902ab4900b001b025aba9edsm703570plb.220.2023.06.02.01.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 01:12:07 -0700 (PDT) From: Abel Wu To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Johannes Weiner , Michal Hocko , Vladimir Davydov , Shakeel Butt , Muchun Song Cc: Simon Horman , netdev@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Wu Subject: [PATCH net-next v5 3/3] sock: Fix misuse of sk_under_memory_pressure() Date: Fri, 2 Jun 2023 16:11:35 +0800 Message-Id: <20230602081135.75424-4-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230602081135.75424-1-wuyun.abel@bytedance.com> References: <20230602081135.75424-1-wuyun.abel@bytedance.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The status of global socket memory pressure is updated when: a) __sk_mem_raise_allocated(): enter: sk_memory_allocated(sk) > sysctl_mem[1] leave: sk_memory_allocated(sk) <= sysctl_mem[0] b) __sk_mem_reduce_allocated(): leave: sk_under_memory_pressure(sk) && sk_memory_allocated(sk) < sysctl_mem[0] So the conditions of leaving global pressure are inconstant, which may lead to the situation that one pressured net-memcg prevents the global pressure from being cleared when there is indeed no global pressure, thus the global constrains are still in effect unexpectedly on the other sockets. This patch fixes this by ignoring the net-memcg's pressure when deciding whether should leave global memory pressure. Fixes: e1aab161e013 ("socket: initial cgroup code.") Signed-off-by: Abel Wu --- include/net/sock.h | 9 +++++++-- net/core/sock.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index ad1895ffbc4a..22695f776e76 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1409,13 +1409,18 @@ static inline bool sk_has_memory_pressure(const struct sock *sk) return sk->sk_prot->memory_pressure != NULL; } +static inline bool sk_under_global_memory_pressure(const struct sock *sk) +{ + return sk->sk_prot->memory_pressure && + *sk->sk_prot->memory_pressure; +} + static inline bool sk_under_memory_pressure(const struct sock *sk) { if (mem_cgroup_under_socket_pressure(sk->sk_memcg)) return true; - return sk->sk_prot->memory_pressure && - *sk->sk_prot->memory_pressure; + return sk_under_global_memory_pressure(sk); } static inline long diff --git a/net/core/sock.c b/net/core/sock.c index 5440e67bcfe3..801df091e37a 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3095,7 +3095,7 @@ void __sk_mem_reduce_allocated(struct sock *sk, int amount) if (mem_cgroup_sockets_enabled && sk->sk_memcg) mem_cgroup_uncharge_skmem(sk->sk_memcg, amount); - if (sk_under_memory_pressure(sk) && + if (sk_under_global_memory_pressure(sk) && (sk_memory_allocated(sk) < sk_prot_mem_limits(sk, 0))) sk_leave_memory_pressure(sk); }