Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp136140pxb; Tue, 14 Sep 2021 21:11:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiL4hUbu4lcAZjQlg8yTGH/yXgVhpKLOq2ExQMw3XupS+p0juJTeGg4i6T8g31W5OUSjIc X-Received: by 2002:a6b:6f18:: with SMTP id k24mr16684699ioc.196.1631679085543; Tue, 14 Sep 2021 21:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631679085; cv=none; d=google.com; s=arc-20160816; b=RuoxOTHolTVD9R5p7AmE0vofgqRRtOznjQGMSb7/G3LV3RSD1StDi/MkHMlErWklQu cUyT9oV/b49q8ahac7NbF8R+u1q4yw1UsfjBHNdnAHofLz+fNJPU5hwWnP92sqo1GkQV p1qDX6uSo59Q0jVoXBPowtnLJ5j4DlYXHStq4k74yVRw4h4NMmEcyCaHZTXvLG/BMv4n Zv16N2+84AcnHLnL5hm/xOUJY2sBm8mUpjWTuGJO7Vgd0Qhms+/54wn9bcxWbbFBs9dl qFe1JSOhKaRUB9dsZ01ygAvABcetFR9BkFslegb/NIJz/XKAaXuAXoeds7rKYkJdF/0S 8ZHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=CupAt1UuRiW2MDGCGT/v7bcfoJVW6WrNnwFnqgu1RX8=; b=p+CuyJcdMkWBgUWORIKl2KVEEC3Qwwum8+DEaskboh9aCy+jHe7g6Pst7TwGzSLkJj zHqw5w1Q/3gt8vaUdsic59umqOT4YXbG9RNYGSNqUd1fJzD6FUbl0RKvHl3LbY1AtUQI 5vCftuZatniksBSqhRP2n6PQx3bZwgV3a/rp2IxzpVSnID+2zL8xNVqO3bSfeFZo+syD hvKUpwhMp+l1LiVllITq/ZrRcEapQI7Bf0ihvQv7APfPHdZXGCNAA+UZW3t+oTuugjZi WqVFGImDXUQ5MlzPiFiA4bMsTvBPP7kvneQEKSLdXJfP8u2KOAiI7fUSdYB/RKiBM9sP VJSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="Lo/2zCrW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s195si12149101ios.106.2021.09.14.21.11.13; Tue, 14 Sep 2021 21:11:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="Lo/2zCrW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229632AbhIOELq (ORCPT + 99 others); Wed, 15 Sep 2021 00:11:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:52832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbhIOELq (ORCPT ); Wed, 15 Sep 2021 00:11:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9045260E74; Wed, 15 Sep 2021 04:10:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1631679027; bh=ZOLv9LtY30tSZai91s3Z+6sLPL5sOEycDB8UHDM+dXg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Lo/2zCrWRyCnKbpX+cCAP3SyT8q6BnwIG9t4mdApLxg1PWcsSdxLSZF7MlvLLDhV6 dRy2jbObw2LgGJUNaD/V94Wju23pwnMVNQh+NFJ63QRN9jpJKnTbF4AZLLjwq7NhNo jRkJdY6znaIN7Qa+y7NOMm/DzxkX6/dE0AiZTz0A= Date: Tue, 14 Sep 2021 21:10:27 -0700 From: Andrew Morton To: Liu Shixin Cc: "Paul E . McKenney" , , Subject: Re: [PATCH] mm/vmstat: annotate data race for zone->free_area[order].nr_free Message-Id: <20210914211027.0d612d99a94b085112ba0969@linux-foundation.org> In-Reply-To: <20210908015606.3999871-1-liushixin2@huawei.com> References: <20210908015606.3999871-1-liushixin2@huawei.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 8 Sep 2021 09:56:06 +0800 Liu Shixin wrote: > KCSAN reports a data-race on v5.10 which also exists on mainline: > > ================================================================== > BUG: KCSAN: data-race in extfrag_for_order+0x33/0x2d0 > > race at unknown origin, with read to 0xffff9ee9bfffab48 of 8 bytes by task 34 on cpu 1: > extfrag_for_order+0x33/0x2d0 > kcompactd+0x5f0/0xce0 > kthread+0x1f9/0x220 > ret_from_fork+0x22/0x30 > > Reported by Kernel Concurrency Sanitizer on: > CPU: 1 PID: 34 Comm: kcompactd0 Not tainted 5.10.0+ #2 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 > ================================================================== > > Access to zone->free_area[order].nr_free in extfrag_for_order()/frag_show_print() > is lockless. That's intentional and the stats are a rough estimate anyway. > Annotate them with data_race(). checkpatch helpfully says WARNING: data_race without comment #40: FILE: mm/vmstat.c:1074: + blocks = data_race(zone->free_area[order].nr_free); can we please add a comment ;)