Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1171297ybg; Wed, 29 Jul 2020 07:35:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCQ0+gbGSPLtBKKGIKzRkqyruBWzG4PBumTqrmP1+JfbXsjhuWqX59XgnQ/VKCJE6aa2LT X-Received: by 2002:a17:906:4acd:: with SMTP id u13mr6142145ejt.4.1596033304287; Wed, 29 Jul 2020 07:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596033304; cv=none; d=google.com; s=arc-20160816; b=RKTkLgCuNgDHjnBHsGHuj6rAX+dBaizg4YehjA0yvCGiJDWFgQ+P4bkv+M2hXcbaWD XQ32AECQ571h1t1IsStOD1E4l6jcBBvWKV8SddnFN4YwIH05ZZjU+Dy1i5VL1zovzJur DaWIILDeXxXqiK1/8j+yFjyUSVKTsl4XwCFf1KI+IZUaKivEn17IBGensCMKGndjlw9I qoonUGgw6dSvxLwoxN/7PK5wHT5L/QGo+d21kWg3sNohjtuD8W9+xtM+djEOajQXUksN DnYaNtRrXVrDcRu+eE98c38ZulVc3mOrlNSym05ygGrIq3ZwqAx4n5i3IP89HHu9BzSC tpqA== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=eavMHgip/DHaHggfrx1dCSEAdMJyMOGJhJ6uWsf22qU=; b=GzFAyhlUZKQIIzLKuKCJ5KXhrj2vVIQRRWhwHa5d3Wi/lR7iD/UoJqESp3GLJOvCTy OPZCQEH8d41YPCebpagjcWhvNVJyVopZSegRIuCJ/m3KVjZxT6fFpGWkyV7pv+hzhond hhXLZqctaH+6bgO9y3Z8YOsGOABIj4vyuZlaG/9pMPiG7R4aMepOjpPDKUt0DSlcj5jq aqN65pp9GCgYVurSEENIPc2EgG72WRtHrWecX84C3I6tAhjRgK41Aqcnn2VH74h6yWeD E6K69tv/GV/yxwbxFqqtLdcKtVd6RILp8ANaOc088QoXm81KzlsfoDw+KnhviRxRffUk ZRHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=06PEpfIm; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si1199914ejc.337.2020.07.29.07.34.40; Wed, 29 Jul 2020 07:35:04 -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=fail header.i=@linutronix.de header.s=2020 header.b=06PEpfIm; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727861AbgG2Od4 (ORCPT + 99 others); Wed, 29 Jul 2020 10:33:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727776AbgG2Odn (ORCPT ); Wed, 29 Jul 2020 10:33:43 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6938EC061794; Wed, 29 Jul 2020 07:33:43 -0700 (PDT) Date: Wed, 29 Jul 2020 14:33:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1596033221; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eavMHgip/DHaHggfrx1dCSEAdMJyMOGJhJ6uWsf22qU=; b=06PEpfIme3OvXSDYlVjzE10HU8jH63PqJQxdWZ7yt9dhKFiY8igESKvzBZ24nSjLqwq92X yrrOtrD9EVbxJyXYoiIGw4aC15hkHYrGCjPfRbwX8hjr6Zz7J/dPfpxn7yhVSEt7H6XQzA 67KPFmTumdZCUfb3vHZ57TpMSF06IDCVSpYO4CK/4Gu61D3/uFg9G2qkqt0IQIZ3L4ddeg WU6bLM4y8jYk3SMkHimr0iKo+kz+Dw7tCrfHp3/FPvnYW4foTTH+O7SiuqTCkPMFb0NVD7 FXYG+snuWovzB4pWNgO7xOif13Yqv0bmnV7ilnS3RwsvhziOPdqv+NE+4SAEjg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596033221; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eavMHgip/DHaHggfrx1dCSEAdMJyMOGJhJ6uWsf22qU=; b=OnBFmy8VC1vX/VoCGIRkJzjk112PYWyeEH/dvd/o4d0rl+R2VFT8FvSbEr+65EUIApmfxh 10aVgUjORGFAkKDA== From: "tip-bot2 for Ahmed S. Darwish" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] seqlock: seqcount_t latch: End read sections with read_seqcount_retry() Cc: "Ahmed S. Darwish" , "Peter Zijlstra (Intel)" , x86 , LKML In-Reply-To: <20200720155530.1173732-4-a.darwish@linutronix.de> References: <20200720155530.1173732-4-a.darwish@linutronix.de> MIME-Version: 1.0 Message-ID: <159603322133.4006.2775605538857308036.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: d3b35b87f436c1b226a8061bee9c8875ba6658bd Gitweb: https://git.kernel.org/tip/d3b35b87f436c1b226a8061bee9c8875ba6658bd Author: Ahmed S. Darwish AuthorDate: Mon, 20 Jul 2020 17:55:09 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 29 Jul 2020 16:14:23 +02:00 seqlock: seqcount_t latch: End read sections with read_seqcount_retry() The seqcount_t latch reader example at the raw_write_seqcount_latch() kernel-doc comment ends the latch read section with a manual smp memory barrier and sequence counter comparison. This is technically correct, but it is suboptimal: read_seqcount_retry() already contains the same logic of an smp memory barrier and sequence counter comparison. End the latch read critical section example with read_seqcount_retry(). Signed-off-by: Ahmed S. Darwish Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20200720155530.1173732-4-a.darwish@linutronix.de --- include/linux/seqlock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index 6c4f68e..d724b5e 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h @@ -363,8 +363,8 @@ static inline int raw_read_seqcount_latch(seqcount_t *s) * idx = seq & 0x01; * entry = data_query(latch->data[idx], ...); * - * smp_rmb(); - * } while (seq != latch->seq); + * // read_seqcount_retry() includes needed smp_rmb() + * } while (read_seqcount_retry(&latch->seq, seq)); * * return entry; * }