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
| ||
|
Date: Wed, 27 Oct 2021 14:22:08 -0400 From: Pasha Tatashin <pasha.tatashin@...een.com> To: Muchun Song <songmuchun@...edance.com> Cc: LKML <linux-kernel@...r.kernel.org>, Linux Memory Management List <linux-mm@...ck.org>, linux-m68k@...ts.linux-m68k.org, Anshuman Khandual <anshuman.khandual@....com>, Matthew Wilcox <willy@...radead.org>, Andrew Morton <akpm@...ux-foundation.org>, william.kucharski@...cle.com, Mike Kravetz <mike.kravetz@...cle.com>, Vlastimil Babka <vbabka@...e.cz>, Geert Uytterhoeven <geert@...ux-m68k.org>, schmitzmic@...il.com, Steven Rostedt <rostedt@...dmis.org>, Ingo Molnar <mingo@...hat.com>, Johannes Weiner <hannes@...xchg.org>, Roman Gushchin <guro@...com>, weixugc@...gle.com, Greg Thelen <gthelen@...gle.com> Subject: Re: [RFC 1/8] mm: add overflow and underflow checks for page->_refcount > I found some atomic_add/dec are replaced with atomic_add/dec_return, I am going to replace -return variants with -fetch variants, potentially -fetch > those helpers with return value imply a full memory barrier around it, but > others without return value do not. Do you have any numbers to show > the impact? Maybe atomic_add/dec_return_relaxed can help this. The generic variant uses arch_cmpxchg() for all atomic variants without any extra barriers. Therefore, on platforms that use generic implementations there won't be performance differences except for an extra branch that checks results when VM_BUG_ON is enabled. On x86 the difference between the two is the following atomic_add: lock add %eax,(%rsi) atomic_fetch_add: lock xadd %eax,(%rsi) atomic_fetch_add_relaxed: lock xadd %eax,(%rsi) No differences between relaxed and non relaxed variants. However, we used lock xadd instead of lock add. I am not sure if the performance difference is going to be different. Pasha
Powered by blists - more mailing lists