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>] [day] [month] [year] [list]
Message-ID: <202012032217.g0RdkfWh-lkp@intel.com>
Date:   Thu, 3 Dec 2020 22:30:44 +0800
From:   kernel test robot <lkp@...el.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org, x86@...nel.org,
        Ingo Molnar <mingo@...nel.org>
Subject: [tip:perf/kprobes 24/25] include/linux/freelist.h:52:8: warning:
 converting the result of '<<' to a boolean always evaluates to true

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/kprobes
head:   a70a04b3844f59c29573a8581d5c263225060dd6
commit: 666fab4a3ea143315a9c059fad9f3a0f1365d54b [24/25] Merge branch 'linus' into perf/kprobes
config: mips-randconfig-r021-20201203 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 32c501dd88b62787d3a5ffda7aabcf4650dbe3cd)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=666fab4a3ea143315a9c059fad9f3a0f1365d54b
        git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
        git fetch --no-tags tip perf/kprobes
        git checkout 666fab4a3ea143315a9c059fad9f3a0f1365d54b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/smp.h:13:
   In file included from include/linux/cpumask.h:13:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:257:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   ATOMIC_SIP_OP(atomic, int, subu, ll, sc)
   ^
   arch/mips/include/asm/atomic.h:251:7: note: expanded from macro 'ATOMIC_SIP_OP'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/s1d13xxxfb.c:24:
   In file included from include/linux/module.h:13:
   In file included from include/linux/stat.h:19:
   In file included from include/linux/time.h:73:
   In file included from include/linux/time32.h:13:
   In file included from include/linux/timex.h:65:
   In file included from arch/mips/include/asm/timex.h:19:
   In file included from arch/mips/include/asm/cpu-type.h:12:
   In file included from include/linux/smp.h:13:
   In file included from include/linux/cpumask.h:13:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:261:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
   ^
   arch/mips/include/asm/atomic.h:251:7: note: expanded from macro 'ATOMIC_SIP_OP'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/s1d13xxxfb.c:24:
   In file included from include/linux/module.h:13:
   In file included from include/linux/stat.h:19:
   In file included from include/linux/time.h:73:
   In file included from include/linux/time32.h:13:
   In file included from include/linux/timex.h:65:
   In file included from arch/mips/include/asm/timex.h:19:
   In file included from arch/mips/include/asm/cpu-type.h:12:
   In file included from include/linux/smp.h:15:
   In file included from include/linux/smp_types.h:5:
   include/linux/llist.h:237:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
           return xchg(&head->first, NULL);
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/s1d13xxxfb.c:24:
   In file included from include/linux/module.h:16:
   In file included from include/linux/kmod.h:9:
   In file included from include/linux/umh.h:4:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:16:
   In file included from include/linux/seqlock.h:19:
   In file included from include/linux/mutex.h:21:
   include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
           return xchg(&debug_locks, 0);
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/s1d13xxxfb.c:29:
   In file included from include/linux/mm.h:33:
   In file included from include/linux/pgtable.h:6:
   arch/mips/include/asm/pgtable.h:208:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
                   cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL);
                   ^
   arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
           cmpxchg((ptr), (o), (n));                                       \
           ^
   arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/s1d13xxxfb.c:29:
   In file included from include/linux/mm.h:33:
   In file included from include/linux/pgtable.h:6:
   arch/mips/include/asm/pgtable.h:208:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
           cmpxchg((ptr), (o), (n));                                       \
           ^
   arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/s1d13xxxfb.c:31:
   In file included from include/linux/fb.h:5:
   In file included from include/linux/kgdb.h:19:
   In file included from include/linux/kprobes.h:31:
>> include/linux/freelist.h:52:8: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
                   if (!try_cmpxchg_release(&list->head, &head, node)) {
                        ^
   include/linux/atomic-fallback.h:113:9: note: expanded from macro 'try_cmpxchg_release'
           ___r = cmpxchg_release((_ptr), ___o, (_new)); \
                  ^
   include/linux/atomic-fallback.h:36:25: note: expanded from macro 'cmpxchg_release'
   #define cmpxchg_release cmpxchg
                           ^
   arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/s1d13xxxfb.c:31:
   In file included from include/linux/fb.h:5:
   In file included from include/linux/kgdb.h:19:
   In file included from include/linux/kprobes.h:31:
>> include/linux/freelist.h:52:8: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   include/linux/atomic-fallback.h:113:9: note: expanded from macro 'try_cmpxchg_release'
           ___r = cmpxchg_release((_ptr), ___o, (_new)); \
                  ^
   include/linux/atomic-fallback.h:36:25: note: expanded from macro 'cmpxchg_release'
   #define cmpxchg_release cmpxchg
                           ^
   arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/s1d13xxxfb.c:31:
   In file included from include/linux/fb.h:5:
   In file included from include/linux/kgdb.h:19:
   In file included from include/linux/kprobes.h:31:
   include/linux/freelist.h:99:7: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
                   if (try_cmpxchg_acquire(&list->head, &head, next)) {
                       ^
   include/linux/atomic-fallback.h:102:9: note: expanded from macro 'try_cmpxchg_acquire'
           ___r = cmpxchg_acquire((_ptr), ___o, (_new)); \
                  ^
   include/linux/atomic-fallback.h:35:25: note: expanded from macro 'cmpxchg_acquire'
   #define cmpxchg_acquire cmpxchg
                           ^
   arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/s1d13xxxfb.c:31:
   In file included from include/linux/fb.h:5:
   In file included from include/linux/kgdb.h:19:
   In file included from include/linux/kprobes.h:31:
   include/linux/freelist.h:99:7: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   include/linux/atomic-fallback.h:102:9: note: expanded from macro 'try_cmpxchg_acquire'
           ___r = cmpxchg_acquire((_ptr), ___o, (_new)); \
                  ^
   include/linux/atomic-fallback.h:35:25: note: expanded from macro 'cmpxchg_acquire'
   #define cmpxchg_acquire cmpxchg
                           ^
   arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   16 warnings generated.
--
   In file included from include/linux/smp.h:13:
   In file included from include/linux/cpumask.h:13:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:257:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   ATOMIC_SIP_OP(atomic, int, subu, ll, sc)
   ^
   arch/mips/include/asm/atomic.h:251:7: note: expanded from macro 'ATOMIC_SIP_OP'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/core/fbmem.c:14:
   In file included from include/linux/module.h:13:
   In file included from include/linux/stat.h:19:
   In file included from include/linux/time.h:73:
   In file included from include/linux/time32.h:13:
   In file included from include/linux/timex.h:65:
   In file included from arch/mips/include/asm/timex.h:19:
   In file included from arch/mips/include/asm/cpu-type.h:12:
   In file included from include/linux/smp.h:13:
   In file included from include/linux/cpumask.h:13:
   In file included from include/linux/atomic.h:7:
   arch/mips/include/asm/atomic.h:261:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
   ^
   arch/mips/include/asm/atomic.h:251:7: note: expanded from macro 'ATOMIC_SIP_OP'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/core/fbmem.c:14:
   In file included from include/linux/module.h:13:
   In file included from include/linux/stat.h:19:
   In file included from include/linux/time.h:73:
   In file included from include/linux/time32.h:13:
   In file included from include/linux/timex.h:65:
   In file included from arch/mips/include/asm/timex.h:19:
   In file included from arch/mips/include/asm/cpu-type.h:12:
   In file included from include/linux/smp.h:15:
   In file included from include/linux/smp_types.h:5:
   include/linux/llist.h:237:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
           return xchg(&head->first, NULL);
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/core/fbmem.c:14:
   In file included from include/linux/module.h:16:
   In file included from include/linux/kmod.h:9:
   In file included from include/linux/umh.h:4:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:16:
   In file included from include/linux/seqlock.h:19:
   In file included from include/linux/mutex.h:21:
   include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
           return xchg(&debug_locks, 0);
                  ^
   arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/core/fbmem.c:22:
   In file included from include/linux/mm.h:33:
   In file included from include/linux/pgtable.h:6:
   arch/mips/include/asm/pgtable.h:208:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
                   cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL);
                   ^
   arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
           cmpxchg((ptr), (o), (n));                                       \
           ^
   arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/core/fbmem.c:22:
   In file included from include/linux/mm.h:33:
   In file included from include/linux/pgtable.h:6:
   arch/mips/include/asm/pgtable.h:208:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
           cmpxchg((ptr), (o), (n));                                       \
           ^
   arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/core/fbmem.c:34:
   In file included from include/linux/fb.h:5:
   In file included from include/linux/kgdb.h:19:
   In file included from include/linux/kprobes.h:31:
>> include/linux/freelist.h:52:8: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
                   if (!try_cmpxchg_release(&list->head, &head, node)) {
                        ^
   include/linux/atomic-fallback.h:113:9: note: expanded from macro 'try_cmpxchg_release'
           ___r = cmpxchg_release((_ptr), ___o, (_new)); \
                  ^
   include/linux/atomic-fallback.h:36:25: note: expanded from macro 'cmpxchg_release'
   #define cmpxchg_release cmpxchg
                           ^
   arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/core/fbmem.c:34:
   In file included from include/linux/fb.h:5:
   In file included from include/linux/kgdb.h:19:
   In file included from include/linux/kprobes.h:31:
>> include/linux/freelist.h:52:8: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   include/linux/atomic-fallback.h:113:9: note: expanded from macro 'try_cmpxchg_release'
           ___r = cmpxchg_release((_ptr), ___o, (_new)); \
                  ^
   include/linux/atomic-fallback.h:36:25: note: expanded from macro 'cmpxchg_release'
   #define cmpxchg_release cmpxchg
                           ^
   arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/core/fbmem.c:34:
   In file included from include/linux/fb.h:5:
   In file included from include/linux/kgdb.h:19:
   In file included from include/linux/kprobes.h:31:
   include/linux/freelist.h:99:7: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
                   if (try_cmpxchg_acquire(&list->head, &head, next)) {
                       ^
   include/linux/atomic-fallback.h:102:9: note: expanded from macro 'try_cmpxchg_acquire'
           ___r = cmpxchg_acquire((_ptr), ___o, (_new)); \
                  ^
   include/linux/atomic-fallback.h:35:25: note: expanded from macro 'cmpxchg_acquire'
   #define cmpxchg_acquire cmpxchg
                           ^
   arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   In file included from drivers/video/fbdev/core/fbmem.c:34:
   In file included from include/linux/fb.h:5:
   In file included from include/linux/kgdb.h:19:
   In file included from include/linux/kprobes.h:31:
   include/linux/freelist.h:99:7: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
   include/linux/atomic-fallback.h:102:9: note: expanded from macro 'try_cmpxchg_acquire'
           ___r = cmpxchg_acquire((_ptr), ___o, (_new)); \
                  ^
   include/linux/atomic-fallback.h:35:25: note: expanded from macro 'cmpxchg_acquire'
   #define cmpxchg_acquire cmpxchg
                           ^
   arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
           if (!__SYNC_loongson3_war)                                      \
                ^
   arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
   # define __SYNC_loongson3_war   (1 << 31)
                                      ^
   drivers/video/fbdev/core/fbmem.c:736:36: warning: unused variable 'proc_fb_seq_ops' [-Wunused-const-variable]
   static const struct seq_operations proc_fb_seq_ops = {
                                      ^
   17 warnings generated.

vim +52 include/linux/freelist.h

e563604a5f5a891 Peter Zijlstra 2020-08-29  29  
e563604a5f5a891 Peter Zijlstra 2020-08-29  30  static inline void __freelist_add(struct freelist_node *node, struct freelist_head *list)
e563604a5f5a891 Peter Zijlstra 2020-08-29  31  {
e563604a5f5a891 Peter Zijlstra 2020-08-29  32  	/*
e563604a5f5a891 Peter Zijlstra 2020-08-29  33  	 * Since the refcount is zero, and nobody can increase it once it's
e563604a5f5a891 Peter Zijlstra 2020-08-29  34  	 * zero (except us, and we run only one copy of this method per node at
e563604a5f5a891 Peter Zijlstra 2020-08-29  35  	 * a time, i.e. the single thread case), then we know we can safely
e563604a5f5a891 Peter Zijlstra 2020-08-29  36  	 * change the next pointer of the node; however, once the refcount is
e563604a5f5a891 Peter Zijlstra 2020-08-29  37  	 * back above zero, then other threads could increase it (happens under
e563604a5f5a891 Peter Zijlstra 2020-08-29  38  	 * heavy contention, when the refcount goes to zero in between a load
e563604a5f5a891 Peter Zijlstra 2020-08-29  39  	 * and a refcount increment of a node in try_get, then back up to
e563604a5f5a891 Peter Zijlstra 2020-08-29  40  	 * something non-zero, then the refcount increment is done by the other
e563604a5f5a891 Peter Zijlstra 2020-08-29  41  	 * thread) -- so if the CAS to add the node to the actual list fails,
e563604a5f5a891 Peter Zijlstra 2020-08-29  42  	 * decrese the refcount and leave the add operation to the next thread
e563604a5f5a891 Peter Zijlstra 2020-08-29  43  	 * who puts the refcount back to zero (which could be us, hence the
e563604a5f5a891 Peter Zijlstra 2020-08-29  44  	 * loop).
e563604a5f5a891 Peter Zijlstra 2020-08-29  45  	 */
e563604a5f5a891 Peter Zijlstra 2020-08-29  46  	struct freelist_node *head = READ_ONCE(list->head);
e563604a5f5a891 Peter Zijlstra 2020-08-29  47  
e563604a5f5a891 Peter Zijlstra 2020-08-29  48  	for (;;) {
e563604a5f5a891 Peter Zijlstra 2020-08-29  49  		WRITE_ONCE(node->next, head);
e563604a5f5a891 Peter Zijlstra 2020-08-29  50  		atomic_set_release(&node->refs, 1);
e563604a5f5a891 Peter Zijlstra 2020-08-29  51  
e563604a5f5a891 Peter Zijlstra 2020-08-29 @52  		if (!try_cmpxchg_release(&list->head, &head, node)) {
e563604a5f5a891 Peter Zijlstra 2020-08-29  53  			/*
e563604a5f5a891 Peter Zijlstra 2020-08-29  54  			 * Hmm, the add failed, but we can only try again when
e563604a5f5a891 Peter Zijlstra 2020-08-29  55  			 * the refcount goes back to zero.
e563604a5f5a891 Peter Zijlstra 2020-08-29  56  			 */
e563604a5f5a891 Peter Zijlstra 2020-08-29  57  			if (atomic_fetch_add_release(REFS_ON_FREELIST - 1, &node->refs) == 1)
e563604a5f5a891 Peter Zijlstra 2020-08-29  58  				continue;
e563604a5f5a891 Peter Zijlstra 2020-08-29  59  		}
e563604a5f5a891 Peter Zijlstra 2020-08-29  60  		return;
e563604a5f5a891 Peter Zijlstra 2020-08-29  61  	}
e563604a5f5a891 Peter Zijlstra 2020-08-29  62  }
e563604a5f5a891 Peter Zijlstra 2020-08-29  63  

:::::: The code at line 52 was first introduced by commit
:::::: e563604a5f5a891283b6a8db4001cee833a7c6b8 freelist: Implement lockless freelist

:::::: TO: Peter Zijlstra <peterz@...radead.org>
:::::: CC: Ingo Molnar <mingo@...nel.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (26188 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ