Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3710318imm; Mon, 18 Jun 2018 02:45:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKfoyPq0D2gRN7KUFsgUs5a+Dq0nfpTSoyMqeVdbWHh63CD0g1hoijk4/9sbowIe03vJVz/ X-Received: by 2002:a65:48c9:: with SMTP id o9-v6mr10519899pgs.262.1529315144374; Mon, 18 Jun 2018 02:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529315144; cv=none; d=google.com; s=arc-20160816; b=yJdAL5V09Oynasexr0PRxVynm61RSBkaRyFhWJj3W2SBNWIaxlAaNHRqklrq8F5sN1 DvLP8wa9gD5B2SUY9QSwoXca9sW2UAucc4iiJS2OtDHaqxNkqRzr5QtNKeVDvk3+WVqb TOyU2fQMlyfrP7CJN3sphM2uxf3HvBUUejMrP/6x40bnM/63X+NA8jgCtSsmmURwN5Fq 60mLcZp7947TzoSOwZz4gLTG/MfJd7qr/yzo7tvM8GjIsYjPIuzpGN81zrb2qMW6jqZq uK0gnIHKcuj38HHMpAzjtPos1P5Ld2B+hF0aaJHTQlA+WVVUOlWLB6VFlRcyh1Q/5bL/ jlnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Fs1wYfoe3guBtglX3Xc6bYm+R5vtZLQXcMFKCcWVbZg=; b=k5uqxp9dpxdM9FmvUqfJM0jE8sLo1ynv6wfKuWjhcI46/nLWchEckfG+67zIngDf8L Dsziim7q2sxKvG8+xghRMlyO00Th8LFYZL8xHxV1ewEZcpPytSvIXhr+ddFwWBTFQXZS 9w8uamYzkGqCnHAqvPai0xdS/S1YfLmfVSPiSRTlAv1A6Q2ECKdWhlypdsBxzFMnzevn 3s0I7Iftplz7lDQXwua9Xy3cJKhZoxcCsRbt8+3nBr8LVcoOQJx/PrLtXVwjoQHhS3x/ QDQvQ4c1q6TwYdsuRFoOii5LvcvisMJ6LWSKuysqv4fHV1LTeYxXKU1crrvrmOArm2VK +jZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SGqwAmoD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v127-v6si11760083pgv.212.2018.06.18.02.45.30; Mon, 18 Jun 2018 02:45:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SGqwAmoD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936013AbeFRJoy (ORCPT + 99 others); Mon, 18 Jun 2018 05:44:54 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59836 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755056AbeFRJow (ORCPT ); Mon, 18 Jun 2018 05:44:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Fs1wYfoe3guBtglX3Xc6bYm+R5vtZLQXcMFKCcWVbZg=; b=SGqwAmoDVwFnBI2aPSOHXj8qx 0fcLyluZ9vCRqKTpbhvqPrwGgMYUHyzBNAIAm6MZGBRKr3mlvgaQPbYRxasfLTha9H3N5zKKJdC+Q bX9gWMUt/6OVi3BRjA4PCfNHAG9dAB1YEF5Lw1+sFdo1yXCrQUSkzliGu+F45+ZtrEV576AR9VUlx KSQm2Z9ZDDJxm+2Oap5gVINHwo854hI+HAPgnT9t9V5hmddAOcmvhVFisIDIKetSPr5mtwL9e6ydt RVCjMjU2sS2XQhovsK5Z1qrXoNvWOQt/kCrrppRsKFyi1RERCGui3Ctxomv81ZW4vmxBKHSi8K+Uz FbatiiC9g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUqiP-0004ak-Du; Mon, 18 Jun 2018 09:44:49 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9EB5B2029FA11; Mon, 18 Jun 2018 11:44:47 +0200 (CEST) Date: Mon, 18 Jun 2018 11:44:47 +0200 From: Peter Zijlstra To: "Jason A. Donenfeld" Cc: Thomas Gleixner , LKML , X86 ML , Andy Lutomirski Subject: Re: Lazy FPU restoration / moving kernel_fpu_end() to context switch Message-ID: <20180618094447.GG2458@hirez.programming.kicks-ass.net> References: <20180615193438.GE2458@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 15, 2018 at 10:30:46PM +0200, Jason A. Donenfeld wrote: > On Fri, Jun 15, 2018 at 9:34 PM Peter Zijlstra wrote: > > Didn't we recently do a bunch of crypto patches to help with this? > > > > I think they had the pattern: > > > > kernel_fpu_begin(); > > for (units-of-work) { > > do_unit_of_work(); > > if (need_resched()) { > > kernel_fpu_end(); > > cond_resched(); > > kernel_fpu_begin(); > > } > > } > > kernel_fpu_end(); > > Right, so that's the thing -- this is an optimization easily available > to individual crypto primitives. But I'm interested in applying this > kind of optimization to an entire queue of, say, tiny packets, where > each packet is processed individually. Or, to a cryptographic > construction, where several different primitives are used, such that > it'd be meaningful not to have to get the performance hit of > end()begin() in between each and everyone of them. I'm confused.. how does the above not apply to your situation?