Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1488956ybi; Sat, 8 Jun 2019 10:52:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZ0MA/XlXQzNWKULyKC4B88ir0iMjbMJ4XxnCK9RF+5IPe4PkaF7To103q/BMu5UzubESe X-Received: by 2002:a63:1f11:: with SMTP id f17mr8407144pgf.311.1560016357369; Sat, 08 Jun 2019 10:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560016357; cv=none; d=google.com; s=arc-20160816; b=GZihvsD/kXanPhsH2GvNl0kUwHpx0SKLbrDcbJpOlqgXzokpRUqCrWxez5PZG8Pgm1 i9E5+U5vp6FtcRf9SxCCM0b7ggEvpzdIIzah4QCFKa6WjUXuhyJgI+9yK6Zj+qMPGAu/ zRmk53VR4IuM1qxfozk+/L/kck576y46Npk6Sjz5MMs2/3pIZsvPDeyHkoKZEVQMC0Z+ PURLyAlJdLJRtFtY+zTRN9JisgAbSDUC/fXbbgMTnkyOiuc+hL1z71ForkR3VRyxQFZE AI+h2G1kbiosZ+5zlhn0z4VfkREMMlSndxyrgmyTZp/gHUQEnO4pZfPF5zDuf2Kx7oxy EXIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=W+9QCBgZ9J2LCx+rEhbyPEc2X/CUYFq2IbJFH8fkL3M=; b=clc6zhboVJdt75CBo7qBJ2de2RZEP/RMtr1lTNfkCTqpOSa9Dw7Q2dZYNhCG6j9uuW IzkfmxEOusC3i33xG3yC5OpFMfD5jvp8kCBG4/H3Vf/83dciw5SWrO0wlwTOLoftpTU4 tl88w8TYBbfptGV1vOWdnxtAin42hB7R4Zqwt6pzXtJD2ULMtfIT+RLd9ZkMhzz7hSIc /UNWAu1Xc+9vYflIaHhjXyFNXTn1WmMU+ZIAwL5iZYUHu68Y8QtOwVRZVhA5XXIe10pH cryMkxYOBI/L6zXzOi00btHz8+KIEEy1wK0ZwpVtWkqkpJnYPRWoiXSOydlw1flJ/9Bu Sl/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=OJ1oYvJZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si5252047pgj.272.2019.06.08.10.52.19; Sat, 08 Jun 2019 10:52:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=OJ1oYvJZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727314AbfFHRvL (ORCPT + 99 others); Sat, 8 Jun 2019 13:51:11 -0400 Received: from mail-lf1-f44.google.com ([209.85.167.44]:37373 "EHLO mail-lf1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727234AbfFHRvL (ORCPT ); Sat, 8 Jun 2019 13:51:11 -0400 Received: by mail-lf1-f44.google.com with SMTP id m15so3911310lfh.4 for ; Sat, 08 Jun 2019 10:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W+9QCBgZ9J2LCx+rEhbyPEc2X/CUYFq2IbJFH8fkL3M=; b=OJ1oYvJZ6e6i4G7bdLCVhlcvwr0pHFtMP6ZQaim/xPyhSQUqj99YSqUAeVdG+dLmxk mLPivGpd5euSbx5fKXvsmlx732m9r2LNS2ieZcz/rui4qyxz+94OKMK8wzJDt6Ofhiud xnGO27CZ1iE+XuSlD7A1HP5aPnFLZs/BzWKsY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=W+9QCBgZ9J2LCx+rEhbyPEc2X/CUYFq2IbJFH8fkL3M=; b=GR4zfyP869EAxcQSf75Whb32HTTyH02e3f/yYZWFUI1aaSrmh646yXT2D+9nqKqSJB fgIr2yHOiixxr3/6h1863J6SYI0aW6/EHp7MOIBF/i3VoMCdA9ZKIFulqiHHpjNBSdTt DTg6lkSULojXMOTRQBfThS6jKo4ZuH/zSXntUjXxyDBbaDT+HLOTgHOXS8IzJy0apton lDqXhIwwlIOhM3tCjlnUC2f0sGhbWZAdj371YlWSQmELOzcAoAVT0SlxkXLOqwrP772r /yTd6MlnwTlBnB3DKo0jwzGQ9WgqVZucTuPXlftLvk6UMbLvBWXGAfzSr8goYxf9qClE kqFQ== X-Gm-Message-State: APjAAAWAB9M7Yi49i+jRm+TH90x8ZlZwjzfFqops6dE/n1NvdisQ+v2t RQG3PCYOILG8qAZyWefIGtt/f2jqxCE= X-Received: by 2002:ac2:4202:: with SMTP id y2mr12214293lfh.178.1560016269292; Sat, 08 Jun 2019 10:51:09 -0700 (PDT) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id a3sm963706ljd.51.2019.06.08.10.51.07 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Sat, 08 Jun 2019 10:51:07 -0700 (PDT) Received: by mail-lj1-f180.google.com with SMTP id o13so4438554lji.5 for ; Sat, 08 Jun 2019 10:51:07 -0700 (PDT) X-Received: by 2002:a2e:6109:: with SMTP id v9mr31679230ljb.205.1560016266935; Sat, 08 Jun 2019 10:51:06 -0700 (PDT) MIME-Version: 1.0 References: <20190603200301.GM28207@linux.ibm.com> <20190607140949.tzwyprrhmqdx33iu@gondor.apana.org.au> <20190608152707.GF28207@linux.ibm.com> In-Reply-To: From: Linus Torvalds Date: Sat, 8 Jun 2019 10:50:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: inet: frags: Turn fqdir->dead into an int for old Alphas To: "Paul E. McKenney" Cc: Eric Dumazet , Herbert Xu , Alan Stern , Boqun Feng , Frederic Weisbecker , Fengguang Wu , LKP , LKML , Netdev , "David S. Miller" , Andrea Parri , Luc Maranget , Jade Alglave Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 8, 2019 at 10:42 AM Linus Torvalds wrote: > > There are no atomic rmw sequences that have reasonable performance for > the bitfield updates themselves. Note that this is purely about the writing side. Reads of bitfield values can be (and generally _should_ be) atomic, and hopefully C11 means that you wouldn't see intermediate values. But I'm not convinced about that either: one natural way to update a bitfield is to first do the masking, and then do the insertion of new bits, so a bitfield assignment very easily exposes non-real values to a concurrent read on another CPU. What I think C11 is supposed to protect is from compilers doing horribly bad things, and accessing bitfields with bigger types than the field itself, ie when you have struct { char c; int field1:5; }; then a write to "field1" had better not touch "char c" as part of the rmw operation, because that would indeed introduce a data-race with a completely independent field that might have completely independent locking rules. But struct { int c:8; int field1:5; }; would not sanely have the same guarantees, even if the layout in memory might be identical. Once you have bitfields next to each other, and use a base type that means they can be combined together, they can't be sanely modified without locking. (And I don't know if C11 took up the "base type of the bitfield" thing. Maybe you still need to use the ":0" thing to force alignment, and maybe the C standards people still haven't made the underlying type be meaningful other than for sign handling). Linus