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] [day] [month] [year] [list]
Message-ID: <19b392d9d8f97170518354df0ebdf913a140799d.camel@zhaoxin.com>
Date: Fri, 15 Nov 2024 15:30:13 +0800
From: yongli-oc <yongli-oc@...oxin.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: <linux-kernel@...r.kernel.org>, <yongli@...oxin.com>,
        <cobechen@...oxin.com>, <louisqi@...oxin.com>,
        <jiangbowang@...oxin.com>
Subject: Re: [PATCH] Support lockref reference count if enable LOCK_STAT


Hi, Morton:
One of the struct lockref is used in dcache.h. The spinlock_t is 4
bytes, with the 4 bytes reference count, the struct lockref is a 8
bytes variable, the count can be inc/dec by a 64 bits atomic operation,
when the spinlock is unlocked.
If the spinlock is more than 4 bytes, such as enable the kernel config
DEBUG_SPINLOCK or LOCK_STAT, the count inc/dec should got the spinlock
first, the sequence likes "lock; inc_ref; unlock;", which will caused
spinlock contention increased so much.
The chart below shows the spinlock contention with and without the
lockref patch. it got by "cat /proc/lock_stat" after ubuntu 22.04 boot
up. I tried each case two times. the con-bounces and contentions
of 6.6.28 with LOCK_STAT enable are much more than it of the 6.6.28
lockref patched. 
With the lockref patch, the count can be operated by atomic too. The
statistics result is similar to the 6.6.28 kernel production
environment.

lock_stat version 0.4
  --------------------------------------------------
  bootup  class name     con-bounces    contentions
  times
  --------kernel 6.6.28, enable LOCK_STAT-----------
   1   &dentry->d_lock:    385336         413098
   2   &dentry->d_lock:    378268         402761
  --------------------------------------------------
  -------6.6.28 with lockref patch and LOCK_STAT----
   1   &dentry->d_lock:     79941          82431
   2   &dentry->d_lock:     77817          80301
  --------------------------------------------------
Li Yong

On Thu, 2024-11-14 at 16:14 -0800, Andrew Morton wrote:
> 
> 
> [这封邮件来自外部发件人 谨防风险]
> 
> On Wed, 13 Nov 2024 16:57:03 +0800 yongli-oc <yongli-oc@...oxin.com>
> wrote:
> 
> > Swap the positions of lock and count to support CMPXCHG_LOCKREF
> > if SPINLOCK_SIZE > 4 when enable LOCK_STAT. The reference count
> > can always be used regardless of the spinlock_t size.
> 
> Please fully describe the problem we're solving here?  And what are
> the
> runtime effects of this change?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ