mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	Andy Lutomirski <luto@amacapital.net>
Subject: Re: [PATCH 1/2] random: use chacha20 for get_random_int/long
Date: Sat, 21 Jan 2017 01:24:32 -0500	[thread overview]
Message-ID: <20170121062432.kf7xnu56g7vvh4ky@thunk.org> (raw)
In-Reply-To: <CAHmME9p3xc6Q2Qu6kEP1O3PmvLKhpWcwjHfX8AQyibC0Quh65g@mail.gmail.com>

On Sat, Jan 21, 2017 at 01:16:56AM +0100, Jason A. Donenfeld wrote:
> On Sat, Jan 21, 2017 at 1:15 AM, Theodore Ts'o <tytso@mit.edu> wrote:
> > But there is a shared pointer, which is used both for the dedicated
> > u32 array and the dedicated u64 array.  So when you increment the
> > pointer for the get_random_u32, the corresponding entry in the u64
> > array is wasted, no?
> 
> No, it is not a shared pointer. It is a different pointer with a
> different batch. The idea is that each function gets its own batch.
> That way there's always perfect alignment. This is why I'm suggesting
> that my approach is faster.

Oh, I see.  What was confusing me was that you used the same data
structure for both, and but you were using different instances of the
structure for get_random_u32 and get_random_u64.  I thought you were
using the same batched_entropy structure for both.  My bad.

I probably would have used different structure definitions for both,
but that's probably because I really am not fund of unions at all if
they can be avoided.  I thought you were using a union because you
were deliberately trying to use one instance of the structure as a per
cpu variable for u32 and u64.

So that's not how I would do things, but it's fine.

						- Ted
					

  reply	other threads:[~2017-01-21  6:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 18:32 Jason A. Donenfeld
2017-01-06 18:32 ` [PATCH 2/2] random: convert get_random_int/long into get_random_u32/u64 Jason A. Donenfeld
2017-01-18  3:49 ` [PATCH 1/2] random: use chacha20 for get_random_int/long Theodore Ts'o
2017-01-20  5:27   ` Jason A. Donenfeld
2017-01-20 14:28     ` Theodore Ts'o
2017-01-20 15:38       ` Jason A. Donenfeld
2017-01-21  0:10         ` Theodore Ts'o
2017-01-21  0:13           ` Jason A. Donenfeld
2017-01-20 15:47       ` Jason A. Donenfeld
2017-01-21  0:15         ` Theodore Ts'o
2017-01-21  0:16           ` Jason A. Donenfeld
2017-01-21  6:24             ` Theodore Ts'o [this message]
2017-01-21 14:08               ` Jason A. Donenfeld
2017-01-22 11:24                 ` Greg Kroah-Hartman
2017-01-22 12:21                   ` Jason A. Donenfeld
2017-01-22 15:20                     ` Greg Kroah-Hartman
2017-01-22 15:34                       ` Jason A. Donenfeld
2017-01-22 15:34                         ` [PATCH 2/2] random: convert get_random_int/long into get_random_u32/u64 Jason A. Donenfeld
2017-01-22 22:28                       ` [PATCH 1/2] random: use chacha20 for get_random_int/long Theodore Ts'o
2017-01-22 22:49                         ` Jason A. Donenfeld
2017-01-23  0:33                           ` Theodore Ts'o
2017-01-23  8:12                         ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2016-12-22 18:07 Jason A. Donenfeld

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=20170121062432.kf7xnu56g7vvh4ky@thunk.org \
    --to=tytso@mit.edu \
    --cc=Jason@zx2c4.com \
    --cc=hannes@stressinduktion.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    /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®