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: <ffe3f49c-55d7-3c28-78a2-7998fa3ee914@colorfullife.com>
Date:   Sat, 3 Sep 2022 21:35:11 +0200
From:   Manfred Spraul <manfred@...orfullife.com>
To:     Jiebin Sun <jiebin.sun@...el.com>, akpm@...ux-foundation.org,
        vasily.averin@...ux.dev, shakeelb@...gle.com, dennis@...nel.org,
        tj@...nel.org, cl@...ux.com, ebiederm@...ssion.com,
        legion@...nel.org, alexander.mikhalitsyn@...tuozzo.com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc:     tim.c.chen@...el.com, feng.tang@...el.com, ying.huang@...el.com,
        tianyou.li@...el.com, wangyang.guo@...el.com
Subject: Re: [PATCH] ipc/msg.c: mitigate the lock contention with percpu
 counter

Hi Jiebin,

On 9/2/22 17:22, Jiebin Sun wrote:
> The msg_bytes and msg_hdrs atomic counters are frequently
> updated when IPC msg queue is in heavy use, causing heavy
> cache bounce and overhead. Change them to percpu_counters
> greatly improve the performance. Since there is one unique
> ipc namespace, additional memory cost is minimal.

With ipc namespaces, there is one struct per namespace, correct?

The cost is probably still ok, but the change log should be correct.


> @@ -1303,14 +1305,16 @@ void msg_init_ns(struct ipc_namespace *ns)
>   	ns->msg_ctlmnb = MSGMNB;
>   	ns->msg_ctlmni = MSGMNI;
>   
> -	atomic_set(&ns->msg_bytes, 0);
> -	atomic_set(&ns->msg_hdrs, 0);
> +	percpu_counter_init(&ns->percpu_msg_bytes, 0, GFP_KERNEL);
> +	percpu_counter_init(&ns->percpu_msg_hdrs, 0, GFP_KERNEL);
>   	ipc_init_ids(&ns->ids[IPC_MSG_IDS]);

These calls can fail. You must add error handling.

--

     Manfred

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ