From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mail19.linbit.com (LINBIT Mail Daemon) with ESMTP id 3A3454201C4 for ; Thu, 6 Oct 2022 15:09:01 +0200 (CEST) Date: Thu, 6 Oct 2022 16:01:11 +0300 From: Andy Shevchenko To: "Jason A. Donenfeld" Message-ID: References: <20221005214844.2699-1-Jason@zx2c4.com> <20221005214844.2699-4-Jason@zx2c4.com> <20221006084331.4bdktc2zlvbaszym@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: Andrew Lunn , "Darrick J . Wong" , linux-block@vger.kernel.org, Marcelo Ricardo Leitner , dri-devel@lists.freedesktop.org, Andrii Nakryiko , Hans Verkuil , linux-sctp@vger.kernel.org, "Md . Haris Iqbal" , Miquel Raynal , Yehezkel Bernat , Christoph Hellwig , Andy Gospodarek , Sergey Matyukevich , Rohit Maheshwari , Michael Ellerman , Christophe Leroy , Jozsef Kadlecsik , Nilesh Javali , Jean-Paul Roubelat , Dan Williams , Dick Kennedy , Jay Vosburgh , Potnuri Bharat Teja , Vinay Kumar Yadav , Arend van Spriel , Nicholas Piggin , Igor Mitsyanko , Andy Lutomirski , linux-hams@vger.kernel.org, Thomas Gleixner , Trond Myklebust , "Martin K . Petersen" , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Michael Chan , linux-kernel@vger.kernel.org, Varun Prakash , Martin KaFai Lau , David Ahern , Chuck Lever , netfilter-devel@vger.kernel.org, linux-crypto@vger.kernel.org, Jiri Olsa , Jan Kara , linux-fsdevel@vger.kernel.org, Andrew Morton , Claudiu Beznea , Sharvari Harisangam , linux-fbdev@vger.kernel.org, linux-doc@vger.kernel.org, Vignesh Raghavendra , linux-wireless@vger.kernel.org, Dave Hansen , Song Liu , Eric Dumazet , target-devel@vger.kernel.org, John Stultz , Stanislav Fomichev , Gregory Greenman , drbd-dev@lists.linbit.com, dev@openvswitch.org, Leon Romanovsky , Helge Deller , Hugh Dickins , James Smart , Anil S Keshavamurthy , Pravin B Shelar , Julian Anastasov , coreteam@netfilter.org, Veaceslav Falico , Yonghong Song , Namjae Jeon , linux-media@vger.kernel.org, Ganapathi Bhat , linux-actions@lists.infradead.org, Simon Horman , Jaegeuk Kim , Mika Westerberg , Lars Ellenberg , OGAWA Hirofumi , Hao Luo , Theodore Ts'o , Stephen Boyd , Jonathan Corbet , Florian Westphal , "David S . Miller" , Jon Maloy , Anna Schumaker , Jeff Layton , Haoyue Xu , Heiner Kallweit , Ulf Hansson , Rasmus Villemoes , linux-nvme@lists.infradead.org, Michal Januszewski , linux-mtd@lists.infradead.org, kasan-dev@googlegroups.com, Cong Wang , Thomas Sailer , Ajay Singh , Sagi Grimberg , Daniel Borkmann , Dennis Dalessandro , linux-rdma@vger.kernel.org, lvs-devel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "Naveen N . Rao" , Ilya Dryomov , Paolo Abeni , Pablo Neira Ayuso , Marco Elver , Kees Cook , Yury Norov , "James E . J . Bottomley" , Hante Meuleman , Alexandre Torgue , Borislav Petkov , Keith Busch , ceph-devel@vger.kernel.org, Mauro Carvalho Chehab , Franky Lin , linux-nfs@vger.kernel.org, linux-ext4@vger.kernel.org, Wenpeng Liang , Neil Horman , Xinming Hu , linux-mmc@vger.kernel.org, SHA-cyfmac-dev-list@infineon.com, linux-xfs@vger.kernel.org, Ying Xue , Manish Rangankar , Andreas =?iso-8859-1?Q?F=E4rber?= , Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= , Jan Kara , linux-stm32@st-md-mailman.stormreply.com, Peter Zijlstra , Ayush Sawal , KP Singh , Amitkumar Karwar , linux-mm@kvack.org, Andreas Dilger , Akinobu Mita , "H . Peter Anvin" , Andreas Noever , Jiri Pirko , linux-f2fs-devel@lists.sourceforge.net, Jack Wang , Steffen Klassert , rds-devel@oss.oracle.com, Herbert Xu , linux-scsi@vger.kernel.org, dccp@vger.kernel.org, Richard Weinberger , Russell King , Jason Gunthorpe , Ingo Molnar , Jakub Kicinski , Masami Hiramatsu , John Fastabend , Maxime Coquelin , Manivannan Sadhasivam , Michael Jamet , Kalle Valo , Santosh Shilimkar , Jamal Hadi Salim , linux-raid@vger.kernel.org, Thomas Graf , Hannes Reinecke , Xiubo Li , Dmitry Vyukov , Jens Axboe , cake@lists.bufferbloat.net, brcm80211-dev-list.pdl@broadcom.com, Yishai Hadas , Hideaki YOSHIFUJI , netdev@vger.kernel.org, Vlad Yasevich , Philipp Reisner , Stephen Hemminger , Vinod Koul , tipc-discussion@lists.sourceforge.net, dmaengine@vger.kernel.org, Johannes Berg , Sungjong Seo , linuxppc-dev@lists.ozlabs.org Subject: Re: [Drbd-dev] [f2fs-dev] [PATCH v1 3/5] treewide: use get_random_u32() when possible List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, so Kees' proposal to use it seems more plausible since it's less error prone and more flexible / powerful. -- With Best Regards, Andy Shevchenko