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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62C0CC43334 for ; Mon, 27 Jun 2022 13:28:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E18A18E0003; Mon, 27 Jun 2022 09:27:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC7C58E0001; Mon, 27 Jun 2022 09:27:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8F018E0003; Mon, 27 Jun 2022 09:27:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BB68D8E0001 for ; Mon, 27 Jun 2022 09:27:59 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 964C421112 for ; Mon, 27 Jun 2022 13:27:59 +0000 (UTC) X-FDA: 79624093878.21.5944B1D Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf20.hostedemail.com (Postfix) with ESMTP id F33061C003A for ; Mon, 27 Jun 2022 13:27:57 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LWpRZ0xQFz9spN; Mon, 27 Jun 2022 21:27:06 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 27 Jun 2022 21:27:44 +0800 Subject: Re: [PATCH v3 1/2] mm/swapfile: fix possible data races of inuse_pages To: Qian Cai CC: , , , , , References: <20220625093346.48894-1-linmiaohe@huawei.com> <20220625093346.48894-2-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Mon, 27 Jun 2022 21:27:43 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656336478; a=rsa-sha256; cv=none; b=JklGCvICEfw6jxkdGmF0O4S31F34Xc3HNbZmnRzRuk01Dsc9JkmwlUUoInB/0knedEfIA2 wc7hkM59i0pWJQKlaVsw8YAlX94mrR22PkPmz/i65gSOTkSaGMigH/kLglClnBFnQlcmO4 WwpetTwQARwdT8pd8ytG2u+dnpJhYCU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656336478; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SFsCUBqglVX954xCdyjsII5kgX2TueUjf3h+nZLAmmU=; b=iEfHiLNBRYd3v706aM72zBLAaaJX50g/lLhVgz1ruhHif/BzqWYj3Ll2qdFDxXk6b3kngG ZEfIpsGtod76dXIhQC2kdkfcYCXzNRVJS5imb3N5Ems3Wg5WqGmcKnI2Ii5Mm5nBUVnpaf xHiCjhcs122PF76Epdmd/PjjRvrayM4= X-Stat-Signature: o3gp6bxwbduwbu43js8sq1cfymhbfdsm X-Rspamd-Server: rspam08 X-Rspam-User: X-Rspamd-Queue-Id: F33061C003A Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-HE-Tag: 1656336477-698425 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 2022/6/27 20:43, Qian Cai wrote: > On Sat, Jun 25, 2022 at 05:33:45PM +0800, Miaohe Lin wrote: >> si->inuse_pages could still be accessed concurrently now. The plain reads >> outside si->lock critical section, i.e. swap_show and si_swapinfo, which >> results in data races. READ_ONCE and WRITE_ONCE is used to fix such data >> races. Note these data races should be ok because they're just used for >> showing swap info. > > Was this found by kcsan? If so, it would be useful to record the exact > kscan report in the commit message. Sorry, it's found via code inspection. Thanks. > . >