Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1035315imm; Thu, 6 Sep 2018 14:16:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZHQkg7myBctnmKUXgqvdMRnQFkvsNOlqhvr577LQpsS1Egs6xU9X97/bMD9YwV3Syb7ktR X-Received: by 2002:a17:902:b115:: with SMTP id q21-v6mr4738636plr.333.1536268572144; Thu, 06 Sep 2018 14:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536268572; cv=none; d=google.com; s=arc-20160816; b=Dl4LKIlnOFA1a1Vhj0b+tjHp6xJ4MNxzRblJ1TY0ct64c9/uCqRbAicYRpt7N5SSJY 72FHuXVH8iw+oKH5hfbKSpkkmjlK946rQTjFpwM1RVUbAr6GfTbMUimISrU5TtwfX3wb gjgxtcBNMSaC0jVA6uGkEr2wHlABhxpbHvG9+Jgj56yNQmgVjdXacwGYIaAuUdUEaQaU rM5JT1UVYoBOvGP7tiii17iC+HtupRGQ5lFihcN5Wgv2sf/Ixfg+cIIvRB7R549lp6qy xq6Ppk3AZiqOwl1ruWi+OOnPvhAh0jFd2dR1giR4UOeQARFoz4KdICqYOevFqs9Uppnt XiFg== 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; bh=6wTmRSdEXXiquxYTRtuIgcije3CnEPAwPJlE5RvZkRs=; b=oQzch38bFjVe3CRppgkksYU9djuuKdAxPDrGlY8YukGpOakDDcUMg+qH//yBqY6K74 1WfwcKFkrAy8jsjcwNMWGEetaEK/iGTIx3MBcjWpraa8Npf/aqWE4JoIEZXuPipo5tVJ 6rN2lO1EwMqtEmYaWSj0QhpMCFaTTJ+xAKn2Op0nXQa8fAAQE/JrjOV7pDUJOdh1glD7 NJl0kpdBQVt9kwaNHaR/S0yzxAZeySpdD+dJuAVh9Awv7Euj4jKnHcYrZP9xEDA5lWha bRikTrCEan/oQPUTSilO1A5zHP5LgfFrIJ7IlvidMgXTDlJC+EZ6Wld0t9UGVqEStdxB 7EDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=onTUpfNh; 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 be5-v6si6025666plb.67.2018.09.06.14.15.56; Thu, 06 Sep 2018 14:16:12 -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=merlin.20170209 header.b=onTUpfNh; 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 S1729550AbeIFXsy (ORCPT + 99 others); Thu, 6 Sep 2018 19:48:54 -0400 Received: from merlin.infradead.org ([205.233.59.134]:48184 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729536AbeIFXsy (ORCPT ); Thu, 6 Sep 2018 19:48:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=6wTmRSdEXXiquxYTRtuIgcije3CnEPAwPJlE5RvZkRs=; b=onTUpfNhtNLuyKrDz8WJyHp/j tx14LzojebUCbUmGuQKa9Br57cNUY3uMBkMf3vmMvaOLRP72aFKnjw3Y3APyOBps7msqJrUjpnPI+ 0wy9a1GMx5OzuKqE31Ltka9l9TrVR9EGb/YnTIRCKMTwsEdvIhWYHRVwIdHfvpJ1a5/jOpxaF6OOE SM00o9KrK7UIys2EnrDrO/5QzxbYwmFnud8o3FyWv0m9V0AUGdc+uz34MVeGxQTS2gdZ5O0SU4jAs O2O/u2Q33P2riaxGBmveuDNc+hkfJEGda66/k6xBlu3okVqTQkO527NJZUNya8niV0u37uI+tHlVz VK/QX67hQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fxzh1-0004U8-Bz; Thu, 06 Sep 2018 19:11:52 +0000 Received: by worktop (Postfix, from userid 1000) id D31146E0AA9; Thu, 6 Sep 2018 21:11:40 +0200 (CEST) Date: Thu, 6 Sep 2018 21:11:40 +0200 From: Peter Zijlstra To: Davidlohr Bueso Cc: Andrew Morton , jbaron@akamai.com, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, Thomas Gleixner Subject: Re: [PATCH -next 0/2] fs/epoll: loosen irq safety when possible Message-ID: <20180906191140.GA4816@worktop.programming.kicks-ass.net> References: <20180720172956.2883-1-dave@stgolabs.net> <20180720124212.7260d76d83e2b8e5e3349ea5@linux-foundation.org> <20180720200559.27nc7j2rrxpy5p3n@linux-r8p5> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180720200559.27nc7j2rrxpy5p3n@linux-r8p5> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 20, 2018 at 01:05:59PM -0700, Davidlohr Bueso wrote: > On Fri, 20 Jul 2018, Andrew Morton wrote: > >I'm surprised. Is spin_lock_irqsave() significantly more expensive > >than spin_lock_irq()? Relative to all the other stuff those functions > >are doing? If so, how come? Some architectural thing makes > >local_irq_save() much more costly than local_irq_disable()? > > For example, if you compare x86 native_restore_fl() to xen_restore_fl(), > the cost of Xen is much higher. Xen is a moot argument. IIRC the point is that POPF (as used by *irqrestore()) is a very expensive operation because it changes all flags and thus has very 'difficult' instruction dependencies, killing the front end reorder and generating a giant bubble in the pipeline. Similarly, I suppose PUSHF is an expensive instruction because it needs all the flags 'stable' and thus needs to wait for a fair number of prior instructions to retire before it can get on with it. Combined the whole PUSHF + POPF is _far_ more expensive than STI + CLI, because the latter only has dependencies on instructions that muck about with IF -- not that many.