lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20230530114011.13368-5-wuyun.abel@bytedance.com> Date: Tue, 30 May 2023 19:40:11 +0800 From: Abel Wu <wuyun.abel@...edance.com> To: "David S . Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Johannes Weiner <hannes@...xchg.org>, Michal Hocko <mhocko@...nel.org>, Vladimir Davydov <vdavydov.dev@...il.com>, Shakeel Butt <shakeelb@...gle.com>, Muchun Song <muchun.song@...ux.dev> Cc: Simon Horman <simon.horman@...igine.com>, netdev@...r.kernel.org, linux-mm@...ck.org, cgroups@...r.kernel.org, linux-kernel@...r.kernel.org, Abel Wu <wuyun.abel@...edance.com> Subject: [PATCH v4 4/4] sock: Remove redundant cond of memcg pressure Now with the previous patch, __sk_mem_raise_allocated() considers the memory pressure of both global and the socket's memcg on a func- wide level, making the condition of memcg's pressure in question redundant. Signed-off-by: Abel Wu <wuyun.abel@...edance.com> --- net/core/sock.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/core/sock.c b/net/core/sock.c index 801df091e37a..86735ad2f903 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3020,9 +3020,15 @@ int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind) if (sk_has_memory_pressure(sk)) { u64 alloc; - if (!sk_under_memory_pressure(sk)) + if (!sk_under_global_memory_pressure(sk)) return 1; + alloc = sk_sockets_allocated_read_positive(sk); + + /* If under global pressure, allow the sockets that are below + * average memory usage to raise, trying to be fair among all + * the sockets under global constrains. + */ if (sk_prot_mem_limits(sk, 2) > alloc * sk_mem_pages(sk->sk_wmem_queued + atomic_read(&sk->sk_rmem_alloc) + -- 2.37.3
Powered by blists - more mailing lists