Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2298749ybv; Sat, 8 Feb 2020 19:11:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxPu78MSFi9aEXBs7KIJxI4U8auMDG83F+vp0Or7hsWDA8/m3fpDasxBtWeNqQ7eKYsHkYb X-Received: by 2002:a05:6830:22c3:: with SMTP id q3mr5314369otc.335.1581217861675; Sat, 08 Feb 2020 19:11:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581217861; cv=none; d=google.com; s=arc-20160816; b=CYRKLG1BggiCEVP7O1SGS9xVfBsTh6QmshZCmdTD+JUT8EAqtKGCh7FD6lWxlsqEgM 0/aV5tq44o3W1XB0ieNrtcNliFVGfNL6+FezOmTgoL3psI5IVpEx+8r0VrFHiBCE/wPO ptv0zpAZJwOe/WuDcYV/AzZzNAhIAjwUFmOrihhjvCZnjr1o7sn/Fh16HVVNAz3mr9cT 6/xzl9LeDSuwCuxEfRgM9c53sTRZS9cOyp0sPhXeIDs73vrIBIUiM2y1WiSlJV/veALQ dffFMgRJ4Dij/JVzZdCHuOmwbEdjy5LAXSirOqclp9zpBqsmcFsSVaRM6XEstzVsaLAA dDiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=RgNOxX3qIQt6rj8+VVAfn54DI3bpWN6kUqMJ9GcZIT8=; b=pmD1hizC5UnOm2MsFPyGFRYIPvuLybbqrortWH5jfxPVqhy1JVQy2lYPiu/O/GydUc agARj/MZdM3JJdMkB3p84KBtKrLMX8XEYFjzuLEVtHspFVaz9OX+19vhN/Pj/j1dUbeT 1ChMObaDQMh9RRTOplEbftCzUbBIpvRqzHk5Xw2o2TxP3IOitjGS0IuJeAeVCIpcHG4I vsLCHGcS63cJlbqq3hwuECdzOseA6UkmFkHMRhiWFYJSgX8w0gPiQbIh3pFZEZO2IENx KGmNVaOBe2RPeqwTmTUNXrXDXe7r1byyypBL4sR8uwKC6EtfXzklmc2oFqXnU+MxePet MGWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=jR3JPOmV; 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 9si6035092oiz.237.2020.02.08.19.10.48; Sat, 08 Feb 2020 19:11:01 -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=@lca.pw header.s=google header.b=jR3JPOmV; 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 S1727560AbgBIDKN (ORCPT + 99 others); Sat, 8 Feb 2020 22:10:13 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:38047 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbgBIDKM (ORCPT ); Sat, 8 Feb 2020 22:10:12 -0500 Received: by mail-qk1-f195.google.com with SMTP id z19so166387qkj.5 for ; Sat, 08 Feb 2020 19:10:11 -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=PK1kGeXbviLukBWJSkGiTQRrg2Nu6dFzTPbF7TFXpoGsmhyghLfw4NG6knVd51XY2V r72YYjPCRLVVAvejx77PzXHQS4dgfEKGXKlmSeX6oQjItt1DIi3pMbAet80FbvDODWwL cnDzTTBsVlz588TWjD6MvJtI+obEx+aRAG03mH+RiISEruFQjLZv/P9p0cpGBmm0GwPw uyJlPn9vGD8dtEndGNRn1inydndgprecL4mVvWQCM+wT7caiFcftxCA5lnKE8K24pA+I UdrQ1ZQmXMNGXVm5W+lsNgshwfmzBkTMc92yv0qCkS/npM4TKpfXfGvm9scZguBsAUi0 sT+Q== X-Gm-Message-State: APjAAAUiYj/e0YOK9jBD1EA01nQYS6czfKLyCHSBfl+owyUq7QdF3rAE OtKWqCjte8TSGxDVKI1UqG1/TQ== 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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.=