Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2998478iog; Mon, 27 Jun 2022 07:12:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uu2t7U8ZyILjw9Oj0cNsumT5hwBLJklmWghTI10tdOfgPt/ggBRkuI9WJlWPouqb6cKdMD X-Received: by 2002:a17:906:2c12:b0:726:94a0:2708 with SMTP id e18-20020a1709062c1200b0072694a02708mr9282861ejh.179.1656339158107; Mon, 27 Jun 2022 07:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656339158; cv=none; d=google.com; s=arc-20160816; b=x0YewsHIfDfcufKV6pRqZaZXpksenbJ1DZ8Xf5+d10RT50E226EN43wQjQ9IeKesmA m1wMFAvkaaxfE11pRpZmhvU/IBkLzwyI09zaUHHmjGQdLd/dNHOsBHvziH6xUjpPSfVR Gms+I3DxSmkQQwJ2w7+5SWJHOA9KhzhgmgOcxf7K4pg+z4a/i7g7JJHRd0umnGIHMQ+i GQNydn9YohLv2p1wUeCkDly6KtyM/7jfReP0LczjcRAOmPC+eDza8B59h49i4pUvUEAm Tbx2WLm7ZKFBS1GURo5UAgdP+Nd/5YbDn3lGdwMCA5oQGf9kuKjro60KBrwpDp36WAS9 B08w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Gnsf+QTLVChURM0F3ZGZR9Oqi9oIQdMjnKYpZYGncic=; b=QTcVeBFpneZDbXamZ2PaJibtAlslt7Tyhzb1n5YCYauQnz9nQAVbyzU0Ag0ihpFTe0 P6n7emu0z1R8lrwtiO1in8yuwb7vc3yKd3BN65nT44In21rrGFYeD1RgzK4xJofvookS zqAcaWNPtPmDTq1OuA6aBxYLFRWEzdMbqcmvYVV5VQeWLeVEjlo6uKvj5h8uMqImXy9D r6AjoFpPcf4kgnype3nx1TBENsyH80KQdSoP8O1LTEq+KzzE203LVgm0Dr4x91vXZA4T X7VK+abZhKfuZ+wzzZV6JgDWMDIoAQCj7ie9256+SytJPZ1SYaOFdZr9iTNmTNMwt69K ClEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=NeNb2Jvn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb20-20020a170907161400b006fe815664dasi14074344ejc.315.2022.06.27.07.12.00; Mon, 27 Jun 2022 07:12:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=NeNb2Jvn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236256AbiF0NrX (ORCPT + 99 others); Mon, 27 Jun 2022 09:47:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236225AbiF0NrV (ORCPT ); Mon, 27 Jun 2022 09:47:21 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 955B660C0 for ; Mon, 27 Jun 2022 06:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1656337640; x=1687873640; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Gnsf+QTLVChURM0F3ZGZR9Oqi9oIQdMjnKYpZYGncic=; b=NeNb2Jvn13siisZn8tYNSaWW0Os0tl1v80PguT//2FobrSsOLLakN7i8 Mch9B6CYPFgdTl2m3nejAkoJLqeyL1c1Q9SyuVC2ddFKUppwiMc8aSq5k tX8J0AYRnrWUMsYoUA9HuL1BcUZMLjpxdqYahaXAlb37wbM6Ed51alvxU E=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 27 Jun 2022 06:47:20 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 06:47:20 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 27 Jun 2022 06:47:19 -0700 Received: from qian (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Mon, 27 Jun 2022 06:47:18 -0700 Date: Mon, 27 Jun 2022 09:47:16 -0400 From: Qian Cai To: Miaohe Lin CC: , , , , , Subject: Re: [PATCH v3 1/2] mm/swapfile: fix possible data races of inuse_pages Message-ID: References: <20220625093346.48894-1-linmiaohe@huawei.com> <20220625093346.48894-2-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 27, 2022 at 09:27:43PM +0800, Miaohe Lin wrote: > 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. Well, if we are going to do a WRITE_ONCE() in those places just for documentation purpose now, I think we will need to fix all places in the mm subsystem to be consistent.