Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp5716078rdb; Sun, 31 Dec 2023 13:51:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjg8F8M/0qny01kM+ugTfSm/5qYt+biQBcs2F6qBREM5DGqidNqdTjQKvwh5sdYTc1wGJS X-Received: by 2002:a05:6e02:164b:b0:35f:f4dd:e5ce with SMTP id v11-20020a056e02164b00b0035ff4dde5cemr16583729ilu.57.1704059512610; Sun, 31 Dec 2023 13:51:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704059512; cv=none; d=google.com; s=arc-20160816; b=nO4uu41gVBsc/95AOQ2XUe7MbxnA2J7/EIwOi+wiOr6tEXE7210MYGUEgjoVKHaLuv hd+PTgfbm3jr9EQW0ZCK1WJvjgtELVfHeWTQjJMfgNfPlp36A05OtgIGug4Wf5A1I4d9 yx9yY1LPX2//YXMnSzWsjZuGDqHEtIYNq/+L5dj5B/BbFA13YkdbmgPLp0K7YVqOkxht V86gVyvgJpOQOgkLTuzHFccXiAC2RKirg+KejfwW0RqJPPmsL8nGzhHERjQIa4DKcGYr 38WZJrolpq8g8AAzMhJ1pVXfYrSn1UIeoI3d4kKt+I4+JWxWnAS04sLrqWyp6/mP6//y 0Nig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=qDE9bmzwJaXr4lwSHB+W//GlyECb8CAiJaYPe8pRxWE=; fh=rK8F4zm15J6Jc7pqIJYnBw4d8zHrqB7RdoX7pamyocA=; b=vUANr0kygQq/YuSxTBNcON+1iWgtR6cN6xiUw+LKlGoYbbz+JBllVqFDSbxfJ/coif bJ5JSqdpFheI+VX5ClRLHK/ZPEnvSQ4Coch0qYSk2jq92vtcN5dnblRnKiX9AxxLCfIF pQRC9LHFcdeci1KzdpbPAvRXGiZLnOtkPtEaQbxfY8mX+1DvXxin5yNxUla9O2Wei/Z+ L77LkxJXs2MHessVR/9LrpVssvxfTdUlDUaR/m3nza6233WswqfEgKuzpPMGV3zjUVFJ 9qFFPzqqLtdNtguw4B3I/K/tRbS8z7KO9sJaSWghWEL0dD3RFGDf7cML9Qpd0yE5W+sN mwPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-13790-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id kq16-20020a056a004b1000b006d997f5cf8asi14666290pfb.104.2023.12.31.13.51.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Dec 2023 13:51:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13790-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-13790-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 087FA282706 for ; Sun, 31 Dec 2023 21:51:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13B40C126; Sun, 31 Dec 2023 21:51:47 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) (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 CA524BE48 for ; Sun, 31 Dec 2023 21:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aculab.com Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-176-11hdVQWzMwqIR5R8bjWLew-1; Sun, 31 Dec 2023 21:51:41 +0000 X-MC-Unique: 11hdVQWzMwqIR5R8bjWLew-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 31 Dec 2023 21:51:20 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Sun, 31 Dec 2023 21:51:20 +0000 From: David Laight To: "'linux-kernel@vger.kernel.org'" , "'peterz@infradead.org'" , "'longman@redhat.com'" CC: "'mingo@redhat.com'" , "'will@kernel.org'" , "'boqun.feng@gmail.com'" , "'Linus Torvalds'" , "'virtualization@lists.linux-foundation.org'" , 'Zeng Heng' Subject: [PATCH next v2 1/5] locking/osq_lock: Defer clearing node->locked until the slow osq_lock() path. Thread-Topic: [PATCH next v2 1/5] locking/osq_lock: Defer clearing node->locked until the slow osq_lock() path. Thread-Index: Ado8M4Xvt5eQHXh8TpKpithIgw++9g== Date: Sun, 31 Dec 2023 21:51:20 +0000 Message-ID: <714ca2e587cf4cd485ae04e5afb8d5bb@AcuMS.aculab.com> References: <2b4e8a5816a742d2bd23fdbaa8498e80@AcuMS.aculab.com> In-Reply-To: <2b4e8a5816a742d2bd23fdbaa8498e80@AcuMS.aculab.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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) =09int curr =3D encode_cpu(smp_processor_id()); =09int old; =20 -=09node->locked =3D 0; =09node->next =3D NULL; =09node->cpu =3D curr; =20 @@ -111,6 +110,7 @@ bool osq_lock(struct optimistic_spin_queue *lock) =09if (old =3D=3D OSQ_UNLOCKED_VAL) =09=09return true; =20 +=09node->locked =3D 0; =09prev =3D decode_cpu(old); =09node->prev =3D prev; =20 --=20 2.17.1 - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)