Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6673866ybx; Mon, 11 Nov 2019 12:48:27 -0800 (PST) X-Google-Smtp-Source: APXvYqz3RqmGuzYPc8s9RjQxYj/nEXTon0fhC3gEkM/jpEmKWIf9vmATPEuOiFlfrUBxdAF+K924 X-Received: by 2002:aa7:c887:: with SMTP id p7mr28498924eds.268.1573505306908; Mon, 11 Nov 2019 12:48:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573505306; cv=none; d=google.com; s=arc-20160816; b=hXb9hIIEoJBPhwGrSXv5p1p4LN+Xm0t7W01WM9Z6ocTgzwdGHWOT3DlFlcHpeV48Bd wpGYcdgauekwvMrjtInQN82plVjwYz/kAlHMkvTAyl/n7cB6TSMSAFFXFyJvE1IZLQG2 AJxbz/3+Uj+gY9fu9zrBCoAlLgdu4Bib0t5ln11J6HMtXnFM/9R6+QTWtHyI5b/+OGAD N0v9Yv4q/e/sYfYAt/mmQm2NjCFRMxxx2DNf+ZAxj1AFvRpMBU/nj4g0TYyS40EWW9uO 2/edcRsp5U+ydB4KErENC04iopZA2nnO+IVGTWj3yXFfaE8at0VXVDl8pVGWYaMg+NE8 4G5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OaEDXSnozFKU9AfcCmi3n5mppwBp0l4bFT/aQieMhC0=; b=XZmYl/Se7R+JfwbuyrjhjCPZdUqcqH3HeCkJm09e9HGSPZV+81F/2amPXObhtEN3Nz qLeBEadBwCzflZ/fK2EvgJXFWYhDMv0bhAzYLIl16INFn6bh8DzzrRJpC8fYE/ctT9Az YjJVwamg6GYV7Jep8pgXpv23B/ea9Wkp4A1AWN4BGyD05DRsrN1spn5I8+c0yZBq/LCP cfyf7Gkx5NqhVbLrHDOQ80c6uQVIlbL1qrfalPDzvY4y/8/hmPnVo39IU+cGybSNSl/N EyUnsV4QGWYuQkZ6bTVc6Oy9IcuGql50QhsUF5B6KmpqkVkiaNx8BceIuzb3ocq+/FIu iGqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Zs8Zzq88; 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 t11si10016564eju.106.2019.11.11.12.48.02; Mon, 11 Nov 2019 12:48:26 -0800 (PST) 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=pass header.i=@linux-foundation.org header.s=google header.b=Zs8Zzq88; 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 S1727229AbfKKUrV (ORCPT + 99 others); Mon, 11 Nov 2019 15:47:21 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45305 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726877AbfKKUrT (ORCPT ); Mon, 11 Nov 2019 15:47:19 -0500 Received: by mail-lj1-f193.google.com with SMTP id n21so15275955ljg.12 for ; Mon, 11 Nov 2019 12:47:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OaEDXSnozFKU9AfcCmi3n5mppwBp0l4bFT/aQieMhC0=; b=Zs8Zzq88VsL2T86KxW7IgVWl6ZhIIzNKAf9FuqchaKJtKHaYsoAYP+TPoclakBI6l3 ljes5eRvglTxez5EmHsBrnpio1cu+VIFH8/TCGhqHn3GzE608nn3f94tnbKbNvbVffrZ 6m3v2QDJ6S7Hl1KbBOeyM4E0K5JCKzaUiZKxc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OaEDXSnozFKU9AfcCmi3n5mppwBp0l4bFT/aQieMhC0=; b=he3hLOk+aP+ohJZaoTDT5Bw2sxIobjlbZnz1d7gppdFWta2scjV2+VnOp5x1kwO361 BoYCnAClVL2TriWcLLwaMj8HXcF5YO4O7JFMXtgWGmMONna9SBZAnZ0ZmD3hAY5vBdpE qmhC+TRjM2/+G7Gpx2LaWvoIuO6uZao7Gm6GUEyUdSvVzWX9jQImj9gvSfWwHzvt3guF 1meoypsRSMSY2yu0+xCsAPJhNTcgk5au8p1NKR5boy0xSnc7fR++lP0tS5vzOVuuzjgj /dvNn0H735XRiM5Zx+TG01Rs+4LtYDHapXQ9n098KsRy9i86KGJ6yv6RXEG40JXlCxhQ aaag== X-Gm-Message-State: APjAAAU+mPgY8fADSFVyL3GG1Mu6jDnwOvfzA79cyaZ7lTRpANJCpqmG RDZ0aSK3ymCwvwgTWlMc9AFTb5inmSo= X-Received: by 2002:a05:651c:238:: with SMTP id z24mr10301264ljn.36.1573505237219; Mon, 11 Nov 2019 12:47:17 -0800 (PST) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id 15sm7088090ljq.62.2019.11.11.12.47.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Nov 2019 12:47:14 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id d5so5782305ljl.4 for ; Mon, 11 Nov 2019 12:47:14 -0800 (PST) X-Received: by 2002:a2e:982:: with SMTP id 124mr9131365ljj.48.1573505233789; Mon, 11 Nov 2019 12:47:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Mon, 11 Nov 2019 12:46:56 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: KCSAN: data-race in __alloc_file / __alloc_file To: Eric Dumazet Cc: Alan Stern , Marco Elver , Eric Dumazet , syzbot , linux-fsdevel , Linux Kernel Mailing List , syzkaller-bugs , Al Viro , Andrea Parri , "Paul E. McKenney" , LKMM Maintainers -- Akira Yokosawa Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 11, 2019 at 12:43 PM Linus Torvalds wrote: > > Yeah, maybe we could have some model for marking "this is statistics, > doesn't need to be exact". Side note: that marking MUST NOT be "READ_ONCE + WRITE_ONCE", because that makes gcc create horrible code, and only makes the race worse. At least with a regular add, it might stay as a single r-m-w instruction on architectures that have that, and makes the quality of the statistics slightly better (no preemption etc). So that's an excellent example of where changing code to use WRITE_ONCE actually makes the code objectively worse in practice - even if it might be the same in theory. Linus