[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHmME9r2u86Ga1UL_yD6x44OX84UJbRQyfhhDjF1daXyaYsbEw@mail.gmail.com>
Date: Thu, 6 Oct 2022 07:07:24 -0600
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Jan Kara <jack@...e.cz>, Andrew Lunn <andrew@...n.ch>,
"Darrick J . Wong" <djwong@...nel.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
dri-devel@...ts.freedesktop.org,
Andrii Nakryiko <andrii@...nel.org>,
Hans Verkuil <hverkuil@...all.nl>, linux-sctp@...r.kernel.org,
"Md . Haris Iqbal" <haris.iqbal@...os.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Christoph Hellwig <hch@....de>,
Andy Gospodarek <andy@...yhouse.net>,
Sergey Matyukevich <geomatsi@...il.com>,
Rohit Maheshwari <rohitm@...lsio.com>,
Michael Ellerman <mpe@...erman.id.au>,
ceph-devel@...r.kernel.org,
Christophe Leroy <christophe.leroy@...roup.eu>,
Jozsef Kadlecsik <kadlec@...filter.org>,
Nilesh Javali <njavali@...vell.com>,
Jean-Paul Roubelat <jpr@...bb.org>,
Dick Kennedy <dick.kennedy@...adcom.com>,
Jay Vosburgh <j.vosburgh@...il.com>,
Potnuri Bharat Teja <bharat@...lsio.com>,
Vinay Kumar Yadav <vinay.yadav@...lsio.com>,
linux-nfs@...r.kernel.org, Nicholas Piggin <npiggin@...il.com>,
Igor Mitsyanko <imitsyanko@...ntenna.com>,
Andy Lutomirski <luto@...nel.org>, linux-hams@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Trond Myklebust <trond.myklebust@...merspace.com>,
linux-raid@...r.kernel.org, Neil Horman <nhorman@...driver.com>,
Hante Meuleman <hante.meuleman@...adcom.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org,
Michael Chan <michael.chan@...adcom.com>,
linux-kernel@...r.kernel.org, Varun Prakash <varun@...lsio.com>,
Chuck Lever <chuck.lever@...cle.com>,
netfilter-devel@...r.kernel.org,
Masami Hiramatsu <mhiramat@...nel.org>,
Jiri Olsa <jolsa@...nel.org>, Jan Kara <jack@...e.com>,
linux-fsdevel@...r.kernel.org,
Lars Ellenberg <lars.ellenberg@...bit.com>,
linux-media@...r.kernel.org,
Claudiu Beznea <claudiu.beznea@...rochip.com>,
Sharvari Harisangam <sharvari.harisangam@....com>,
linux-fbdev@...r.kernel.org, linux-doc@...r.kernel.org,
linux-mmc@...r.kernel.org,
Dave Hansen <dave.hansen@...ux.intel.com>,
Song Liu <song@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
target-devel@...r.kernel.org, John Stultz <jstultz@...gle.com>,
Stanislav Fomichev <sdf@...gle.com>,
Gregory Greenman <gregory.greenman@...el.com>,
drbd-dev@...ts.linbit.com, dev@...nvswitch.org,
Leon Romanovsky <leon@...nel.org>,
Helge Deller <deller@....de>, Hugh Dickins <hughd@...gle.com>,
James Smart <james.smart@...adcom.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
Pravin B Shelar <pshelar@....org>,
Julian Anastasov <ja@....bg>, coreteam@...filter.org,
Veaceslav Falico <vfalico@...il.com>,
Yonghong Song <yhs@...com>,
Namjae Jeon <linkinjeon@...nel.org>,
linux-crypto@...r.kernel.org,
Santosh Shilimkar <santosh.shilimkar@...cle.com>,
Ganapathi Bhat <ganapathi017@...il.com>,
linux-actions@...ts.infradead.org,
Simon Horman <horms@...ge.net.au>,
Jaegeuk Kim <jaegeuk@...nel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
Hao Luo <haoluo@...gle.com>, "Theodore Ts'o" <tytso@....edu>,
Stephen Boyd <sboyd@...nel.org>,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
Florian Westphal <fw@...len.de>,
Andreas Färber <afaerber@...e.de>,
Jon Maloy <jmaloy@...hat.com>,
Vlad Yasevich <vyasevich@...il.com>,
Anna Schumaker <anna@...nel.org>,
Yehezkel Bernat <YehezkelShB@...il.com>,
Haoyue Xu <xuhaoyue1@...ilicon.com>,
Heiner Kallweit <hkallweit1@...il.com>,
linux-wireless@...r.kernel.org,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
linux-nvme@...ts.infradead.org,
Michal Januszewski <spock@...too.org>,
linux-mtd@...ts.infradead.org, kasan-dev@...glegroups.com,
Cong Wang <xiyou.wangcong@...il.com>,
Thomas Sailer <t.sailer@...mni.ethz.ch>,
Ajay Singh <ajay.kathat@...rochip.com>,
Xiubo Li <xiubli@...hat.com>, Sagi Grimberg <sagi@...mberg.me>,
Daniel Borkmann <daniel@...earbox.net>,
Jonathan Corbet <corbet@....net>, linux-rdma@...r.kernel.org,
lvs-devel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
"Naveen N . Rao" <naveen.n.rao@...ux.ibm.com>,
Ilya Dryomov <idryomov@...il.com>,
Paolo Abeni <pabeni@...hat.com>,
Pablo Neira Ayuso <pablo@...filter.org>,
Marco Elver <elver@...gle.com>,
Kees Cook <keescook@...omium.org>,
Yury Norov <yury.norov@...il.com>,
"James E . J . Bottomley" <jejb@...ux.ibm.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
KP Singh <kpsingh@...nel.org>, Borislav Petkov <bp@...en8.de>,
Keith Busch <kbusch@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Franky Lin <franky.lin@...adcom.com>,
Arend van Spriel <aspriel@...il.com>,
linux-ext4@...r.kernel.org,
Wenpeng Liang <liangwenpeng@...wei.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Xinming Hu <huxinming820@...il.com>,
linux-stm32@...md-mailman.stormreply.com,
Jeff Layton <jlayton@...nel.org>, linux-xfs@...r.kernel.org,
netdev@...r.kernel.org, Ying Xue <ying.xue@...driver.com>,
Manish Rangankar <mrangankar@...vell.com>,
"David S . Miller" <davem@...emloft.net>,
Toke Høiland-Jørgensen <toke@...e.dk>,
Vignesh Raghavendra <vigneshr@...com>,
Peter Zijlstra <peterz@...radead.org>,
"H . Peter Anvin" <hpa@...or.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Amitkumar Karwar <amitkarwar@...il.com>, linux-mm@...ck.org,
Andreas Dilger <adilger.kernel@...ger.ca>,
Ayush Sawal <ayush.sawal@...lsio.com>,
Andreas Noever <andreas.noever@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
linux-f2fs-devel@...ts.sourceforge.net,
Jack Wang <jinpu.wang@...os.com>,
Steffen Klassert <steffen.klassert@...unet.com>,
rds-devel@....oracle.com, Herbert Xu <herbert@...dor.apana.org.au>,
linux-scsi@...r.kernel.org, dccp@...r.kernel.org,
Richard Weinberger <richard@....at>,
Russell King <linux@...linux.org.uk>,
Jason Gunthorpe <jgg@...pe.ca>,
SHA-cyfmac-dev-list@...ineon.com, Ingo Molnar <mingo@...hat.com>,
Jakub Kicinski <kuba@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Manivannan Sadhasivam <mani@...nel.org>,
Michael Jamet <michael.jamet@...el.com>,
Kalle Valo <kvalo@...nel.org>,
Akinobu Mita <akinobu.mita@...il.com>,
linux-block@...r.kernel.org, dmaengine@...r.kernel.org,
Hannes Reinecke <hare@...e.de>,
Dmitry Vyukov <dvyukov@...gle.com>,
Jens Axboe <axboe@...nel.dk>, cake@...ts.bufferbloat.net,
brcm80211-dev-list.pdl@...adcom.com,
Yishai Hadas <yishaih@...dia.com>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
linuxppc-dev@...ts.ozlabs.org, David Ahern <dsahern@...nel.org>,
Philipp Reisner <philipp.reisner@...bit.com>,
Stephen Hemminger <stephen@...workplumber.org>,
Christoph Böhmwalder
<christoph.boehmwalder@...bit.com>, Vinod Koul <vkoul@...nel.org>,
tipc-discussion@...ts.sourceforge.net, Thomas Graf <tgraf@...g.ch>,
Johannes Berg <johannes@...solutions.net>,
Sungjong Seo <sj1557.seo@...sung.com>,
Martin KaFai Lau <martin.lau@...ux.dev>
Subject: Re: [f2fs-dev] [PATCH v1 3/5] treewide: use get_random_u32() when possible
On Thu, Oct 6, 2022 at 7:01 AM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Thu, Oct 06, 2022 at 06:33:15AM -0600, Jason A. Donenfeld wrote:
> > On Thu, Oct 06, 2022 at 10:43:31AM +0200, Jan Kara wrote:
>
> ...
>
> > > The code here is effectively doing the
> > >
> > > parent_group = prandom_u32_max(ngroups);
> > >
> > > Similarly here we can use prandom_u32_max(ngroups) like:
> > >
> > > if (qstr) {
> > > ...
> > > parent_group = hinfo.hash % ngroups;
> > > } else
> > > parent_group = prandom_u32_max(ngroups);
> >
> > Nice catch. I'll move these to patch #1.
>
> I believe coccinelle is able to handle this kind of code as well
I'd be extremely surprised. The details were kind of non obvious. I
just spent a decent amount of time manually checking those blocks, to
make sure we didn't wind up with different behavior, given the
variable reuse.
Jason
Powered by blists - more mailing lists