From patchwork Mon Aug 5 15:19:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danilo Krummrich X-Patchwork-Id: 13753712 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 B02C8C3DA4A for ; Mon, 5 Aug 2024 15:20:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 273346B008A; Mon, 5 Aug 2024 11:20:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 21E526B008C; Mon, 5 Aug 2024 11:20:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E63B6B0092; Mon, 5 Aug 2024 11:20:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E4F8E6B008A for ; Mon, 5 Aug 2024 11:20:32 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A371AA6B06 for ; Mon, 5 Aug 2024 15:20:32 +0000 (UTC) X-FDA: 82418553504.10.1C00A22 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id E619B1C0012 for ; Mon, 5 Aug 2024 15:20:30 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DAEFhR9a; spf=pass (imf18.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722871170; 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=7m74TYzpgrLgZZopJEzoEqwhboNjYPP/WAgufgI4d1o=; b=6mnZfiGEyONUXEXH3HZL+508r5wMV9PiNyS1aL6l0nsxU16oJ7QCdKIM9024G0Ykph8IIC FEqosz/TBIHzPdSZsvN23UOPy8Ss1ZE2L90yzji/vS+xYHY3YMi+K3RS2Jw+ir5MqrPyOu 1qmh0iRO+tMRrfFCRCmlbKOXV8SJJdA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722871170; a=rsa-sha256; cv=none; b=OJq8ELsX8U6i8JMWDSOFCFKngSINULfC9iJP13wyc4xr1sRKBzq6DD9c18lRCqBoLV+dCx BqpT6lESNpz1ixtHG7nx9ShRRxpwo+7PhAMukHw/Wp51RT6dKQOs4lDz5n3L1aNmNJzUTs GyH15FOYbkx3ghKiQTXoDMxWX82+RVw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DAEFhR9a; spf=pass (imf18.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 27A5A60CF9; Mon, 5 Aug 2024 15:20:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8AE8C4AF10; Mon, 5 Aug 2024 15:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722871229; bh=OtT50VkQ4IhBDfNNG3JPXaxsaB7mAc0R/AyuRkhis70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DAEFhR9aVevAgqQ6ElgV7Cw56P/HwNiDuiiitRoBj9UULByi45M7SLaTEVX68yLmV cjn4/P0ycimIRj27eLfZXkyB/YZuTg2IiwHFXQYw2pc02ImwN2/hwReybehcWo5NQm Nk1muDVH1Iey7GlX6fYVgMS55urQaTDSBArGzS5Xws58PEdKZFHHS4+7e88i2wfgU5 vCGS0oDPXlR3Bzx/VKH7n16V/KuUiVLF+GS2ldj6mdojwW5fa5Wz/hhvYcyOHnlrw7 q8jpo71RaebkuQPg8UrUT6y6eJEL+jwkelqbO27EsFg5UIXz5QZPEWviuJgkEctN5M RtGhnHltjm3Iw== 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, acurrid@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 v4 03/28] rust: alloc: rename `KernelAllocator` to `Kmalloc` Date: Mon, 5 Aug 2024 17:19:22 +0200 Message-ID: <20240805152004.5039-4-dakr@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805152004.5039-1-dakr@kernel.org> References: <20240805152004.5039-1-dakr@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E619B1C0012 X-Stat-Signature: r1zjaza73nkc9wb5oif9s635kkrxpk7m X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1722871230-443545 X-HE-Meta: U2FsdGVkX1+9pzBU5P1nwYSdNQnMFSSw/4II92eLLIwF0mn3BNz01y3Utk9bCF/nN1kmhUrL+WmYrloh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Arxslm93KE8pER3/w/UREpAfxWW6Ljc0zdbOoghrBbUI6ZEqFNy9teDRMYK89QwkbhYPsc/UdVhkwqUb2oRLwlP23B+mWzCK3BkRVAip3/QAjTen3mrOcOdOs3ud0lG91oJ4B7xcIcpUZRVqy7pKFgjxW8V8RvDcAb9Gxn 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 Signed-off-by: Danilo Krummrich Reviewed-by: Benno Lossin --- 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 e7b7eba84acb..2c1eae25da84 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 { @@ -40,7 +40,7 @@ pub(crate) unsafe fn krealloc_aligned(ptr: *mut u8, new_layout: Layout, flags: F } } -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. @@ -76,7 +76,7 @@ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { } #[global_allocator] -static ALLOCATOR: KernelAllocator = KernelAllocator; +static ALLOCATOR: Kmalloc = Kmalloc; // See . #[no_mangle]