From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48385C32771 for ; Wed, 28 Sep 2022 11:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233539AbiI1LiA (ORCPT ); Wed, 28 Sep 2022 07:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233481AbiI1Lh5 (ORCPT ); Wed, 28 Sep 2022 07:37:57 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6517BF28 for ; Wed, 28 Sep 2022 04:37:55 -0700 (PDT) Date: Wed, 28 Sep 2022 13:37:52 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1664365073; 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=gaIVD5wYN/yVh5b5eLakU9sgF+3mfkitytzDMroeUho=; b=SP2BhMl+kG5yxiGkfAnEfHEuZ3CXqwOo4Y456IqUmj03Vd+hXdLczHaXe1w2RTmlQMa4/2 EEJiyNeDJAVIdzPa/wep6L5IxbsltHcIUAXoyRp3hQU9sFdmzj3JH/CUQ4EZyvsUeC8NAV nypZay3VKPHKm1xq+nDFy4kUOsPfcQpz/vpYI37tmGlQ37T3f8Ew/76NAr+Tv5xgviW2mN R2dVvlVd7SVJxg/k5vaPhdnGHc17KCtLLWa8aKToMUmq8gAmYUGmX4MIg72oTJsiaRGl8R 85QKUJoR2jqAJu/zRYMYdZRmM2nfMFI43+VY1LeG6yHEs+mZ5j/+JrZoCqy+7A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1664365073; 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=gaIVD5wYN/yVh5b5eLakU9sgF+3mfkitytzDMroeUho=; b=8zZkMfpcdKOLXk2RjZtHKxLMTv1aY6rKvJ1mZab8iRyg4Q3H3XRS4WlcIeHmeFGi15k+8h tpKffSOemXY0HNCQ== From: Sebastian Andrzej Siewior To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, Sultan Alsawaf Subject: Re: [PATCH] random: avoid reading two cache lines on irq randomness Message-ID: References: <20220923182849.4145148-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220923182849.4145148-1-Jason@zx2c4.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-09-23 20:28:49 [+0200], Jason A. Donenfeld wrote: > In order to avoid reading and dirtying two cache lines on every IRQ, move > the work_struct to the bottom of the fast_pool struct. add_interrupt_ > randomness() always touches .pool and .count, which are currently split, > because .mix pushes everything down. Instead, move .mix to the bottom, > so that .pool and .count are always in the first cache line, since the > .mix is only accessed when the pool is full. > > Fixes: 58340f8e952b ("random: defer fast pool mixing to worker") > Cc: Sebastian Andrzej Siewior > Cc: Sultan Alsawaf > Signed-off-by: Jason A. Donenfeld Reviewed-by: Sebastian Andrzej Siewior Yup, makes sense. Sebastian