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 811E4C35254 for ; Mon, 10 Feb 2020 04:44:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 38DEB20870 for ; Mon, 10 Feb 2020 04:44:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lca.pw header.i=@lca.pw header.b="CPdOs3rb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38DEB20870 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 CF1A36B00AC; Sun, 9 Feb 2020 23:44:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7BE66B00AD; Sun, 9 Feb 2020 23:44:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1D016B00AE; Sun, 9 Feb 2020 23:44:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 9472D6B00AC for ; Sun, 9 Feb 2020 23:44:29 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4E5B42C04 for ; Mon, 10 Feb 2020 04:44:29 +0000 (UTC) X-FDA: 76472976258.20.blow25_7e73089893403 X-HE-Tag: blow25_7e73089893403 X-Filterd-Recvd-Size: 3801 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Feb 2020 04:44:28 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id w8so4190772qts.11 for ; Sun, 09 Feb 2020 20:44:28 -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=YyeG7ioMptg4bos9WvsiCAkWTH6MJSyQRYyd9Ee7o3E=; b=CPdOs3rbLRg9yoyCDZ5FfBtSmUGg5ALJ1rif3cwywsjGy6iXqxjHOs2/coCTOgCWM5 skYy1c97oA7WOyENX5nrTq+i258mB5kN1lJ6844lZuBZ55mg3HCR3yJ2k3FqbD698WH9 1ypDv2ONkoc6fKwj3eSu5D3ygeQmlfVUjzau9YjRVEkOQGPXAaizsj9SOgiQQBOFpL15 GEiBmgJL5ZzsZP6WJoCEU8kAS/fwjWnPtNJjv3BBVhfnqza6eZKIcp/nCD2NX1Tnt2dp 4FBNLfo7cGYWsbrfhI6Cbvxgs0IhF0Nt4PpEXKMRJcM6jnyLoPKKXvFbPUS1Glf1qWMw ZbYQ== 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=YyeG7ioMptg4bos9WvsiCAkWTH6MJSyQRYyd9Ee7o3E=; b=PD/DR8mzbEZWhcW1Wk3ur9qitBKVEQhWbMGHtqfixqT2GecPUHJz/5FEbrrQHPlbAR SnUJSs9Oce6UQYW18hxJ5s2CITHa+e7UbBQCZi8C1ICeSduG+5dtBVZq/cSrT+5rGQyX lPeoJ1qnAjb0ctPh2vYlDti267qrcI4pTU39jzg4W98577GhIh731uO/fXrHz8VcYhO3 1IHAWjxolzEFtB1QLyHyvGU0Z9JzlaMhrbUiCcIo+Pud1FqtPTYvwUJGVmFUxZUf3A+g RsFMrbj27CCWvMsYcWTlsDfEq9mxVaI3JWoAXd4XBpQ5Jdmc7waITUqgXfxklzMn8ei0 KQ8Q== X-Gm-Message-State: APjAAAXqP/IJu9qLBLiuVJq7G+u/SDRtTsetDAWAsH3IuQQZOGbaoqb5 IyH7UHRGWONnYjhugKLojB4X70fkRlfNmw== X-Google-Smtp-Source: APXvYqx0rDsk1O0gfP1a8V9FMM1lRMzUgooVrb7l8yRAD8+5GiHjXvNFCGmEn2Gqkve9SPZ+AYF5lw== X-Received: by 2002:ac8:4e3c:: with SMTP id d28mr8485950qtw.190.1581309867903; Sun, 09 Feb 2020 20:44:27 -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 h6sm5533428qtr.33.2020.02.09.20.44.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Feb 2020 20:44:27 -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/memcontrol: fix a data race in scan count Date: Sun, 9 Feb 2020 23:44:26 -0500 Message-Id: <6E237CA6-8968-4207-A9BB-1D18CB30822B@lca.pw> References: <20200209202840.2bf97ffcfa811550d733c461@linux-foundation.org> Cc: hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org In-Reply-To: <20200209202840.2bf97ffcfa811550d733c461@linux-foundation.org> To: Andrew Morton X-Mailer: iPhone Mail (17D50) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > On Feb 9, 2020, at 11:28 PM, Andrew Morton wro= te: >=20 > I worry about the readability/maintainability of these things. A naive > reader who comes upon this code will wonder "why the heck is it using > READ_ONCE?". A possibly lengthy trawl through the git history will > reveal the reason but that's rather unkind. Wouldn't a simple >=20 > /* modified under lru_lock, so use READ_ONCE */ >=20 > improve the situation? Sure. I just don=E2=80=99t remember there are many places in the existing co= de which put comments for READ_ONCE() and WRITE_ONCE(). For example, kernel/= locking/osq_lock.c and kernel/rcu/srcutree.c, but I suppose every subsystem c= ould be different.=