Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2447910ybv; Sat, 8 Feb 2020 23:16:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzeORgbDMg+MYCoALQ3x81sNUjfcUDhyKwJCGoGz+fOFZQNkbAOuz2iNwYvxXQslwYid4gq X-Received: by 2002:aca:1005:: with SMTP id 5mr7397152oiq.16.1581232596642; Sat, 08 Feb 2020 23:16:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581232596; cv=none; d=google.com; s=arc-20160816; b=0HN1HMGlXdj0skBsrS4dCuAFeawerD3pycrvqRB05zn4FHROV0KR5l4hV5Z1SELyu+ EPVyXqsmNxbAKn5wxhSwOxxasm4TatVQ6eWDY7hk/2ypfksZ4WhOK67JTWuJDC0Buipr IFhLyDKB8uUonns4i0krR51nRViH2JBlH/vOZHT/FlgYdeiHba6FgwlM/TyNgojDnyIU bggbegU2pzPHWAoCOi/jJmuyU3M531dNh1LcEUxxpoRvmZUoK4sOwZPDXYBsiz4+xH7H actHaQy+nL0re4OPgpNkSoc3kPalGgcBL/H9I0PlVot/yHnuwS3nPmKeggI3rlmhFpBM s3XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=wjG49hByqLN66EPjA1v8gaQtgrxSiSZBB9BPZmnH7A0=; b=TwwWzIq4WgJfg8T55GYpNJkOPkm/B+5MBHztYu+r7ZQUYIZqeGY4uogjS8uNko7jJg VyhXXgPnb1UrkqzP1SWFtnpzMlgcqHZYCmn5dvsWQN0wVyHplgMmNiCxjQwpXr7BDW1Z zxDeEdfDlsHj77Fb4IUXu9Gd699rl0KXm7b8Fm9tulDmzVWm4gim2sG24mJ56rrInG4j YK4Kaidsny8bmV4146VaAZwvui7gto4jMiP10aROdJPeDokmEti/b/mt3LXcwjIqzLQG SO95AXye9hISsSm++i61g4CNhLSukXPwgfgZVFdem1VnVBn3jo1HcCHxwZr7wABpSlLo grng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=b3EWJEel; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si3061907otq.183.2020.02.08.23.16.23; Sat, 08 Feb 2020 23:16:36 -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=@nvidia.com header.s=n1 header.b=b3EWJEel; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725933AbgBIHPs (ORCPT + 99 others); Sun, 9 Feb 2020 02:15:48 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:6413 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbgBIHPs (ORCPT ); Sun, 9 Feb 2020 02:15:48 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sat, 08 Feb 2020 23:15:33 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Sat, 08 Feb 2020 23:15:47 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sat, 08 Feb 2020 23:15:47 -0800 Received: from [10.2.168.157] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 9 Feb 2020 07:15:47 +0000 Subject: Re: [PATCH] mm: fix a data race in put_page() To: Qian Cai CC: Marco Elver , Jan Kara , David Hildenbrand , Andrew Morton , , Dan Williams , Linux Memory Management List , Linux Kernel Mailing List , "Paul E. McKenney" References: <5402183a-2372-b442-84d3-c28fb59fa7af@nvidia.com> <8602A57D-B420-489C-89CC-23D096014C47@lca.pw> From: John Hubbard X-Nvconfidentiality: public Message-ID: <1a179bea-fd71-7b53-34c5-895986c24931@nvidia.com> Date: Sat, 8 Feb 2020 23:12:48 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <8602A57D-B420-489C-89CC-23D096014C47@lca.pw> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1581232533; bh=wjG49hByqLN66EPjA1v8gaQtgrxSiSZBB9BPZmnH7A0=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=b3EWJEelmm627JvqIaLU4arFl7f13Xcl+6rx30LH1UiX9DYyGfpsGVYvecDcwcwBe 2ZTpRnsmdVwf6aULmvHjy0RkhtfoXtP2P8liqoN91WISyIRgANTnA9qjyx14DoGJFz MeEb9g9iwFR0ohyS29uM2wcdd4OPr7g1frIFYCV2Q24mowy7WqECzhYaF2wfJi2kSy bmjQCcEEwpHq+ouly/aKUv/jzY0WmIDTgzsYJzRQSQ9IMnk/FgABwiF+clSbTe30nl pQkeM4kBsfJYwotPLFVj2Xvx2HWhfSBGdC1IJigl5og87dxhoKwX3eSkuiZRD2e7zl mrYCToeTWroZQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/8/20 7:10 PM, Qian Cai wrote: >=20 >=20 >> On Feb 8, 2020, at 8:44 PM, John Hubbard wrote: >> >> So it looks like we're probably stuck with having to annotate the code. = Given >> that, there is a balance between how many macros, and how much commentin= g. For >> example, if there is a single macro (data_race, for example), then we'll= need to >> add comments for the various cases, explaining which data_race situation= is >> happening. >=20 > On the other hand, it is perfect fine of not commenting on each data_race= () that most of times, people could run git blame to learn more details. Ac= tually, no maintainers from various of subsystems asked for commenting so f= ar. >=20 Well, maybe I'm looking at this wrong. I was thinking that one should attem= pt to understand the code on the screen, and that's generally best--but here, may= be "data_race" is just something that means "tool cruft", really. So mentally = we would move toward visually filtering out the data_race "key word". I really don't like it but at least there is a significant benefit from the= tool that probably makes it worth the visual noise. Blue sky thoughts for The Far Future: It would be nice if the tools got a l= ot better--maybe in the direction of C language extensions, even if only used = in this project at first. thanks, --=20 John Hubbard NVIDIA >> >> That's still true, but to a lesser extent if more macros are added. In t= his case, >> I suspect that READ_BITS() makes the commenting easier and shorter. So I= 'd tentatively >> lead towards adding it, but what do others on the list think? >=20 > Even read bits could be dangerous from data races and confusing at best, = so I am not really sure what the value of introducing this new macro. Peopl= e who like to understand it correctly still need to read the commit logs. >=20 > This flags->zonenum is such a special case that I don=E2=80=99t really se= e it regularly for the last few weeks digging KCSAN reports, so even if it = is worth adding READ_BITS(), there are more equally important macros need t= o be added together to be useful initially. For example, HARMLESS_COUNTERS(= ), READ_SINGLE_BIT(), READ_IMMUTATABLE_BITS() etc which Linus said exactly = wanted to avoid. >=20