Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp5826213rdb; Sun, 31 Dec 2023 20:08:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IErIRlks127FGs8csezjqQc7Mxi/nf9deg6UyM95EbknDmMPsybskXhWVULsHHZvGelkZh/ X-Received: by 2002:ad4:5b8f:0:b0:67f:454c:84de with SMTP id 15-20020ad45b8f000000b0067f454c84demr20836139qvp.62.1704082108152; Sun, 31 Dec 2023 20:08:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704082108; cv=none; d=google.com; s=arc-20160816; b=XzoOhOhJSyQ8BnEQAUa5Ins85GgRKSS5is6ImOUo7uXUAE66aeEvhM246Bl9jPvIR7 MhGKOpCKz5un3eJdmu+zZAAFN4bUM5WKdg3EV2igX8qptTTjjAZ1aZKhgt3+h0GXz/5K DrNGFZti252o7CWxL5bDZ+pcoljDbN1GprGIZecLnKJ3igqPj0iiHtpp2mMWCJzpiCHS MaCPf9p63FrOma0gaOi5HYBaAUuqb9nV04JZEQp3mKX7MIK4h5umy/eGIvZJxr6cB0Sb PFoBF+m+Tn7NfXB3KHMhAG/HXtNMbNquybEW9sOr/yRwyrTWYghAyF14efK8GT8Jl5rg 4uiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=w3g91HopIn3gFGM2kCJmjXT4qR4+JT3oKKMT6KCXKZU=; fh=/8TN5tpEqOkkoN73Yz9fFu8j5QUKph09dO732LvPqE4=; b=cy50l+cRDfLVrAwLzjsUO9QmE7PY+qjDZciS69sbGIYpXuKV0nfghJ2F5scz+74hM2 v3dDk15S7Y8JmDSe5VvNVjG/MW1N7i/fbt0sIvxWhQDEpytsktGf10DMlaf2U73JAZv3 747OG9e6BHW32kERYhI5aVo4Ove7P7eXYniNFFImkxpdol/dJSoEBszf6bYnNHc8kNHg ysHAblmd+1yhWpQH3OSGTwNRJNwdDMtsinHCvlkY22YEjWDD22gTGRjdRnJiVyFb4rCc VlTwMYu0zDfw8ScmE10D0Wq4HZVl5URpmgtZ+YTXjNnPQ9HU3/PfbFyq4feDmTUHRjBW x/Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cbPnmnRG; spf=pass (google.com: domain of linux-kernel+bounces-13822-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13822-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o3-20020a0ccb03000000b0067f610329bfsi14360650qvk.489.2023.12.31.20.08.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Dec 2023 20:08:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13822-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cbPnmnRG; spf=pass (google.com: domain of linux-kernel+bounces-13822-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13822-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CAD361C21C85 for ; Mon, 1 Jan 2024 04:08:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CE8F10F4; Mon, 1 Jan 2024 04:08:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cbPnmnRG" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1D2A1375 for ; Mon, 1 Jan 2024 04:08:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704082095; 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=w3g91HopIn3gFGM2kCJmjXT4qR4+JT3oKKMT6KCXKZU=; b=cbPnmnRGuhke03SSO0z8m5DODSKtry5f9bDnO1TkdEB0wB93tO7qnhYomAc5464PHexL1j GdvZhlDzlZnKFOcVjtJW7TrPubojqnz8eK3CCr6o7SoLa2W/yv8o47T94J2tgL2tLb6oPd EmpvxBD+F3H3z07VcliyTollpt6AvSQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-275-CX7x_yuuOU-MSH7no3qi7A-1; Sun, 31 Dec 2023 23:08:09 -0500 X-MC-Unique: CX7x_yuuOU-MSH7no3qi7A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A036B185A780; Mon, 1 Jan 2024 04:08:08 +0000 (UTC) Received: from [10.22.16.25] (unknown [10.22.16.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6BCE51D5; Mon, 1 Jan 2024 04:08:07 +0000 (UTC) Message-ID: Date: Sun, 31 Dec 2023 23:08:07 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH next v2 1/5] locking/osq_lock: Defer clearing node->locked until the slow osq_lock() path. Content-Language: en-US To: David Laight , "'linux-kernel@vger.kernel.org'" , "'peterz@infradead.org'" Cc: "'mingo@redhat.com'" , "'will@kernel.org'" , "'boqun.feng@gmail.com'" , 'Linus Torvalds' , "'virtualization@lists.linux-foundation.org'" , 'Zeng Heng' References: <2b4e8a5816a742d2bd23fdbaa8498e80@AcuMS.aculab.com> <714ca2e587cf4cd485ae04e5afb8d5bb@AcuMS.aculab.com> From: Waiman Long In-Reply-To: <714ca2e587cf4cd485ae04e5afb8d5bb@AcuMS.aculab.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 On 12/31/23 16:51, David Laight wrote: > Since node->locked cannot be set before the assignment to prev->next > it is save to clear it in the slow path. > > Signed-off-by: David Laight > --- > kernel/locking/osq_lock.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c > index 75a6f6133866..e0bc74d85a76 100644 > --- a/kernel/locking/osq_lock.c > +++ b/kernel/locking/osq_lock.c > @@ -97,7 +97,6 @@ bool osq_lock(struct optimistic_spin_queue *lock) > int curr = encode_cpu(smp_processor_id()); > int old; > > - node->locked = 0; > node->next = NULL; > node->cpu = curr; > > @@ -111,6 +110,7 @@ bool osq_lock(struct optimistic_spin_queue *lock) > if (old == OSQ_UNLOCKED_VAL) > return true; > > + node->locked = 0; > prev = decode_cpu(old); > node->prev = prev; > Reviewed-by: Waiman Long