From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 030B634C155; Thu, 12 Mar 2026 13:46:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773323212; cv=none; b=vCKMQg4VWnTxAHMobonoj/BoKmtFjxn8f++VMKgtYlR6WBUNk6iLK2qB16Zxr8KudKh+Nzkdgdn+R/yhKIm/ZDawEepVNa9zj/j+X+dXSr+S63vgDPsXm56UA5Yt/UOoOGbv42WS6YZDABfSBVRX2cZV8PntGh/hPzRIS5yqEzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773323212; c=relaxed/simple; bh=l8xdTzfmFI9blWnX69yppRL0CTG4tWAVHoV5RzxnJ4M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=e3szPqUW2HQk/WsgBaaiKQi3OK9Lgms9FdbJf+fxLOdV18jAwKpwXTRiHOMJJniQGTkP4FBs2msWCh14hxgfLT41bpDjaQez2YKUVgWqEIiGxO4qBb78EZcZbYexzJE8owy5p2Az4uaptmnx9NweKk4mIw7ohl6a0vG2macg+gw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b=aNowo7eU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="aNowo7eU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0435C4CEF7; Thu, 12 Mar 2026 13:46:46 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="aNowo7eU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1773323205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=l8xdTzfmFI9blWnX69yppRL0CTG4tWAVHoV5RzxnJ4M=; b=aNowo7eUwaDEsiVlTqmEAkItMBfiAqnQpwNdW5+Iir3vEvTnk82QibP2d05ImlF0a165mh nmvWlvpeFzo1/3YJJgy9A68B3kA75iz0ORvDTg44s5evgsV+Q5arPoARsc9Mpj0kc03vTo y0krEtMS6grTzTv7HePJJwYz8b+7S/w= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d18605ad (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 12 Mar 2026 13:46:44 +0000 (UTC) Date: Thu, 12 Mar 2026 14:46:39 +0100 From: "Jason A. Donenfeld" To: Christoph Hellwig Cc: Andrew Morton , Richard Henderson , Matt Turner , Magnus Lindholm , Russell King , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "David S. Miller" , Andreas Larsson , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Herbert Xu , Dan Williams , Chris Mason , David Sterba , Arnd Bergmann , Song Liu , Yu Kuai , Li Nan , Theodore Ts'o , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-crypto@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-arch@vger.kernel.org, linux-raid@vger.kernel.org Subject: Re: [PATCH 26/27] random: factor out a __limit_random_u32_below helper Message-ID: References: <20260311070416.972667-1-hch@lst.de> <20260311070416.972667-27-hch@lst.de> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260311070416.972667-27-hch@lst.de> On Wed, Mar 11, 2026 at 08:03:58AM +0100, Christoph Hellwig wrote: > Factor out the guts of __get_random_u32_below into a new helper, > so that callers with their own prng state can reuse this code. What Eric said. random.c is not "some library code" meant to be pulled apart like this. If you think there are some good general purpose arithmetic functions, by all means develop shared infrastructure in the right place. But I think for this super simple/trivial _below function, you can probably just place it additionally where you're using it, without needing to touch random.c.