Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1106685yba; Thu, 16 May 2019 14:33:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAQM/bXiDV3mWiE0hGzRRiv6Fli23J86qVk7zGMFb1fl1TxATsjPlGkZqWvE76D/BMKgZx X-Received: by 2002:a63:e358:: with SMTP id o24mr9111583pgj.78.1558042401271; Thu, 16 May 2019 14:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558042401; cv=none; d=google.com; s=arc-20160816; b=HrxfKKo8w9TC7RyCitk/Rj9exr/Pd8PLTSqm6z7rwjhXVZCqwIpP7N3IsqPSXfj9e+ qL30MxN/8VLBSYzqd0jW8TUpYGuOG9ing362u213zLAYbzh46ocjygywLjKiif5hIGXA FfxNU0c7IYYn+0ln9C8zjqdznM3QSIL0oJv27sHuAwbJDyBTxBm4L5hLqUrM1S/e+qbD wdpDXCe4aPksGPt6PBOTBLBqHEqaXZ/qhiSMpTBPAL5KeWI1yKbRaGinmMfr+yZ4BqVl FYodI1gXjudbHKvqTivcZDtIFJUvv7Cqn/Y2FBW4VMDy9EePMP0V66Ts3B15Cydy642R TCYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=3j/4tr8CrKpqGGvqHCEPSLn57jN1xeOSywr/5Ae9rTM=; b=Qc4yY4gtObafFKvHlYIg1u4VXEBNpWnwPgZeCXNAUjKUcAs+OJmAFtj0OcsTwThW6t wD3nTKMMqwdF70Fmg7OiBT09Wp3AI+XoR0CdRISEXK4DxAOgWBpI4zh/lMyoh6kZ+fSB dmQHCgSvD6TQHO5BTcuZPhi8UjfUMjx7rFTzOSzzWGK42/pYX0lx/de5zJQyTur+i83/ OQPRIuY1Gc0buhIWqpd08UwKlRGiYcOydStBXP9gF7aAxw2DLKhR/8QCcznwPeEHye9l wzz6KQV2I2DMbnlxCJQEg6raBaz3lQN+MJO1qJBvS4wD2+igyLPyIsGoqbh6SibaYAJE A1Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jUS0eLKx; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x29si6074302pgl.194.2019.05.16.14.33.04; Thu, 16 May 2019 14:33:21 -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=@google.com header.s=20161025 header.b=jUS0eLKx; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729096AbfEPSiC (ORCPT + 99 others); Thu, 16 May 2019 14:38:02 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:49842 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbfEPSiB (ORCPT ); Thu, 16 May 2019 14:38:01 -0400 Received: by mail-pg1-f201.google.com with SMTP id e20so2656396pgm.16 for ; Thu, 16 May 2019 11:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=3j/4tr8CrKpqGGvqHCEPSLn57jN1xeOSywr/5Ae9rTM=; b=jUS0eLKxVhmfNjWiAtxwVyjVnsmrN2HNyKGU2ySEflldzKc3Gc9TTaoDCfyVzx6/0P 4m2criIXsk5HbgXDlNxoyaqLt63pNi4cK7jSx4WgxOunn2tjhE56CVMIfb5g9fpTxMo1 SNUypGqklImXvZv/7uG5xzKj3Vk6+eZFVOWG8lETNgsc9jewIY/oiFBa87mS0EicjXXG nHUBpddZgJhNy/NhYVwE2l2yjU1P/97BhtVeVWWNyZYIKSGktrrds+MVJGJ7vAZaYyMN rh6vYMf9LJptDdl6VfPb0k36yPMSqL6c7OM3JQmN3ACkGaTMZmG6DtKPjw+/qvMB3MVS j1wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=3j/4tr8CrKpqGGvqHCEPSLn57jN1xeOSywr/5Ae9rTM=; b=MVhP1/nVMttdM6hlBURN5xf1tYuiD/PivdP7LrFNtY5uQgcVsHG7M5tq66MFQlPx92 XJ0m87cV79Uul1nCJdi6r3ovNilIQ3gkE/f5As8gtGrrpQ2c7piX7BVU+1aIMb3sOlL+ 3SVAitiIDQH9HP4iZ5wVTviu7xoqZVX54/AUh9ubhlI5qHsP4/eyYZWMPmUDJ0c+VUcm acRo3sbxLrMZ9ePowmGgmpdxDQkkOvS/e8hFiZLv0KMEr9iK7P26CPdgW/9hKv7Jeq5G RT4Fr9DtfsPLSn4cgVL6Lw29Rrh/QKt00mO0Yby/WufCR6fj6j1cuNdVurIPBW7NT5ZK TxPQ== X-Gm-Message-State: APjAAAVAY2is/vrzoK0Srk4elAsqvxcYguDsQJCWYaRmk5Vo7vSftlCi l00znOhoA+q6+51VaZRnwroj7nudYw== X-Received: by 2002:a65:478a:: with SMTP id e10mr52135748pgs.310.1558031880782; Thu, 16 May 2019 11:38:00 -0700 (PDT) Date: Thu, 16 May 2019 11:37:47 -0700 In-Reply-To: <20190515104824.GD2623@hirez.programming.kicks-ass.net> Message-Id: <20190516183747.166545-1-yabinc@google.com> Mime-Version: 1.0 References: <20190515104824.GD2623@hirez.programming.kicks-ass.net> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog Subject: Re: [PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head. From: Yabin Cui To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim Cc: linux-kernel@vger.kernel.org, Yabin Cui 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 >Indeed, good catch! Have you observed this, or is this patch due to code inspection? I observed this. I was using perf_event_open instead of linux tools perf to monitor a process continuously forking new processes, generating a lot of mmap records. And a sample record happens while generating a mmap record. For missing barriers, I thought local_xxx provided implied barriers. But I found atomic_ops.txt said not. Thanks for reminding! I will add them in path v2. I also think it's a good idea to use READ_ONCE/WRITE_ONCE for rb->nest. Will use it in patch v2.