From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796392596; b=f557coFGCMUflPavkDYeDR5G/pqcJZcMHgxf44blev3vp7osw5UXya3KW3PQM3ay/pZl wqR9uqoGaZjjGKKTJfBBFcGE/plFMagy2ln/KTYoR2TLWzhORhSPhKnyeWCM+Lx3iEQ1n HjBgCm7wm7f6/paQ2UNK8YvOVVmLRzDmbRwyLnwK6A6LQgOf3tYNvUK2dqZPF8rEGi09R /pJv+RSgsZaJcBpGHOBdcgeTrB0EOGNgXYacJrLmOzvjpkjDXDx3wxn12HrBjcXugvxyo CjwV7fQLhwakGq4UaDZMoQGT6sf6wlhnAD98NYoyV4/8zA5fUSDgnJIczM+YMbtYMuw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796392596; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type; bh=imm+oDop46i1u/fWlqEC6oonz6R8n8Z/oiGuFwltl84=; b=3qce38p5r6+ElhRdGFyWoEZubDSGc4StmwfGHW3LFgP2geTUiB8vLQmcKgIY90BPIwIt e7nKspwsATBGYi4hmgNLsSjvc5vEfKaiHo2wRLybT8dvZjzxFfABFr5aPP9H0S+D5iVdc SnhoUrUYJ/WGXc0MbiUeW6kqO3COYTybE8/lU0VKpGOf7D+O+MRGGJaULc0tVmmab4mGl JJIGGewG7HIbICvmpXF1Dnva/flXYXmtspjRh6v32tUsRMuxMc7nnVKwVBefWGEyCJ8n5 XliESSebYMv9quMDD7Grk32mwSiJH+/xm5JQUE0NfUU01CDezC//fbSi4qKJN4JKwcg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=U9UouGut; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65B49606A680; Fri, 4 Dec 2026 13:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=U9UouGut Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD7821F00934; Fri, 4 Dec 2026 13:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796392596; bh=imm+oDop46i1u/fWlqEC6oonz6R8n8Z/oiGuFwltl84=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=U9UouGutF6JRYxXp8bBlpoZBHM50/+/QgWVof1Hm5bVORsGSPgu+JyuhhEqNa3wNf 7iWctLJ4L9Ickr8/lh+JHEDxW5UXf651qi2twd/d4PqxYz3O7nCmGmtajsrOcPFWOs Y98IhL1HjiqU02Q19w4r7JPUxbuKtsEz401LB8EIsgS/w2NsNq40TsdkuyYO313Cx9 JeQrJy9AxMX8eKT/2oAk0p0fJfZhTMy6A5ZYHanpZOXSE6iWX453tpqfxFLcbGthI+ 0IRbVkTLdzUQddTWkiBjSMV+FccBE7kszoXoK5TLXqIy960dbBXWm/WGi0un/FVb66 w5jX/5V/pI7ug== From: Andreas Hindborg To: Vitaly Wool , Jens Axboe Cc: Boqun Feng , Miguel Ojeda , Gary Guo , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , Benno Lossin , Alice Ryhl , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , Onur =?utf-8?Q?=C3=96zkan?= , Lorenzo Stoakes , "Liam R. Howlett" , linux-block@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vitaly Wool Subject: Re: [PATCH v3 0/3] rust: block: add rbrd, a RAM backed block driver In-Reply-To: <20261204114147.243508-1-vitaly.wool@konsulko.se> References: <20261204114147.243508-1-vitaly.wool@konsulko.se> Date: Fri, 04 Dec 2026 14:56:03 +0100 Message-ID: <87wlpp5evg.fsf@t14s.mail-host-address-is-not-set> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain "Vitaly Wool" writes: > This series adds rbrd, a RAM backed block driver written in Rust that > works like brd, together with the Rust abstractions it needs: > > 1) a `Guarded` page kind: a reference counted page whose data is only > accessed under a bit spinlock in `page->private`. A guard gives > access to the page data as a byte slice while the lock is held, and > `try_get_raw()` takes a speculative reference for lock-free lookups; > 2) a `discard_granularity` option for `GenDiskBuilder`; > 3) the driver itself, configured through configfs like rnull. Its pages > are kept in a flat array of atomic page pointers, so finding, adding > or removing a page takes no lock. > > Unlike brd, rbrd never lets a read and a write copy the same page at > the same time: each copy holds the page's bit spinlock. brd allows > this race, so a read that overlaps a write can return a torn mix of > old and new data. In Rust the race would also be undefined behaviour. > > This guarantee costs very little now. Under parallel load rbrd matches > brd: with 16 or more threads, writes run at 98-100% of brd's rate, and > 64k I/O runs at 99-103% (O_DIRECT, 1 GiB device, 24 vCPU KVM guest on > a Xeon host pinned to one NUMA node, both drivers on the same kernel, > median of 3 boots, kIOPS): > > test brd rbrd rbrd/brd > write 4k, 16 threads 5572 5468 98% > write 4k, 48 threads 5444 5333 98% > randwrite 4k, 24 thr 5797 5789 100% > randwrite 4k, 48 thr 5727 5735 100% > read 64k, 24 threads 264 270 102% > read 64k, 48 threads 262 266 102% > write 64k, 24 threads 258 259 101% > randwrite 64k, 24 thr 263 270 103% > > rbrd was stress tested with data verification on 4k and 512-byte > block devices while a third device was created, used and removed in a > loop, on a normal kernel and on a KASAN, lockdep and kmemleak build: > no errors, no leaks and a clean dmesg. The Rust doctests, including > the new `alloc_guarded()` example, pass. > Similar to v2 I only got 0/3 and 1/3 for this one. Best regards, Andreas Hindborg