From patchwork Fri Aug 16 00:10:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danilo Krummrich X-Patchwork-Id: 13765284 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 EBC6AC531DE for ; Fri, 16 Aug 2024 00:12:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 769576B0280; Thu, 15 Aug 2024 20:12:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 718846B0281; Thu, 15 Aug 2024 20:12:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E0AC6B0282; Thu, 15 Aug 2024 20:12:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 405DB6B0280 for ; Thu, 15 Aug 2024 20:12:44 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C0C4B161807 for ; Fri, 16 Aug 2024 00:12:43 +0000 (UTC) X-FDA: 82456182606.16.15F9D97 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 0CE3B100022 for ; Fri, 16 Aug 2024 00:12:41 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ne94WL1V; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.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=1723767102; a=rsa-sha256; cv=none; b=Tkbk3sJZMLZSxbLMfrCmpTKJc17z8U+42F9+dk+J6KNtLC/eGY9F30bXxkJUQUhjCwJhUV XPUfc9s+SQEWMWuro/UCiJBjQTiP+Mvl446uAI1uKoAjhjCGUx9ZMqxMRCY/CZcd75Uadf 2ikEc1Ml8tY7lCRD6n7hZID87owU6Ew= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ne94WL1V; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.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=1723767102; 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=0Gw8WJBuxzKH1UfCqCKPYOMqr7ulesyg9AyrHQ8R/0T/V1yis+i0zh4Z9rJd39QlL2b1Qd SZHrA1E3jT5nkA/w2qj6zoDh6brjQ8+IK9T319yz6uSW/yh/+CE7IKs68SuXuvae7He0aP UM2VIJPU1vQpOfcOtpbKZold2+Vw37M= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 34B4862061; Fri, 16 Aug 2024 00:12:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E4ACC4AF0E; Fri, 16 Aug 2024 00:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723767160; bh=Ul5b1CTJ9tob+sYMI0uOwgqpbhRR4cA87hpBjRrp3KM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ne94WL1V890QjFloYBA4pmcsK1kTJW/b0HtCFvQl+YVAByoQSFc2VMznmdoDkS4D0 0EfR5GYsJQkhnF+Avj43Zq9zmRhhmVXGfC2IxoB7jmCgB3fx/sqJIwFjNUh6dwj6DN e9KBqyqVWRqVra2FOjv9Sx1BWS+kLGvDCeIlYaWcMphAOgXKsZhEr5eav53HRgxYwR dmSOkJtgf28m/KgG4IRnRdj36p59EFR4iSzIHQSP6IjGAUZpojWgFiMYTUp+Tt5jhh od0smleLkl310st+/eWgw2HoN5ArGPO+Wm+Rz3lZc3rdQ382Lq95vqZSudTx3FJT7w zQL4UXHY0emqQ== 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 v6 03/26] rust: alloc: rename `KernelAllocator` to `Kmalloc` Date: Fri, 16 Aug 2024 02:10:45 +0200 Message-ID: <20240816001216.26575-4-dakr@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240816001216.26575-1-dakr@kernel.org> References: <20240816001216.26575-1-dakr@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0CE3B100022 X-Stat-Signature: s5xitce8knut5exjkiu3wj1mk3yucs93 X-Rspam-User: X-HE-Tag: 1723767161-103163 X-HE-Meta: U2FsdGVkX1/jyjunghDkJ/VBazVAxhRlqJYfWZf5IX1+HooQvrLhUrm3nEfTm0zEwOGmz2w9kyXzDqGFG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P+nO96K4vGbN27yEyRUeidviDkI80iyOMsMWsGfxnk+2lL/vMtxgzqOPWVisnCecOtTDznu1R3RSCTDMk9SStFAYLs1kQXPz315G5R0/T6ZmD/ZOyNjdtz3wSCEKblLs3Ack/zm7XXWtLX3b67Gx9gKXVH1rCeMPnO4pJdz6RVwnua61LmxV3DoeTmZGIeAAE53Q25IAaH/51NJwAdefDEc9JH3GMMyBQwEX487M6KVdmHCbxUodHLS05a4ataVY5Ogn 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]