From patchwork Fri Oct 4 15:41:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danilo Krummrich X-Patchwork-Id: 13822614 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 787E8CF8849 for ; Fri, 4 Oct 2024 15:42:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F7BC6B0401; Fri, 4 Oct 2024 11:42:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0AB566B0402; Fri, 4 Oct 2024 11:42:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8B5C6B0404; Fri, 4 Oct 2024 11:42:24 -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 CA1506B0401 for ; Fri, 4 Oct 2024 11:42:24 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5CC4540BD5 for ; Fri, 4 Oct 2024 15:42:24 +0000 (UTC) X-FDA: 82636336608.27.E3681D7 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf16.hostedemail.com (Postfix) with ESMTP id C41BA180002 for ; Fri, 4 Oct 2024 15:42:22 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iLntNC5G; spf=pass (imf16.hostedemail.com: domain of dakr@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=dakr@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728056501; 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=nFu/Jo/LyNG0lCAqYTcrwUZmY2ZbXoi+1/wExRdrQs0=; b=NIHek5N16tg7LAUFabmyDPZShVMbT9DVIoQbdfodRTtH1xDgyekXtXWhBdZrn8QVZK+k1i bsTAcFPaYIZMFihiXjNILrp/IazQ4hvn6/NPq8aUzfmrVgnb/wvkbCe1+F8nApBI1JpZ81 XrZS0AlmdPTK9eY0rEij3z2JsIB2PpQ= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iLntNC5G; spf=pass (imf16.hostedemail.com: domain of dakr@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=dakr@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728056501; a=rsa-sha256; cv=none; b=ibh1Du/MGFCRdZeH9+e90vfOdYrR0sdzUKRjwR2ixFhKtmLM3GmFOUGlKI8BQ2Bovj7/t+ SuSrkddd1ifv8wZ89Nqagkgg1yg0yrIaY2dn+SOtgVkVRbGPnaGN6E4UINBOUEaCEgbusk cYOkCjC5W0NLROvOomyhsHFceIlSWB0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id AAC38A44C44; Fri, 4 Oct 2024 15:42:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFD86C4CED1; Fri, 4 Oct 2024 15:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728056541; bh=axTTg7SsxXZNqW4CxUpwgLYR5awaQab7skyekwlvxHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iLntNC5GMO+JfUfJ8T+RToF/Q6zkfE7Zbk6QFUt/YDBi5fmDfvLnGjdsh/MmTD6nx JdHKLGahSiq+PTzPUi+dCZGcIHqfbnVbuAcjTZ+PuzemKlxbCcLs3jiVBtSFySOR3+ YqyOojHVpAFhUvR2z+/RUrIhKXbEnBB/mHKYMZp2SO2cs2APgp5zQiiPWue5mVIFyE aXhBqMr1Qbv9cGHI8RT7aaniTTWQL2W5hf5PlOIoHmtFHf/g+m6yLGcWsbhLsOqzOa RDJy4UgSrxf0zlREhw+BujKjRga7rESHFswoiVECMil4ZVX2lXo4rTVqzM2W0zOmeH EILZDqjGCWlUw== 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 v9 03/29] rust: alloc: rename `KernelAllocator` to `Kmalloc` Date: Fri, 4 Oct 2024 17:41:07 +0200 Message-ID: <20241004154149.93856-4-dakr@kernel.org> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241004154149.93856-1-dakr@kernel.org> References: <20241004154149.93856-1-dakr@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: zarbox1qxanibjn691echpz7cca6858a X-Rspamd-Queue-Id: C41BA180002 X-Rspamd-Server: rspam11 X-HE-Tag: 1728056542-381945 X-HE-Meta: U2FsdGVkX184hloB1xSdzYHrWvJPFXp9cOeMIv0z3GTJMOsqXliTZtwEgkUlOOoP1H/Ehzla31vWWaHsj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Jr5khD9GCiVYnpabz/jA4qIW9M3oC0tuOgumXvnT64vOspnxId/12x4jBKW7beDUavqc3Za50xT4OQYRJS53/Sl6XjPFkAC9xcTUA17/yKK6pfx88RPctFTIws3QCHANjVbyvUdZj2AfoCHeJMUYuWqP7MV4yxnQ6VpA74omwF+0SfM/sdCa9O2T3uyPHIxPYhR8tN9YY90ZdXrw7spwgAc1FHMseR66+HOn74n5SUpyKQF0aVVn0y 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 765f72d5bc21..3b1c735ba409 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 { @@ -37,7 +37,7 @@ pub(crate) unsafe fn krealloc_aligned(ptr: *mut u8, new_layout: Layout, flags: F } // SAFETY: TODO. -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. @@ -74,7 +74,7 @@ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { } #[global_allocator] -static ALLOCATOR: KernelAllocator = KernelAllocator; +static ALLOCATOR: Kmalloc = Kmalloc; // See . #[no_mangle]