mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] random: move initialization functions out of hot pages
Date: Sun, 15 May 2022 13:13:28 +0200	[thread overview]
Message-ID: <YoDgWDBJaXWHv/R6@owl.dominikbrodowski.net> (raw)
In-Reply-To: <20220513142908.341220-1-Jason@zx2c4.com>

Am Fri, May 13, 2022 at 04:29:08PM +0200 schrieb Jason A. Donenfeld:
> Much of random.c is devoted to initializing the rng and accounting for
> when a sufficient amount of entropy has been added. In a perfect world,
> this would all happen during init, and so we could mark these functions
> as __init. But in reality, this isn't the case: sometimes the rng only
> finishes initializing some seconds after system init is finished.
> 
> For this reason, at the moment, a whole host of functions that are only
> used relatively close to system init and then never again are intermixed
> with functions that are used in hot code all the time. This creates more
> cache misses than necessary.
> 
> In order to pack the hot code closer together, this commit moves the
> initialization functions that can't be marked as __init into
> .text.unlikely by way of the __cold attribute.
> 
> Of particular note is moving credit_init_bits() into a macro wrapper
> that inlines the crng_ready() static branch check. This avoids a
> function call to a nop+ret, and most notably prevents extra entropy
> arithmetic from being computed in mix_interrupt_randomness().

	Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>

Thanks,
	Dominik

      reply	other threads:[~2022-05-15 11:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 14:29 Jason A. Donenfeld
2022-05-15 11:13 ` Dominik Brodowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoDgWDBJaXWHv/R6@owl.dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=Jason@zx2c4.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®