Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp358640pxv; Wed, 30 Jun 2021 07:14:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFcf1PSU53JgWUjCk2CYI5g+TEoudqL/Mq3ysroEovDPv9nKfFuXZjYx2wAryJ8lTAtMIi X-Received: by 2002:a17:907:384:: with SMTP id ss4mr35353077ejb.120.1625062483024; Wed, 30 Jun 2021 07:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625062483; cv=none; d=google.com; s=arc-20160816; b=zu6wRz2mKtbV/zmIToEfVJMs1BYT2vbrWDUNmUw4+djelt5c1VgOI/c2fG5UK3SkIW au9t6ZBpLPZZQ6jKfVTEpiPJMJG2cwSyfq4kcX9dIDuc6ZJ+aKnlGgraa6ut4aQLaCmy VYc+QRbY4QPfDdh9n0tltdRHCIjSpEHlPFRf75sWemoVyrmSfzm7eGVFfT5nv6WCE6CH 1xOZcF8Yh85K0pHiAQN7UHHFGyOHB9OxBA/47GbEW6KP2AlkLUEgGEXWVyGrjOCXUMtP HggMDJQjjUhf4q+yqs3LKROlmgFleADRlR/isMSz0GjrUMO8pMBkxAs9Ub/eexw5B2PI 8ENw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from:dkim-signature; bh=3pBbHaYzTF8tHlMP9sN+27KFJWraEHRhzABE2ErPcBg=; b=Zmv+MAtGERmFKAVaE9aQNFW6BLDic7nD//cr48IDl136ivgWvR2w8xT5QD/K77xUeF dP56PmhWoDdExW1W7C0KRJwQqDdcF8tPcPUpjnITjQRsGbZ6LoSj1rnM17WnTmiHnvLh 9jw0ZekZhsMkTTVJZ+wb7u5U56piW74NTzAjrQEt/gL9EP4HnTMoPP7C8ttDKYVHd5CJ b1hvlzPzD+dmEiX9xDZ1zBA0dz35i4THEKMZEY9TwbUijE98L8MOwWtHvEFNhJVlMIzF 3BWNCoCAM09mkRi5Hqpj9n/K0oq9EABhySgKIQYcyEsoReuiVUmrBMASRfc/Ua5cVKmw 2KGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ek92yLjH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si19223801ejl.365.2021.06.30.07.14.18; Wed, 30 Jun 2021 07:14:43 -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=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ek92yLjH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235197AbhF3OPp (ORCPT + 99 others); Wed, 30 Jun 2021 10:15:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39032 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235103AbhF3OPj (ORCPT ); Wed, 30 Jun 2021 10:15:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625062389; 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=3pBbHaYzTF8tHlMP9sN+27KFJWraEHRhzABE2ErPcBg=; b=Ek92yLjHQ2K2oVksSXRyLkVBC8tgTuF7S3QkhAR0fqRZXFom+lE6kpbLxFqG3M+nR/1y5F qWuitEa7p0BrjFIWyxnUyAqu4nc9UOLoRG9mcdt+kpmlqPOQyEGPugZZk3U6zPif49FUVZ M/kXb7qGt1EA0RFwfITqwHPeyTjvI8w= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-76-WK1WgZC_PaqjHH3lIlQVBw-1; Wed, 30 Jun 2021 10:13:08 -0400 X-MC-Unique: WK1WgZC_PaqjHH3lIlQVBw-1 Received: by mail-qt1-f197.google.com with SMTP id d26-20020ac847da0000b0290250c4d73502so1169056qtr.20 for ; Wed, 30 Jun 2021 07:13:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=3pBbHaYzTF8tHlMP9sN+27KFJWraEHRhzABE2ErPcBg=; b=SGLP2JWOm/Q7Vyi6h1aPcpFMxut6iDPDp79M+ewFAV9+0mYJKDCrGaoAtKP3pqy97R HsrJhguxl3JKUNCXEniiODqx3tb4w8/0tu4UZN6nH4saUC2gkNGKlaoiYh1XB2NaYCC3 wF8rAawQ9beUWKdS/mSiyOpt6+y2dL7LTfVebl8TOGD0MFhvbY0MBPBNBVr6WeFD6ou2 vYRdpc9eaAPqfjquH+FLt5HqnAeBkCevFeegX520fWFLT5V0ljMfArXQtUvrwm9UjKig Tb1WQ4EFDKlAaQyjsb48oG+oq8VgLpcRSoZt69SNHeRPZspxybGWtkttNf+5zFaJ3rCC R6/w== X-Gm-Message-State: AOAM533cSlYFOCmUcPBufN7V1Ukbq95cW0Wgs9KgCD78bh1BKgKAEa2u 6U428j0zJ8XDCBGqKSGjIAQSGX+WUJrQ0Yjxw2p7VLFKQ/R6Hc9k836Ok6Xu3gu+PjPgLyCqLbU djyAe3Iqi+0QmRWIhyrvBUPZH X-Received: by 2002:a05:622a:d1:: with SMTP id p17mr31848920qtw.141.1625062388201; Wed, 30 Jun 2021 07:13:08 -0700 (PDT) X-Received: by 2002:a05:622a:d1:: with SMTP id p17mr31848902qtw.141.1625062387970; Wed, 30 Jun 2021 07:13:07 -0700 (PDT) Received: from llong.remote.csb ([2601:191:8500:76c0::cdbc]) by smtp.gmail.com with ESMTPSA id h1sm5355360qkm.50.2021.06.30.07.13.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Jun 2021 07:13:07 -0700 (PDT) From: Waiman Long X-Google-Original-From: Waiman Long Subject: Re: [PATCH] locking/mutex: Reduce chance of setting HANDOFF bit on unlocked mutex To: Peter Zijlstra , Waiman Long Cc: Ingo Molnar , Will Deacon , Boqun Feng , linux-kernel@vger.kernel.org, "Xu, Yanfei" References: <20210629201138.31507-1-longman@redhat.com> Message-ID: <139a3dc2-1693-5e33-3d2d-77a5651d92e1@redhat.com> Date: Wed, 30 Jun 2021 10:13:06 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/30/21 9:56 AM, Peter Zijlstra wrote: > On Wed, Jun 30, 2021 at 09:50:11AM -0400, Waiman Long wrote: > >> The code looks good to me. It is an even better approach to make sure that >> the HANDOFF will never be set on an unlocked mutex. >> >> Reviewed-by: Waiman Long > Thanks, what about that XXX? Should we not check sigpending before doing > the optimistic spinning thing? > Sorry, I missed the XXX comment:-) This is a generic problem as other waiters that go into the spinning loop also don't check for sigpending. On the other hand, I am fine with doing the pending signal check before doing the optimistic spinning. Cheers, Longman