Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3304520lfo; Mon, 23 May 2022 01:11:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrDh9W4yzkXJYiqIJuhzXJeT+mdqXebIMV4hQfnMsEegob3gCRLreXzrf1ObFUgLJqiu1S X-Received: by 2002:a17:902:a583:b0:15d:197b:9259 with SMTP id az3-20020a170902a58300b0015d197b9259mr21823985plb.51.1653293500098; Mon, 23 May 2022 01:11:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653293500; cv=none; d=google.com; s=arc-20160816; b=f0TVmKv7PStep8ztVKV61CAGQIpQIDlo9Ig7hhq4GaFlUoNJPDKY78i36kpDmkZwX+ PQ2u8/vlMnRc8rCBxS+cegpymciaC0n6UHBA2YH/LYOwTTGGr3qWHegCYkyqasMMcutZ 2xWU+QkifWPru1SvYJdgC9dz06PdB0rK3Cd5V8qoAqGsuooqPMuxGIHbPzYYnRVZLbRr YKH1rpIAw/blS4cMj+mX4JXOYr5kicY5LZp0P+7097pBGxY8UIo/0I7Mr+/oDCIvej4/ H8dGpFLtByqMoHwD0pg0SH3MMjGi8skDfYXvktIKxtIgAy3BkPfnN7368fPsXja0rwdE XD8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pUosTam6sJ3QFBqPm2/0VkGE5we6zMbpQ9U8h/KBbBA=; b=z8eQByx819HkqYXc9G+7bia0jw03+sKHwR8D2ztv4j2ZSXDl1xQ+TFM4AqckkgnYZ4 LYnTXlP/f/W71DwK5NeFh1v/lVou7OpRi8SYLCGnvnqRWX5c4vqXq2BZ08a8qadOix5s 4y/SoCtIIA4vodQ816IsyNldePn7bMpXJ4FR7co6Os9ZaPTEWp6m+WaIsoqOJR3Zxehf 4pvB/R95W/1illckF8dquHbIp6ryOlaXKjCIi90bArWrHywbcor1PNzkp1MSPmvzfBm8 goBsCZYufIXaZ5IFDgc0rL87YrjnOPeIN4yP79aGZp/s2mITamqMXl1b137vmkDbhhiN hfNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=NbhhjPbe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e63-20020a636942000000b003a9f9703091si8801558pgc.338.2022.05.23.01.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 01:11:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=NbhhjPbe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A12BE6AA45; Mon, 23 May 2022 00:06:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351112AbiETPzP (ORCPT + 99 others); Fri, 20 May 2022 11:55:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244131AbiETPzO (ORCPT ); Fri, 20 May 2022 11:55:14 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B7E815EA41 for ; Fri, 20 May 2022 08:55:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E3ABFCE2991 for ; Fri, 20 May 2022 15:55:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B34E9C34100; Fri, 20 May 2022 15:55:08 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="NbhhjPbe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1653062107; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pUosTam6sJ3QFBqPm2/0VkGE5we6zMbpQ9U8h/KBbBA=; b=NbhhjPbeQRm3SkmaBPqs4icVbL8d/4Oyn/EYFkDr+nDFbkxeKrWegBzml8pOpvVHS/w7fv ip8Qfd8P0OJ7NKq7jU2m8F1gnbQauwluw41MpowDGCyrsG9L2GaJvPoOVNJLkj1SZXndDZ vOVECAGJr22wyFyOYmNqPl3h97nGSqI= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 47eeb361 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 20 May 2022 15:55:06 +0000 (UTC) Date: Fri, 20 May 2022 17:55:05 +0200 From: "Jason A. Donenfeld" To: Jens Axboe Cc: Theodore Ts'o , Christoph Hellwig , LKML , Al Viro Subject: Re: [PATCH v4 0/3] random: convert to using iters, for Al Viro Message-ID: References: <20220520094459.116240-1-Jason@zx2c4.com> <0a6ed6b9-0917-0d83-5c45-70ff58fad429@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0a6ed6b9-0917-0d83-5c45-70ff58fad429@kernel.dk> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jens, On Fri, May 20, 2022 at 09:44:25AM -0600, Jens Axboe wrote: > Ran 32, 1k, 4k here and it does seem to be down aboout 3%. Which is > definitely bigger than I expected, particularly for larger reads. If > anything, the 32b read seems comparably better than eg 1k or 4k, which > is also unexpected. Let me do a bit of profiling to see what is up. Something to keep in mind wrt 32b is that for complicated crypto reasons, the function has this logic: - If len <= 32, generate one 64 byte block and give <= 32 bytes of it to the caller. - If len > 32, generate one 64 byte block, but give 0 of it to the caller. Then generate ⌈len/64⌉ blocks for the caller. Put together, this means: - 1..32, 1 block - 33..64, 2 blocks - 65..128, 3 blocks - 129..196, 4 blocks So you get this sort of shelf where the amortization benefits don't really kick in until after 3 blocks. > If you're worried about it, I'd just keep the read/write and add the > iter variants on the side. Not a chance of that. These functions are already finicky as-is; I would really hate to have to duplicate all of these paths. Jason