From patchwork Wed Sep 11 22:52:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danilo Krummrich X-Patchwork-Id: 13801176 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98637EE57D7 for ; Wed, 11 Sep 2024 22:55:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 244506B008A; Wed, 11 Sep 2024 18:55:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CF356B008C; Wed, 11 Sep 2024 18:55:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06DF06B0092; Wed, 11 Sep 2024 18:55:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DD2926B008A for ; Wed, 11 Sep 2024 18:55:19 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 840F1A115C for ; Wed, 11 Sep 2024 22:55:19 +0000 (UTC) X-FDA: 82553965158.23.9F10974 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf05.hostedemail.com (Postfix) with ESMTP id E9D0A100005 for ; Wed, 11 Sep 2024 22:55:17 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=KCGcTqnl; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726095241; a=rsa-sha256; cv=none; b=Wg3WR1D4wd8ZMq6khUrqgVPs+/eR6tDcWxJEJjEC0TsHd3Te6QYk9QhdjpIEdNNgc9gsMP 25JaNG9FgLE0dUQDlF47WtCljo0j79wIdrvgGj9KluCc8ZYsRKtttAfrrqtPAMVsbrrhaI rfaiSLrWfcx8FVZgmhs8e71sC3MqcOo= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=KCGcTqnl; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726095241; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mTEK4ewxpHHdTJ0KIUOEQy2oIL8O9c+6dlpP59lW2IM=; b=C7QzQaJWqMyMPrtnBCAX8C/MSusribDCPEsG2R6Z4Kx3+LAks5Vi2X5ZufX/7tEGO6oHJh uz0p/1misbvwG64qoe9LUmDKueY+2NvoPY9UrzwvHQoMBWG6NUMJhvLZ2ZRH9Qfq2jgQwB m11vPmUAd7tEorSpI2QKJyIkGJn//DQ= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A4BEA5C06C5; Wed, 11 Sep 2024 22:55:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1039CC4CECE; Wed, 11 Sep 2024 22:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726095316; bh=Ul5b1CTJ9tob+sYMI0uOwgqpbhRR4cA87hpBjRrp3KM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCGcTqnlJVTcLOAmbSEUKqOazK/xR4SmyhHf6E6yLxfNTUBqg888J/jQNW3zoXMsW BI7/fwKW0MKhxs3jEBmYWCiX4BhCu3aKf0fLOGyIKRsM56Bnyr3XrrFXy62AfbCpLW 8UF1PfSA3yeN2oduAomH1dIhBJa9dBiM9jJu8L/NJ+IvW3gY6y7K6YmVvjs0Wkm3Da 7EZiR7QheKaarwwp8Fxdn7RjH/jtPFM9neQDEJW/KBl4n37/fZAZM94WAfK9n0Ka8B 0vTcbjzPGHt2Hv76tpvxptGeMIwheH2dMcELkpMpl4R7rMMGQd0pYO6WbbhSgsk/34 zCnCFGDSpWd7w== From: Danilo Krummrich To: ojeda@kernel.org, alex.gaynor@gmail.com, wedsonaf@gmail.com, boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, benno.lossin@proton.me, a.hindborg@samsung.com, aliceryhl@google.com, akpm@linux-foundation.org Cc: daniel.almeida@collabora.com, faith.ekstrand@collabora.com, boris.brezillon@collabora.com, lina@asahilina.net, mcanal@igalia.com, zhiw@nvidia.com, cjia@nvidia.com, jhubbard@nvidia.com, airlied@redhat.com, ajanulgu@redhat.com, lyude@redhat.com, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-mm@kvack.org, Danilo Krummrich Subject: [PATCH v7 03/26] rust: alloc: rename `KernelAllocator` to `Kmalloc` Date: Thu, 12 Sep 2024 00:52:39 +0200 Message-ID: <20240911225449.152928-4-dakr@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240911225449.152928-1-dakr@kernel.org> References: <20240911225449.152928-1-dakr@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E9D0A100005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: yqqgxsb4rhj3wyaei96yq6intqfgx7dd X-HE-Tag: 1726095317-685431 X-HE-Meta: U2FsdGVkX1/N6tylnjzc9j1wrxttRW0c/BznXQNdTxGPG+3Y2yTtkmUiJ18iXhV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yKrCV/N63G/HONe+yIT79wFTe4LaYh4luQ0oczH3HuZvWx6Wd3HCMUpRIYdQNRRIQ4Ukw4/n+haoVuupxzCchGezykz9giEH2jnse3Kybt9pp2SRszSGVLikcgOhJeyv/0o3SonE6FeJEAA82gIk1YUUjQDvNsz7R96+SXB+Z+xJeNrYT0rrm/CripHaoPwxPHJwCZvxkABi628fUv9g3SQakouBpSl2c+/o2C/mcrXYyYUFSPh1GN1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Subsequent patches implement `Vmalloc` and `KVmalloc` allocators, hence align `KernelAllocator` to this naming scheme. Reviewed-by: Alice Ryhl Reviewed-by: Benno Lossin Reviewed-by: Gary Guo Signed-off-by: Danilo Krummrich --- rust/kernel/alloc/allocator.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust/kernel/alloc/allocator.rs b/rust/kernel/alloc/allocator.rs index c83b6dff896d..e32182f91167 100644 --- a/rust/kernel/alloc/allocator.rs +++ b/rust/kernel/alloc/allocator.rs @@ -6,7 +6,7 @@ use core::alloc::{GlobalAlloc, Layout}; use core::ptr; -struct KernelAllocator; +struct Kmalloc; /// Returns a proper size to alloc a new object aligned to `new_layout`'s alignment. fn aligned_size(new_layout: Layout) -> usize { @@ -36,7 +36,7 @@ pub(crate) unsafe fn krealloc_aligned(ptr: *mut u8, new_layout: Layout, flags: F unsafe { bindings::krealloc(ptr as *const core::ffi::c_void, size, flags.0) as *mut u8 } } -unsafe impl GlobalAlloc for KernelAllocator { +unsafe impl GlobalAlloc for Kmalloc { unsafe fn alloc(&self, layout: Layout) -> *mut u8 { // SAFETY: `ptr::null_mut()` is null and `layout` has a non-zero size by the function safety // requirement. @@ -72,7 +72,7 @@ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { } #[global_allocator] -static ALLOCATOR: KernelAllocator = KernelAllocator; +static ALLOCATOR: Kmalloc = Kmalloc; // See . #[no_mangle]