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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B14AC43334 for ; Mon, 27 Jun 2022 13:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235788AbiF0N1u (ORCPT ); Mon, 27 Jun 2022 09:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235683AbiF0N1s (ORCPT ); Mon, 27 Jun 2022 09:27:48 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8597641B for ; Mon, 27 Jun 2022 06:27:47 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > . >