Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2866711ybz; Sun, 19 Apr 2020 11:34:15 -0700 (PDT) X-Google-Smtp-Source: APiQypJou9/4RzBhtgtf2tFx2snjFjy+Od7JobnfXMIyST5WM3/mKaoN1P+jqIf3jo33bYttz2DY X-Received: by 2002:a05:6402:1684:: with SMTP id a4mr10782314edv.99.1587321255194; Sun, 19 Apr 2020 11:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587321255; cv=none; d=google.com; s=arc-20160816; b=ekEf3maPYfWfWyo4XBHAAjCmkbXMG1AuC4Iy8V+p+Gk8ZUUoaS0rlhU6jg+6jL1ISr b3vwbvKyuasjKc7FSJB0cYWK4g3tlz6G6BCkEb1umJDzQ3cIaDZpbSOWLFNVw4HhbcfM I3IjM9MtDhXkSS7PuqUMMmbw54tTUPrPMi7pd6PYz1BE04mb8QlNJkvdocA8esCMTOSv sciFQlsvoaDhxfSGYbzmvJPLr0SuiOYauGqbUPcfNClnVqdvxn401dEIYMn/onqDhWed +X5a3BCtdQu15cJtdVSXmcf5tGlDQULQ4t6eFYJECI4Eb2AOaKRw1bnv4zwl8vHZfqlY fMDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=GWuIPANYA2m7P6GNcWxif1LFGN691M53j3xg2/n0HyA=; b=K1hnNVAXohaVbpvDLFq6gxK3RVb6/TLqXEjMcePR+jDIZRO3aosf8usATMC4WB33tV ZSUvK1a0+aYCFV21TbtbhZLup5cJ38ATg2blPUrE1lgHCemsykvB065tfRZ1RG0Ksk3A 2qhezE0hDFsD9A7ZF2W8EDOVqaKLZN0ooeQRL9qWEj6f1xp+DEghmQ6AhMin+ZABWp61 J8KB7SWgN8YaIdglHBpPEYMzVdM+89YmDpYE28nkP5k+7UXK+iL0pfosuEpk80Ottw+y Ddx67DJD3zyyfy7UOCjqdHeGM5OykRt61SGwjIMl0WZy5tM3uQpC+uLOfGUhE5OtWG6m tkMQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si17617963edf.454.2020.04.19.11.33.51; Sun, 19 Apr 2020 11:34:15 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726590AbgDSSCy convert rfc822-to-8bit (ORCPT + 99 others); Sun, 19 Apr 2020 14:02:54 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:50073 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbgDSSCy (ORCPT ); Sun, 19 Apr 2020 14:02:54 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-48-86ACGi07OCCkYT-YdAJJpA-1; Sun, 19 Apr 2020 19:02:51 +0100 X-MC-Unique: 86ACGi07OCCkYT-YdAJJpA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Sun, 19 Apr 2020 19:02:50 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Sun, 19 Apr 2020 19:02:50 +0100 From: David Laight To: 'Petko Manolov' , "Paul E . McKenney" CC: LKML Subject: RE: [RFC] WRITE_ONCE_INC() and friends Thread-Topic: [RFC] WRITE_ONCE_INC() and friends Thread-Index: AQHWFi8qKt3GQH4qWkGP1JyWbckPg6iAvLKQ Date: Sun, 19 Apr 2020 18:02:50 +0000 Message-ID: <491f0b0bc9e4419d93a78974fd7f44c7@AcuMS.aculab.com> References: <20200419094439.GA32841@carbon> In-Reply-To: <20200419094439.GA32841@carbon> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Petko Manolov > Sent: 19 April 2020 10:45 > Recently I started reading up on KCSAN and at some point I ran into stuff like: > > WRITE_ONCE(ssp->srcu_lock_nesting[idx], ssp->srcu_lock_nesting[idx] + 1); > WRITE_ONCE(p->mm->numa_scan_seq, READ_ONCE(p->mm->numa_scan_seq) + 1); If all the accesses use READ/WRITE_ONCE() why not just mark the structure field 'volatile'? David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)