Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3661922imw; Mon, 11 Jul 2022 13:07:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t+O+LpzR59i99q/YXe9c3Vr5TFaR9k8V/6Q9wByzrJwdVxFrTvoEb8WbvyLxoHmS61lC0o X-Received: by 2002:a17:902:c153:b0:16b:e7a9:7716 with SMTP id 19-20020a170902c15300b0016be7a97716mr20172486plj.20.1657570052109; Mon, 11 Jul 2022 13:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657570052; cv=none; d=google.com; s=arc-20160816; b=yFt84bAMyiVTdiiGnalsBkEWxi+Ql3Yb85kwy2kKpE2fzpMraRgUtuX3YoPqfsMZXw slAt4MRUo2jthgINP7udpdtkDHOpyZMIBQXKpysaHAwc324q2gbOgYrp6ODniEjBe01C EKWyQex8jgRDznBHmcgEnGlG+Kv54C7Dcy51n56hkBFezxwevGMgNu7Xo1OU5ivYEOP9 85fOvvDZKbPLyYjSmyrVW/keg9mZVyltW3+YdkiGq0UQpRGA0GbhombAV8oMABgjEoJr UgJH2emIYiz59zx7JRY61XkktHUAtWCd1WJwSjpeBsg7/Azj+YAeO5jrR4MN2zUDLwpF M3Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=8sdN/dE5SqV8XkLj/6o+J/yunhZmP7J+Ef0oD4L9K/0=; b=WY2XQJX9M6x7o1Sp2iPg0POUccYpCWajlOx0V4AqKKYOK33swU/cQnfvF6QiIyDiNm KSmur6LGjlfNpvMvBQ1QLsfDB7GE8hQu+SMGS2Fq40XP3EnVyLcDNSdN1mtupYjhbw1E ieVqRh42KKps8uXkERRkERtWSM+nPi5Y9h1aBqT8K8GKUB3qsvSXg1mEKQ0y8k04k9WR 1oiQf+FaILzFm5n8w1KehwcaZUo1muwyfPalk2RyHCJxQWw4buZwbAwpWJn4yq5mwRac dPfhzFXaY9lCfZF69+eSKwc0Qhug/isgKCPnC9zSRCoD+rU3YGdS1hlk4Iyw90EgPQuj 2hJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Jt2rp0Si; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q9-20020a637509000000b0040c9f5a0e43si10432043pgc.338.2022.07.11.13.07.20; Mon, 11 Jul 2022 13:07:32 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Jt2rp0Si; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230055AbiGKUC3 (ORCPT + 99 others); Mon, 11 Jul 2022 16:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiGKUC2 (ORCPT ); Mon, 11 Jul 2022 16:02:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1B072422EC for ; Mon, 11 Jul 2022 13:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657569747; h=from:from: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=8sdN/dE5SqV8XkLj/6o+J/yunhZmP7J+Ef0oD4L9K/0=; b=Jt2rp0Siy4QIndrDJWls26rxHXWjRvPQBJ3WckUBwLQRNcV9kyrS+ITo4PSOGZGqiX0g5T eGUMiBnZkQFRq/8i4jP9l1WKsq5qCFN/gjG52XkXxNGeSaKk4iy6RCMiVDvvRppB8Zm0Ba NnV+eRnYACtP0vBbMEUBD7WIom3wjX0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-113-z899xEvuMeW0c9CR6BfGGw-1; Mon, 11 Jul 2022 16:02:24 -0400 X-MC-Unique: z899xEvuMeW0c9CR6BfGGw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8F59829ABA21; Mon, 11 Jul 2022 20:02:19 +0000 (UTC) Received: from [10.18.17.215] (dhcp-17-215.bos.redhat.com [10.18.17.215]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BC5A1415120; Mon, 11 Jul 2022 20:02:19 +0000 (UTC) Message-ID: Date: Mon, 11 Jul 2022 16:02:21 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v3] locking/rtmutex: Limit # of lock stealing for non-RT waiters Content-Language: en-US To: Peter Zijlstra Cc: Ingo Molnar , Will Deacon , Boqun Feng , linux-kernel@vger.kernel.org, Thomas Gleixner , Sebastian Andrzej Siewior , Juri Lelli , Mike Stowell References: <20220706135916.980580-1-longman@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 7/11/22 05:34, Peter Zijlstra wrote: > On Wed, Jul 06, 2022 at 09:59:16AM -0400, Waiman Long wrote: >> Commit 48eb3f4fcfd3 ("locking/rtmutex: Implement equal priority lock >> stealing") allows unlimited number of lock stealing's for non-RT >> tasks. That can lead to lock starvation of non-RT top waiter tasks if >> there is a constant incoming stream of non-RT lockers. This can cause >> rcu_preempt self-detected stall or even task lockup in PREEMPT_RT kernel. >> For example, >> >> [77107.424943] rcu: INFO: rcu_preempt self-detected stall on CPU >> [ 1249.921363] INFO: task systemd:2178 blocked for more than 622 seconds. >> >> Avoiding this problem and ensuring forward progress by limiting the >> number of times that a lock can be stolen from each waiter. This patch >> sets a threshold of 32. That number is arbitrary and can be changed >> if needed. >> > Why not do the same thing we do for regular mutexes? > The mutex way is another possible alternative. So we can set a flag to disable lock stealing if the current top waiter wake up and the rtmutex has been stolen. I will need to run some tests to find out how many time lock stealing can happen before it is blocked. I would like to allow sufficient number of lock stealing to minimize the performance impact of this change. Cheers, Longman