Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp650289pxb; Wed, 3 Nov 2021 10:03:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxamvMNIANFvTvCWB/oyxec3E2RJEDCXZ5n8TxtOfmJyMs9BRQi/RlCsJGBUYddnfBurfK5 X-Received: by 2002:a17:906:9b88:: with SMTP id dd8mr56992347ejc.467.1635959005646; Wed, 03 Nov 2021 10:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635959005; cv=none; d=google.com; s=arc-20160816; b=zd7VFuEZL1hjOiV5tgfFUf6OnqFOl73oeFm3rKFOjIfFMH2QLDqrMKfz/D7P5OgkbI QdIVOmituXMzWwqF/q6GxkhVGfDjQg6xpsmqmIM5KuSVjKmqNtstRr1O+kc+yokx1M8J RD0L9XcB8ks6/RF814IUncyAmrnavWiNMyTImqmQb/Ozdwkg8Zp+E+gSTww1jUKBzT28 33wyjO16lG7Jm1koJaqQBkAHXADvFzCJqeRjq07jnLSnHo66NBo5EXObFU1JJXFNOmHe nBzF76qqFGhIu6uXwHcwscvDgnO4YrP6wzooXhoWo5g779lThiVAps2DHIi/3NC+03wt WVZg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=CZTso4db4Dar0whtzqs3akzB0bY3rGVZ6G9gzNMkSvI=; b=JNY6Ua0G8SYj+6O2k1oWETHACk6mFcvTH8ZAr+PdNg/UCkW/JJAzix1goj5nrYbWL+ 1v/8WvWVJi+YrS6WAlRCHLFD/PjHCO4FRw6Gpoqm0TnGG27QAsswgHDbwXC1bCkyPnAF DrzVCQMx6Cdeq4WiIOppPXat2TGkWJNI7ovnTUh+FqHYNfYEg3nb6NSeXxsVsBDNqRDf HRC82NYXVrFlt5Djhvw46C2kmeGa8uTnuOJPb047afVAkbwZBcfbUJW7tFaja972YRUl 4dDl8cDpY26ay9tpdqzX6bcT22AzyMZdy35smYrG6g+CfZR7Mf6nHw1Wi962xJ0pEnV5 qevg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=m+8PyeoG; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qb2si5045512ejc.603.2021.11.03.10.02.54; Wed, 03 Nov 2021 10:03: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=@suse.com header.s=susede1 header.b=m+8PyeoG; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232993AbhKCRCd (ORCPT + 99 others); Wed, 3 Nov 2021 13:02:33 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:35874 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232870AbhKCRCc (ORCPT ); Wed, 3 Nov 2021 13:02:32 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 69EFC1F782; Wed, 3 Nov 2021 16:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635958795; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CZTso4db4Dar0whtzqs3akzB0bY3rGVZ6G9gzNMkSvI=; b=m+8PyeoG2r9EvepaoRjSnJhUauQo7s69RvD++FEIn8UMwIML+is4JVtNWHsifUCGI4EOAp EZK6n+P42yGr8EYHTRj3zKa6U16OmB6na3SLHMU4VAD69/2ptgtGqqG9d0n39liyYw68S0 XMxf3jwmqkMCTZZFj4aNWh7KVmKR4j8= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5070013E87; Wed, 3 Nov 2021 16:59:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id DYL7EgvAgmHZaAAAMHmgww (envelope-from ); Wed, 03 Nov 2021 16:59:55 +0000 From: =?UTF-8?q?Michal=20Koutn=C3=BD?= To: cgroups@vger.kernel.org Cc: Johannes Weiner , Li Zefan , Tejun Heo , Hao Sun , linux-kernel@vger.kernel.org Subject: [PATCH] cgroup: rstat: Mark benign data race to silence KCSAN Date: Wed, 3 Nov 2021 17:58:45 +0100 Message-Id: <20211103165845.38226-1-mkoutny@suse.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a race between updaters and flushers (flush can possibly miss the latest update(s)). This is expected as explained in cgroup_rstat_updated() comment, add also machine readable annotation so that KCSAN results aren't noisy. Reported-by: Hao Sun Link: https://lore.kernel.org/r/CACkBjsbPVdkub=e-E-p1WBOLxS515ith-53SFdmFHWV_QMo40w@mail.gmail.com Suggested-by: Hao Sun Signed-off-by: Michal Koutný --- kernel/cgroup/rstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Hao was silent in the reporting mail thread, so I'm sending the suggested annotating patch. diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index 1486768f2318..1abe74114527 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -35,7 +35,7 @@ void cgroup_rstat_updated(struct cgroup *cgrp, int cpu) * instead of NULL, we can tell whether @cgrp is on the list by * testing the next pointer for NULL. */ - if (cgroup_rstat_cpu(cgrp, cpu)->updated_next) + if (data_race(cgroup_rstat_cpu(cgrp, cpu)->updated_next)) return; raw_spin_lock_irqsave(cpu_lock, flags); -- 2.33.1