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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CH3PR11MB7345ABB947E183AFB7C18322FC779@CH3PR11MB7345.namprd11.prod.outlook.com>
Date: Wed, 10 May 2023 11:11:37 +0000
From: "Zhang, Cathy" <cathy.zhang@...el.com>
To: Shakeel Butt <shakeelb@...gle.com>, Eric Dumazet <edumazet@...gle.com>,
	Linux MM <linux-mm@...ck.org>, Cgroups <cgroups@...r.kernel.org>
CC: Paolo Abeni <pabeni@...hat.com>, "davem@...emloft.net"
	<davem@...emloft.net>, "kuba@...nel.org" <kuba@...nel.org>, "Brandeburg,
 Jesse" <jesse.brandeburg@...el.com>, "Srinivas, Suresh"
	<suresh.srinivas@...el.com>, "Chen, Tim C" <tim.c.chen@...el.com>, "You,
 Lizhen" <lizhen.you@...el.com>, "eric.dumazet@...il.com"
	<eric.dumazet@...il.com>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next 1/2] net: Keep sk->sk_forward_alloc as a proper
 size

Hi Shakeel, Eric and all,

How about adding memory pressure checking in sk_mem_uncharge()
to decide if keep part of memory or not, which can help avoid the issue
you fixed and the problem we find on the system with more CPUs.

The code draft is like this:

static inline void sk_mem_uncharge(struct sock *sk, int size)
{
        int reclaimable;
        int reclaim_threshold = SK_RECLAIM_THRESHOLD;

        if (!sk_has_account(sk))
                return;
        sk->sk_forward_alloc += size;

        if (mem_cgroup_sockets_enabled && sk->sk_memcg &&
            mem_cgroup_under_socket_pressure(sk->sk_memcg)) {
                sk_mem_reclaim(sk);
                return;
        }

        reclaimable = sk->sk_forward_alloc - sk_unused_reserved_mem(sk);

        if (reclaimable > reclaim_threshold) {
                reclaimable -= reclaim_threshold;
                __sk_mem_reclaim(sk, reclaimable);
        }
}

I've run a test with the new code, the result looks good, it does not introduce
latency, RPS is the same.

> -----Original Message-----
> From: Shakeel Butt <shakeelb@...gle.com>
> Sent: Wednesday, May 10, 2023 12:10 AM
> To: Eric Dumazet <edumazet@...gle.com>; Linux MM <linux-
> mm@...ck.org>; Cgroups <cgroups@...r.kernel.org>
> Cc: Zhang, Cathy <cathy.zhang@...el.com>; Paolo Abeni
> <pabeni@...hat.com>; davem@...emloft.net; kuba@...nel.org;
> Brandeburg, Jesse <jesse.brandeburg@...el.com>; Srinivas, Suresh
> <suresh.srinivas@...el.com>; Chen, Tim C <tim.c.chen@...el.com>; You,
> Lizhen <lizhen.you@...el.com>; eric.dumazet@...il.com;
> netdev@...r.kernel.org
> Subject: Re: [PATCH net-next 1/2] net: Keep sk->sk_forward_alloc as a proper
> size
> 
> +linux-mm & cgroup
> 
> Thread: https://lore.kernel.org/all/20230508020801.10702-1-
> cathy.zhang@...el.com/
> 
> On Tue, May 9, 2023 at 8:43 AM Eric Dumazet <edumazet@...gle.com>
> wrote:
> >
> [...]
> > Some mm experts should chime in, this is not a networking issue.
> 
> Most of the MM folks are busy in LSFMM this week. I will take a look at this
> soon.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ