Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2561453pxk; Mon, 14 Sep 2020 17:33:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxduz8RsH+m+AE1ZU86RyL5ISN020Yp3kurrb82YU+0JwaHQVa2h7iF10OCJk+Ucr986rgx X-Received: by 2002:a17:906:30c5:: with SMTP id b5mr17654518ejb.98.1600130020022; Mon, 14 Sep 2020 17:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600130020; cv=none; d=google.com; s=arc-20160816; b=gVpRNDaPAoDY/vVR9U6WG2k6EAjfXjxvzNytXXUVPRywJvMdSSxHNgNPwuTc2N9CLH 6IkmFdU74ph0tR+kOlV+AmH3XAFAt4/BWUmzBt3ttxgb0A7mEUU0VQrC1w54IhJuaQZY c7nROqMcwZVQLJgabi45hwOo+CipO9XLK0GFLqXQzdCUmrike1oSE+Xik3gmYepJiX7W ayerNC8ums3aHCa/8T7nyOcjjF5Jpvq3oZhVK0JTa7bWTna4+zmXSRjtUm5MffogdIST vuQX78R5YA6Lj6TzcEFQtzYkV7Hs8k6JTuuF52gNGNgKyN2xjlwbV8xR1slzCH69es2b BqMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=XrK/Gc4P6emdCUgMGBlO7zHzwyttQ6LLqDXuuEBe+ss=; b=S3VgQjMpPYQZQHWME/bA3vQEQVtPm8FrmkMYBZCqmNp341EQPbyvHSDOfPVH8iSy5P Ak5Sy+7ORnH5ywIbsTZpuYNIVqG7jzY3hmqPoGu6OkW/ale4yoHS62aeFPrtQZH5X+9W lNCc5AWq0YDewk4zqiZnvZ/M65GsRNbWTSMXSRF62O4hr07obyDWss5VF21ixJSVv2Wh 76KKiyXgnxB8YzEpBgQ2DjeK/Pe6uGuZwSN4PenfDFKNfXRsSiKbFxEfZ79dqIxH+r/r I0xxxW9g+Mdz1yJVPdOlnVBPSvzq0mu8n8GWkjEEtiJ6t6QbjLLY9Xn/vFzgsbQ+pt1n hiDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u22si8245216edy.599.2020.09.14.17.33.17; Mon, 14 Sep 2020 17:33:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726094AbgIOAb4 (ORCPT + 99 others); Mon, 14 Sep 2020 20:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726019AbgIOAbz (ORCPT ); Mon, 14 Sep 2020 20:31:55 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2F4EC06174A; Mon, 14 Sep 2020 17:31:55 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHysw-00GEGT-1S; Tue, 15 Sep 2020 00:31:50 +0000 Date: Tue, 15 Sep 2020 01:31:50 +0100 From: Al Viro To: mateusznosek0@gmail.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] fs: micro-optimization remove branches by adjusting flag values Message-ID: <20200915003150.GJ3421308@ZenIV.linux.org.uk> References: <20200914174338.9808-1-mateusznosek0@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200914174338.9808-1-mateusznosek0@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14, 2020 at 07:43:38PM +0200, mateusznosek0@gmail.com wrote: > From: Mateusz Nosek > > When flags A and B have equal values than the following code > > if(flags1 & A) > flags2 |= B; > > is equivalent to > > flags2 |= (flags1 & A); > > The latter code should generate less instructions and be faster as one > branch is omitted in it. > > Introduced patch changes the value of 'LOOKUP_EMPTY' and makes it equal > to the value of 'AT_EMPTY_PATH'. Thanks to that, few branches can be > changed in a way showed above which improves both performance and the > size of the code. No. AT_EMPTY_PATH is a part of userland ABI; to tie LOOKUP_EMPTY to it means that we can't ever modify the sucker. Worse, it restricts any possible reshuffling of the LOOKUP_... bits in the future. So unless you can show an effect on the real-world profiles, there are fairly strong reasons to avoid that headache.