Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp583186rdb; Thu, 15 Feb 2024 08:57:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWmSrSSd9UEm4F3y0HZdjRUtMl2FoAGRrLqurYChrkW9V4vqoTpWY/5w92YNBcTs+8YezjAVxJBuFAmZ+UkoFw0hhWWj72bEpooWAOs3Q== X-Google-Smtp-Source: AGHT+IFf43/v84icZRj8fEZpIzI1mA6GUimpejE9D/7U8bWccAtdAIigL0fAG/rXK2zrdcX60hB3 X-Received: by 2002:a17:902:d484:b0:1d9:373a:6124 with SMTP id c4-20020a170902d48400b001d9373a6124mr2766466plg.22.1708016247070; Thu, 15 Feb 2024 08:57:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708016247; cv=pass; d=google.com; s=arc-20160816; b=EFPnahMgy+qo/2edT6YbPnnHR3by0URU3P7kwHZiePv5vr7Nug6mygdtyxlrUvvtoB vVFxQexeiAMKdfiw3w2M5CAQWd1QVIJMGBJz2PO1zxk7b9iYaiN5UqrPysYk6Nkuowqj fu+AspjgyvL+Ena7H1umbLtI5XFSKfw1/4el946gL0QCjLmcYmA0D2T1AP/ancWmleDX e65D+lQYUizfRaoQwYJBb3FQsKFE8TbJHHNgGpgV3p+QA1cYqiWfEErOmV9Yula8Wxf7 5PdwDvu/NKBAfLywF0ObgLj2Y/lDnhQB4m6YsC/dIeGZRxlYIVh/F4ablV/DWmaeoqIE riuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=3urhEffbny3eqMehm9nA/WWlSnq5YVWchMtHmZ8KO9c=; fh=+j5O4aHLxj+TCbehtvWzjgIY8OfGMJ2pB2Uuav3l3Fo=; b=fHRsKku193G/jKHGihHBhXyUzMkq4OSmCgjC0Nk0upiOUDoEQA4tEA8BAVWIRBowHW jhP9Pewl0Gg8QGbNhFOVYD6CrZ4wKhmTV/8cvH4Cb3/v3t4/JNR8BzcQk4rAI7mXu6M7 UEf3h5sWKNmUesfDpAm2MP2dHY0jASmxRy81RCBHZ2T87BqdnvL7dXLMwoDLUJjejSJc Aq1+6LG4yAw+MDh/J71gpUksrXJ8Jz4LVQs6uSHPnP0aScYQ+W+aVY4SuEMq8KJrEXiv aN/2Ea37TXNi4YPgL7LPd1RR8e7Zm0qpgT/Sxv2YwChTBahMlylUuAO92ppzvWEZZ+qx 2yOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZZw5XIyk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67347-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n8-20020a170902e54800b001d8f3a10d9csi1435030plf.595.2024.02.15.08.57.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:57:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67347-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; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZZw5XIyk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67347-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 58ECC286EBA for ; Thu, 15 Feb 2024 16:57:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 75C6A136983; Thu, 15 Feb 2024 16:53:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZZw5XIyk" Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40A25136642; Thu, 15 Feb 2024 16:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708015983; cv=none; b=uIO7LPi82W5VFP+sHQns9NnHOR23khwFLs77cy28/MVSxyD/odSSbXBP82MTo9NrZ5dOvwGUnpwOH4F2cGku/NRrv6NDzBRVzg1aZ5tEwlz9g/z8CFscP3O2waLCrXkMKbcXYrk2bwjUFBBPTXxn8L0P/BDlGK7MgDbC8dzjSvY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708015983; c=relaxed/simple; bh=3urhEffbny3eqMehm9nA/WWlSnq5YVWchMtHmZ8KO9c=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=J8LKT52SSEdnp4xTLSKUbNH4MExp1UwmewPJiOnOJ0dbxYHl2kKSLFE7FxLyr6QMrGc3tLZga8Bn5yLs8ysuw/IvN6q6cHolShFcNXxi59/NKGzkpYEVg+kAdKPL41lePCr8Xfj4BmjeyCcgwwvMmWPweUeelgPQfkl6UqKNNLg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZZw5XIyk; arc=none smtp.client-ip=209.85.128.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-607e60d01b2so3235487b3.1; Thu, 15 Feb 2024 08:53:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708015981; x=1708620781; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=3urhEffbny3eqMehm9nA/WWlSnq5YVWchMtHmZ8KO9c=; b=ZZw5XIykAKFEXT2I5UYYmc5dkhtuAPDQK+abq+VHLz3jZKfXffwc5urp9U0xI9AvgM C0wlPjpsti9EkQ1n3mfpxPVhr28chhMHazi5aedVxA1Uvp8HdTT4V4wkv8hELKh4qboS 75O01CdAoI15t89enlt80+vn3MzYEUxWidf3YMimxtyU1YDL7/vAKLpvjTSthDDQ48Q/ sscGGoTHz1n8exOl52+qKe2OeJsyGlsvXsbpv9R+hJBxQQOVkCSiCBc6pZQ2rlP5tFNe 5SSwbQol6xjVkOcIDqgE+gdzqvwFG9cTTN8jCff9ErFOc2m5jwEHI/8Adzvy4Lhm196s HXXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708015981; x=1708620781; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3urhEffbny3eqMehm9nA/WWlSnq5YVWchMtHmZ8KO9c=; b=XDZ6hIWV8I+zuVBEJ7ZHlRZiW5FBxVTwsYs3jiFOmbzVnjYJ49Cki8x4HcfqH3gJne QI44P82szsKRXXJZWb9Y04508VxXNFFSKFRPsZTB1UaysGEMaXgMRhHZJ1DIwPZo4Q01 UAWdPitHr+u9iUwm5HntH+x9aoEQs6g6iKdJp67hWh4uZbGf/LWF7zLaBZb9jsFFvgmm ebgzmOIbbj9rE8KWdVzInEXj+E2CFKr3Rl01dXHu5Fp+QaNfkPbQjRSm/UaVnRsAm5dB TpYbKIGoi023wVywcwwgtreUcKPfHRmNETH8HhclYwO6UGxgnzVzgKpCf6IPBpfgKEki 5H2Q== X-Forwarded-Encrypted: i=1; AJvYcCXMqXoSvOPtUuMNBagyNIY25YddB0KXkd/Rg6mv7Htmx3kxpi2Wxt9OcN8wZK/hdSkzSzPvsp8wmxU9gQERFwfdH/qGpMPA9XQBDq8qniNKFbfKmH/4OdPynud3MpusMCSh32bKKjAWgbI3SSU= X-Gm-Message-State: AOJu0YwVHdDR4H7lrT5n7nSl+DkBRQ5Ux1WzXv0lnpP8nMzLAGouHD/s dXCZRAJBsUq/m6yrPKK6MymOJDZtMTtXTY7r053d1802AfunMhyPgrAvQ8oCQ6ZTRIpw1G6QrwE HOLf5ugEAdDs1uzI/X7/3FntQuirV35ZLK+A= X-Received: by 2002:a81:451e:0:b0:607:e8eb:678b with SMTP id s30-20020a81451e000000b00607e8eb678bmr1001204ywa.28.1708015981050; Thu, 15 Feb 2024 08:53:01 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212-rust-locks-get-mut-v2-1-5ccd34c2b70b@gmail.com> In-Reply-To: <20240212-rust-locks-get-mut-v2-1-5ccd34c2b70b@gmail.com> From: Wedson Almeida Filho Date: Thu, 15 Feb 2024 13:52:53 -0300 Message-ID: Subject: Re: [PATCH v2] rust: locks: Add `get_mut` method to `Lock` To: mathys35.gasnier@gmail.com Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Rodriguez Reboredo Content-Type: text/plain; charset="UTF-8" On Mon, 12 Feb 2024 at 11:13, Mathys-Gasnier via B4 Relay wrote: > > From: Mathys-Gasnier > > Having a mutable reference guarantees that no other threads have > access to the lock, so we can take advantage of that to grant callers > access to the protected data without the the cost of acquiring and > releasing the locks. Since the lifetime of the data is tied to the > mutable reference, the borrow checker guarantees that the usage is safe. > > Reviewed-by: Martin Rodriguez Reboredo > Signed-off-by: Mathys-Gasnier Reviewed-by: Wedson Almeida Filho