From mboxrd@z Thu Jan 1 00:00:00 1970 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 985E3C83F03 for ; Wed, 9 Jul 2025 11:31:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 390586B00C2; Wed, 9 Jul 2025 07:31:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 346A38D0001; Wed, 9 Jul 2025 07:31:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22F988D0001; Wed, 9 Jul 2025 07:31:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0BF3A6B00C2 for ; Wed, 9 Jul 2025 07:31:37 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 91C5DC0183 for ; Wed, 9 Jul 2025 11:31:36 +0000 (UTC) X-FDA: 83644510992.24.E812907 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) by imf14.hostedemail.com (Postfix) with ESMTP id B2AC3100006 for ; Wed, 9 Jul 2025 11:31:34 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=nmeBi7kh; spf=pass (imf14.hostedemail.com: domain of 3FFNuaAkKCL0dolfhu1kojrrjoh.frpolqx0-ppnydfn.ruj@flex--aliceryhl.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3FFNuaAkKCL0dolfhu1kojrrjoh.frpolqx0-ppnydfn.ruj@flex--aliceryhl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752060694; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nKz/jr4sAvlzW8F+pdFxeU0JpTncvrCm+GmYbMwH7v0=; b=ymLsmuOTwXPyb0ar8feGFJ+oIXvI/3mOntj6Ec47J0KEXY/0yO1MW6ZPZUR4P+wBG+mG5Z PMLj9qL2H/3gd8hGJpiSTArHovQNSmnZ1F1o9T3jh5zkFCWmePPnMDYehNO5e/5325SrOb 1uc69v3/EYZQylFBXsXWlXT3eyC96cw= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=nmeBi7kh; spf=pass (imf14.hostedemail.com: domain of 3FFNuaAkKCL0dolfhu1kojrrjoh.frpolqx0-ppnydfn.ruj@flex--aliceryhl.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3FFNuaAkKCL0dolfhu1kojrrjoh.frpolqx0-ppnydfn.ruj@flex--aliceryhl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752060694; a=rsa-sha256; cv=none; b=DxzbJfjGND55IVnJZyPw+5tNqmO3KdioBB6ItPi3n79760Olv158DtS8KTpw6t1HIXpyj8 MIidrBlQIgraq+NnNcgqHQ10OEIHIRciCb4t4f5sBph+zyltTc3WGEKhWc/cdL9IwFdndL lWrv5srcwly6iRSBxtTlDhi4yXEDjxg= Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-60c9d8a169cso5978688a12.0 for ; Wed, 09 Jul 2025 04:31:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1752060693; x=1752665493; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=nKz/jr4sAvlzW8F+pdFxeU0JpTncvrCm+GmYbMwH7v0=; b=nmeBi7khWtgDRuAyXNtzUPM+ZuYiRmnSwR6HdtSuAI1a/u3gHJTgJmc5nfXpRvx32B byL/R9WDYlKPKAcFqNm4Gg1JniTwtUwy1uvmQK/5gcPvj8iROA9YkaqNqVauH9pTJwH4 +G73AlfpINM5ti7bZIkk2dtZbu0ybPHXEkVpGdE/uy/ZS94GeWmeEQ8VRHiRWjKRzAU0 zQu8mRUYhxZ2w5KrS7d8WDR2TxB8uUTLnlvWQYfvwOpZLlCv0Id44bI5b/PNkyHFBvUq vzA8bw+fhvfgRnT9lIIQrrwo7a/ugnr0Pw/VC6YTto7lwbv2LCWD+NLhhjA+cPPetv0I OTEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752060693; x=1752665493; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nKz/jr4sAvlzW8F+pdFxeU0JpTncvrCm+GmYbMwH7v0=; b=Ft/v99NqktcFJAb0CrXUSBtPsLkmjPPk5bCoKSqCsCPa0QBK08FAozn14+3bl0BK2Z Rklmm+lF2ruuyPdGAxI3vW1p67q5HKrUVkdI0+GeglgGQzWhp8d1RUxudjdNycTy0bOr iAzkzKIOdDI1dMTXzhfLJXt/GDo3uCUHyMaM6iNOBkSVJlv2Ruqgq6lZPsYYsRg2LEfP pePMkQUcjlQI6YMEsnBBLkQ2zBIp96VMOBwq1o5uFlYhVsBesWwjPqeZVpzdlv966EHg II8CoPYnif7yRphUNOYRbKZ69UVnkLGM4vqDfhwl23Ce+2sCyd1sV9RVLlR77vSpvF5x AleA== X-Forwarded-Encrypted: i=1; AJvYcCXoo3qHNdr7ykp2oFOsHDSKDK3uAr1jfBmmWN+yFskNV7Ixn0/UOFzc/TsSXMCNHhlSkjHya/q2RA==@kvack.org X-Gm-Message-State: AOJu0YwVDw0r7Mk7kBDIm8C2x4IJSEckSRZHsR5wcB/7I48gzRYBL0Tv G6AtuvIkVHRR/XeeVuLK7V6WZ9wx5/eTPl8nX12NSzHq74Oqx5eETBVhObVKm0WxTZJ5tsFNBR1 iHUJaKrhsfEtZzvGbDw== X-Google-Smtp-Source: AGHT+IFLvrS3jBzSiTmt44t7b5t9NsWfnRbSj5JtycWej5ry/u4kAdaGE1886+VS9sRjahoYLkPT0J9aqR8+j/0= X-Received: from edji11.prod.google.com ([2002:a50:d74b:0:b0:609:464e:83f8]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:2745:b0:604:e85d:8bb4 with SMTP id 4fb4d7f45d1cf-611a714c11fmr1541664a12.21.1752060692970; Wed, 09 Jul 2025 04:31:32 -0700 (PDT) Date: Wed, 9 Jul 2025 11:31:31 +0000 In-Reply-To: <54fc10ce-c3b6-4571-93e7-eebfc538d0c7@lucifer.local> Mime-Version: 1.0 References: <20250707164755.631374-1-vitaly.wool@konsulko.se> <824065ea-1f5c-4cd4-9917-4b7a91882af8@lucifer.local> <54fc10ce-c3b6-4571-93e7-eebfc538d0c7@lucifer.local> Message-ID: Subject: Re: [PATCH v11 0/4] support large align and nid in Rust allocators From: Alice Ryhl To: Lorenzo Stoakes Cc: Danilo Krummrich , Vitaly Wool , linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Uladzislau Rezki , Vlastimil Babka , rust-for-linux@vger.kernel.org, Liam Howlett Content-Type: text/plain; charset="utf-8" X-Rspam-User: X-Rspamd-Queue-Id: B2AC3100006 X-Rspamd-Server: rspam09 X-Stat-Signature: kbgzosh6ezy3qx3o8pwob85dcjmu59e8 X-HE-Tag: 1752060694-285934 X-HE-Meta: U2FsdGVkX1/8pMpvUCVwdOwELp+anQMA10aJW7dle7M+MYbXqT62OUbL9gRsEoX0YLgTvyxLRBwIHjYnM7U9wSfVJ+UkC3TxeYw8r4KSZ15hmWWE+FPe/9WcGMyG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B2E0wf5Y/lSQQcwhSKzBYppFXWXXQsnZoKD6XE3U2JkHA4KoTrGIRNvPk8iHJjdlglEU0CaiHdnWz1rJJJu77xxRU99E+fshg7V2EQ/+nffLt+TDNyy05kkqEmjlo5YOlRdBpFRikPpyy6RwFiagXjcVfWJVgt8GloP0igC52CpfjPN+2LHww3Y8PU5/UhFGos+/QDO7QUsQ1f018Jw9mSHpXUMyCyUAninnT+ArHvKNIkA3He9j3eRtBwd0HFM1rAw5HxEyKT1ESZeuYBKzQcoI6WPLmsJsgvqcDsa3L9L0f1yIe7kXDgIneQy56GFyuDhyAv8ewK4CDUOxpa9Z9rVAkMinvcbbL86lDbB+1XfkgxtH8i0NLJeR1BIG0+A6ReJFtg4P2l8smk9FuSc= 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: On Tue, Jul 08, 2025 at 02:19:38PM +0100, Lorenzo Stoakes wrote: > On Tue, Jul 08, 2025 at 01:55:18PM +0200, Danilo Krummrich wrote: > > On Tue, Jul 08, 2025 at 11:58:06AM +0100, Lorenzo Stoakes wrote: > > > +cc Liam > > > > > > Hi guys, > > > > > > We have a section in MAINTAINERS for mm rust (MEMORY MANAGEMENT - RUST), so > > > it's slightly concerning to find a series (at v11!) like this that changes > > > mm-related stuff and it involves files not listed there and nobody bothered > > > to cc- the people listed there. > > > > What files are you referring to? Are you referring to: > > > > rust/kernel/alloc.rs > > rust/kernel/alloc/* > > > > If so, they're indeed not under the "MEMORY MANAGEMENT - RUST" entry, which > > so far seems correct. > > Looking at these, they seem to be intended to be the primary means by which > slab/vmalloc allocations will be managed in rust kernel code correct? > > There's also stuff relating to NUMA etc. > > I really do wonder where the line between this and the mm stuff is. Because > if the idea is 'well this is just a wrapper around slab/vmalloc' surely the > same can be said of what's in rust/kernel/mm.rs re: VMAs? > > So if this is the rust equivalent of include/linux/slab.h and mm/slub.c > then that does seem to me to suggest this should be considered an mm/rust > thing right? > > It'd be good to know exactly what is considered mm rust and should go > through the mm tree and what isn't. > > Maybe Alice has some insights on this? The Rust standard library has three pieces: - core. Defines standard types that can work anywhere. (such as ints) - alloc. Defines standard types that require an allocator. (such as vectors) - std. Defines standard types that require an OS. (such as File or TcpStream) In the kernel we used to use both core and alloc, but we switched away from alloc because it doesn't support GFP flags well. The 'RUST [ALLOC]' subsystem originates from that transition from the Rust stdlib alloc to our own implementation. It contains essentially three pieces: - Two data structures Vec and Box. - The Box data structure is the simplest possible user of allocation: A Box stores a single instance of the struct T in its own allocation. - The Vec data structure stores a resizable array and maintains a pointer, length, capacity triplet. There is a bunch of logic to manipulate these to correctly keep track of which parts of the vector are in use. - The Allocator trait. - This trait defines what functions an allocator must provide. - The data structures Box or Vec require you to specify an allocator, and internally it calls into the allocator to manage the backing memory for its data. - Three concrete implementations of the Allocator trait. - These are kmalloc, vmalloc, and kvmalloc respectively. In my eyes, the further down this list you get, the more likely it is that the patch needs to go through the MM tree. Alice