Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2533738rwb; Fri, 16 Dec 2022 03:28:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf7o55y0/C9/KyZj/wW3fTc2gTFSRhdmbfQUuvn7YL6c9vaOpGQhBeDXF5VRL3OyDzMvSYE+ X-Received: by 2002:a17:902:ab54:b0:189:6bda:e98f with SMTP id ij20-20020a170902ab5400b001896bdae98fmr31614046plb.58.1671190082463; Fri, 16 Dec 2022 03:28:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671190082; cv=none; d=google.com; s=arc-20160816; b=dxPDBBO1bc6MXANc3tOww+p9cWMVKQO3s2tRVETiCjaAqJEP07j6+7/8+iBPUs0fvL h+kp/E6PcnqyYWUqG59F/3ZeU70kiGY07l3hQvbLpNBCt3t1iWf5QNdBLdiectlwVpUt QeBt8mnbvICcUF5oiCeoqJI0iA2IeImm8U5ds+UWpIGcD9aXWqd1AkDKZ93EqKls7AB2 0pAF58tqf2/38jwkjYdGFaIN+40P2yHgAVsfJYDg+Fq3uv26QonvQ82uDsdw8YMFurWN 3bWyZVG6EtL/8TFgXpFhYpOP2XrDOxLlcn/KzrhqBjo3xgSoFcu87uGw9EyRV4u96WAT kd4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=h12Q2V18htPXHRCKykpSt7S9FsZs9ox9Wx+fgPovHTY=; b=zkvIvR3yIEzZ6SOj03LZX1g9RPYltCa91lAY5/Amu5322NqPgYneVIjIiPkim02hf/ yvuPKJsqhovYGLqDE4DSuILc1J41T3hagIy5fkKQ69CmifmKIvupNYn93XuW2FXuO15u 62nOK7ITM3D5NtMGYduw9tNOpHwwvCL2YtjNVmclM3vLLNnpb69sI7Rrm0qlO/7pBnGH rOIu+qyj0Pt0+wIeXGOUkF6Wy2pipmFVg7XiYX3oVGaB+rrAaYKZmOvZVyAxgPuVZyIO MQJZPcowKg+r5waI39V7gd4tYmTg9PY12V04cWH+7lqHV8yc+byOTl7Ni6gaWD33jDPy 0G/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg2-20020a17090326c200b0018981449921si2109417plb.107.2022.12.16.03.27.53; Fri, 16 Dec 2022 03:28:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229660AbiLPKby (ORCPT + 68 others); Fri, 16 Dec 2022 05:31:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbiLPKbs (ORCPT ); Fri, 16 Dec 2022 05:31:48 -0500 Received: from outbound-smtp16.blacknight.com (outbound-smtp16.blacknight.com [46.22.139.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 682232B63E for ; Fri, 16 Dec 2022 02:31:47 -0800 (PST) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp16.blacknight.com (Postfix) with ESMTPS id E2C901C3BB2 for ; Fri, 16 Dec 2022 10:31:45 +0000 (GMT) Received: (qmail 9659 invoked from network); 16 Dec 2022 10:31:45 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 16 Dec 2022 10:31:45 -0000 Date: Fri, 16 Dec 2022 10:31:41 +0000 From: Mel Gorman To: Sebastian Andrzej Siewior Cc: Peter Zijlstra , Jan Kara , Thomas Gleixner , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Pierre Gondois , Steven Rostedt , Catalin Marinas , Davidlohr Bueso , LKML , Linux-RT Subject: Re: [PATCH] rtmutex: Add acquire semantics for rtmutex lock acquisition Message-ID: <20221216103141.6qxxmlzuqznp54qu@techsingularity.net> References: <20221202100223.6mevpbl7i6x5udfd@techsingularity.net> <20221202150158.xzgovoy7wuic6vvk@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 06, 2022 at 12:43:51PM +0100, Sebastian Andrzej Siewior wrote: > > > Before that, it did cmpxchg() which should be fine. > > > > > > Regarding mark_rt_mutex_waiters(). Isn't acquire semantic required in > > > order for the lock-owner not perform the fastpath but go to the slowpath > > > instead? > > > > > > > Good spot, it does. While the most straight-forward solution is to use > > cmpxchg_acquire, I think it is overkill because it could incur back-to-back > > ACQUIRE operations in the event of contention. There could be a smp_wmb > > after the cmpxchg_relaxed but that impacts all arches and a non-paired > > smp_wmb is generally frowned upon. > > but in general, it should succeed on the first iteration. It can only > fail (and retry) if the owner was able to unlock it first. A second > locker will spin on the wait_lock so. > Sure, generally it would be fine but it also costs us nothing to avoid additional overhead in the contended case. The pattern of atomic_relaxed+smp_mb__after_atomic is unusual but I think the comment is sufficient to explain why it's structured like that. -- Mel Gorman SUSE Labs