From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C2BCC35242 for ; Sun, 9 Feb 2020 03:10:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6E14420714 for ; Sun, 9 Feb 2020 03:10:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="jR3JPOmV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E14420714 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lca.pw Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 16B9B6B0007; Sat, 8 Feb 2020 22:10:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F4E36B0008; Sat, 8 Feb 2020 22:10:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFEA26B000A; Sat, 8 Feb 2020 22:10:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0119.hostedemail.com [216.40.44.119]) by kanga.kvack.org (Postfix) with ESMTP id D4F446B0007 for ; Sat, 8 Feb 2020 22:10:11 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 804FA181AC9CC for ; Sun, 9 Feb 2020 03:10:11 +0000 (UTC) X-FDA: 76469109822.21.table82_7609d9fc8dc03 X-HE-Tag: table82_7609d9fc8dc03 X-Filterd-Recvd-Size: 4810 Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Sun, 9 Feb 2020 03:10:11 +0000 (UTC) Received: by mail-qk1-f195.google.com with SMTP id q15so3239742qki.2 for ; Sat, 08 Feb 2020 19:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=RgNOxX3qIQt6rj8+VVAfn54DI3bpWN6kUqMJ9GcZIT8=; b=jR3JPOmVnhLkZ3Eiwv/dxyZA08RRlVvuipzSv7BETbP0yQISUfrqfrQQaDe6BUTl/8 V31RKNRgmvwHah3dFmG9heqsvA59RSYTgA6OA0eF/jgTqXtTtPZSh1DG3YmrnYf8apmO p4uov0Ur2LubH7l1ixGbNqyZjQotjHmVLJj2D74/Em+1CkgDjF3wUJ4ZTSYRNH2nyIMK IAGbNMGWtDei4k+rz5j50bdrsEVWTaCw4McKtrDAwX2Ga94PG215lGvwbspqxrOa3CCH qeEdEx4T95V3mYKhFhSZpTPJdA7wm11GoU6f/EdEj54fpThQAWB58YyyvECL2ck01vVH 6iQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=RgNOxX3qIQt6rj8+VVAfn54DI3bpWN6kUqMJ9GcZIT8=; b=ksLpaq518hgYhabES5FTgUp+KrrknXOvArw0jGB2BGsrbTWcvulBKtyR96nOv+iNun P8COlHzuPwdR2fdgEnbwD2B3vv7BQ3VE2rurj2SEm7cubHpoJx9MrDc3on2DpTylbXfQ QKmuCUb2fq1S/mhDq4bcXScN63Qj4bgn7lqmT2qhA0cDdSR03106VaOLlmy2pqY+I5uH vQc4jhhGuQY+y8j0gz5Q10Q1sBGxL5yqm8gx78ywnMf0T3macfjeNrzGVrcaFKDSxeN9 uLWbDuOAWoVKxaqKyG8YTRY+Nld5SGOj3qX+16/a9qigQOTkKsCS4h4dbOjVj3nhn3rt oynw== X-Gm-Message-State: APjAAAXzyO11l9Z9V6Gu8h4E7qxq1TcBw+zdqP7YayXJ0ZRBwqZV5lVu YUW6pkhFrNArPYa1iQOfYaD6vA== X-Google-Smtp-Source: APXvYqxnRXFBAMU/FDNtZNSv88E2AijpM9Uzm2+ZOT8S1dyIUT96Bi3jAMSvdQZVaG8O+tgTtQv/dg== X-Received: by 2002:a37:9c8f:: with SMTP id f137mr5543455qke.276.1581217810409; Sat, 08 Feb 2020 19:10:10 -0800 (PST) Received: from [192.168.1.183] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id m204sm3796237qke.35.2020.02.08.19.10.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Feb 2020 19:10:09 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Qian Cai Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] mm: fix a data race in put_page() Date: Sat, 8 Feb 2020 22:10:09 -0500 Message-Id: <8602A57D-B420-489C-89CC-23D096014C47@lca.pw> References: <5402183a-2372-b442-84d3-c28fb59fa7af@nvidia.com> Cc: Marco Elver , Jan Kara , David Hildenbrand , Andrew Morton , ira.weiny@intel.com, Dan Williams , Linux Memory Management List , Linux Kernel Mailing List , "Paul E. McKenney" In-Reply-To: <5402183a-2372-b442-84d3-c28fb59fa7af@nvidia.com> To: John Hubbard X-Mailer: iPhone Mail (17D50) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > On Feb 8, 2020, at 8:44 PM, John Hubbard wrote: >=20 > So it looks like we're probably stuck with having to annotate the code. Gi= ven > that, there is a balance between how many macros, and how much commenting.= For > example, if there is a single macro (data_race, for example), then we'll n= eed to > add comments for the various cases, explaining which data_race situation i= s=20 > happening. On the other hand, it is perfect fine of not commenting on each data_race() t= hat most of times, people could run git blame to learn more details. Actuall= y, no maintainers from various of subsystems asked for commenting so far. >=20 > That's still true, but to a lesser extent if more macros are added. In thi= s 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? 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. People who= like to understand it correctly still need to read the commit logs. This flags->zonenum is such a special case that I don=E2=80=99t really see i= t regularly for the last few weeks digging KCSAN reports, so even if it is w= orth adding READ_BITS(), there are more equally important macros need to be a= dded together to be useful initially. For example, HARMLESS_COUNTERS(), READ= _SINGLE_BIT(), READ_IMMUTATABLE_BITS() etc which Linus said exactly wanted t= o avoid.=