Return-Path: Received: from mail-it0-f47.google.com ([209.85.214.47]:40753 "EHLO mail-it0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbdKMXyZ (ORCPT ); Mon, 13 Nov 2017 18:54:25 -0500 MIME-Version: 1.0 In-Reply-To: References: <87efp1zsww.fsf_-_@rasmusvillemoes.dk> From: Linus Torvalds Date: Mon, 13 Nov 2017 15:54:24 -0800 Message-ID: Subject: Re: bit tweaks [was: Re: [nfsd4] potentially hardware breaking regression in 4.14-rc and 4.13.11] To: Rasmus Villemoes Cc: Patrick McLean , Al Viro , Bruce Fields , "Darrick J. Wong" , Linux Kernel Mailing List , Linux NFS Mailing List , stable , Thorsten Leemhuis Content-Type: text/plain; charset="UTF-8" Sender: linux-nfs-owner@vger.kernel.org List-ID: On Mon, Nov 13, 2017 at 3:30 PM, Linus Torvalds wrote: > > So let's just rewrite that mnt_flags conversion that way, justr to get > gcc to generate the obvious code. Oh wow. I tried to do the same thing in fs/namespace.c where it does the reverse bit translation, and gcc makes a _horrible_ mess of it and actually makes the code much worse because for some reason the pattern doesn't trigger. So this gcc optimization is apparently pretty damn fragile in general. It triggers for the trivial cases, but then other code around it can confuse it badly. So I don't think I'll touch this, it seems to not be really reliably something that makes gcc generate what should be the obvious code.. Linus