Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp262944lqz; Fri, 29 Mar 2024 16:24:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBJsB1J1jUPe5gL8YNk201NznUQlXeGrM7tGI7536Vep4x5sszdVIJ8IkH8PywVEfG+9/MtvgCTy6Pzl/9Bj3ij+N4RInz5Z0+S/n0qw== X-Google-Smtp-Source: AGHT+IGTsLp6Cz8glb9/Q38tMehvigKPgxxYMA6j4PbEZgAcq04osGM2lK6VF6tTp7tDT3nByn5C X-Received: by 2002:a05:6a00:3d09:b0:6ea:b69a:7c78 with SMTP id lo9-20020a056a003d0900b006eab69a7c78mr4788281pfb.14.1711754679937; Fri, 29 Mar 2024 16:24:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711754679; cv=pass; d=google.com; s=arc-20160816; b=jKABFj6VrlqxQXGz0TSm0gt9m3PcKWDfZJn8w2tQFVHVeZrqwflPRQatqOBoLQbMFA cYMcDKzPjm+v4LwAtNXxqHZf+BVcjFUg2M55v+Zu6io3bgPj2Dpxz72dtdAuUFwbJ7q6 Najp45jX9Aj7WgaIK3cOu14vmHEwAEbDU9iZZDZJI6dBe3LsRj+lK9BU6D5Ivbto/AjN xqu+bq4WlrjTbq75XVDxQ7+KMaV0juMa8X3J6prYOM4TSkn58Dq56jus6RCHm17WZ7WV YeL7yZO0L7D8OUrchJ0h+lW2REGmZ6AcQHzt6MzRh2GfM9OCRpp3h5NYUqagrwhNq6gs hMXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature; bh=nAqT/PkO4I/dSKZYMDvK1XHcQqT1AvW4NQ1vVEVf7/Y=; fh=zLhQ0x5atMZbQbLBk5uBCMtjcVw4G/VcU8TkHNIBkWo=; b=W4NN5qkimlkadP6KO+ejnhoEnn3aywsj2w0DpSMDMtJwBSf3/8+ZGb1ElphF7u8uvO RGIhlZ9cAD4GCjoT4e8MDXUrXm2ji+B3TC4J+1kPwKB9wgm1Ay0Td7E5Oqjeba+tH0pR /hGojbQAJ9skDxvsV8PmJUR/g1AIeG0uLfRPHDdjPCP9B52W3M2lo2m5JwkzIq8+vwEe 5vBoA2Bb80e9bROK+qt0OdXP3tKXXL9U+v4Wj/VIc0FCy8OVIqmXfNrfXEsnfmgq8fFQ gQ+13by4Yop1SAutjPGcj9GQbnfcK/yaYUS1gdCDPAXhkPGYmiXpneZ675aWOEGHHy+3 A8yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=anfaUUvk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-125525-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r15-20020aa78b8f000000b006e6aaae7d14si4469419pfd.294.2024.03.29.16.24.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 16:24:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125525-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=anfaUUvk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-125525-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125525-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 96CBE282DF6 for ; Fri, 29 Mar 2024 23:24:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EC1013E05E; Fri, 29 Mar 2024 23:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="anfaUUvk" Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08CC964B; Fri, 29 Mar 2024 23:24:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711754670; cv=none; b=IO+5Rt3m9b16ItoeMHHKMLKLNLdssKvw9wFDscopqOpCRGlo0jp93dVk69H945BbmmsI4HseLyPlg7ASLxA1UP2ILfuk0Xzzw7Zp/szhcKEAjqRwl8ZRVIxWjAJC4aD+rQIh4nZBZC2oXbS4j2dM04w2Uh28QBS6dN3V8ETl7RI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711754670; c=relaxed/simple; bh=QSssbFjXz+eZ/ZgUMwkgKn6RmNuNwQ2PoDMrtj4r644=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fm7hBwypm2j1uall27qfA/aPd7m0VFJcqqLnIyJGEHXzG9ze71MEu/c783B9Ur8BPWIvfwFjyIqoHcHy3C+lKnF+Zr0INEZJlA0hzbgw8waIQAhHT0Z9gJKa9RiVLPjk7Vb/TSk1dYZLwNVTyNUkvqR9L9N0mnzoao7BFe7Vvxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=anfaUUvk; arc=none smtp.client-ip=209.85.167.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3c36f882372so1436434b6e.2; Fri, 29 Mar 2024 16:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711754668; x=1712359468; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=nAqT/PkO4I/dSKZYMDvK1XHcQqT1AvW4NQ1vVEVf7/Y=; b=anfaUUvkhzysZ+thkc0mCGm1rxPJBEoSHIEf1Em2gOmsKNu0vGJkiWxwZMi06m76Hb 6lHapMX7KhWVob9TUclyO4pYFLejJi6wiRLIyeT5h7buerdyiYS9Oxgj2/mY0X70vn5Y hu1n1ssRm6C+pDQaYeueeOaRrGgDbG8T4X5wYBLtueR8vJz1q6RRqUHTro+L4YumTaRX IElEZZw6Rynv95ePX0dSjTAh0s7c1/vfTP1QC6Npj16vRsOu+d1baQyUf2oBq/SrFm3i ZPM/mzUkPy3nvX76yKCstgbIwr0FqKf3PK/4IiJ65G1DUQC81p4Ed3RnstrRUuTbBLnP Y5FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711754668; x=1712359468; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nAqT/PkO4I/dSKZYMDvK1XHcQqT1AvW4NQ1vVEVf7/Y=; b=pjHl5ZVnKNxwTX8g3+M5GDz0BcQXbEnk0crzjVtdgKpMY2Xe0MQchP4AkTikZ3yX9h SD3COMclnRK3pmhymRDMq/3/S9CA3leGuj4QGfN7c0kJ9ZO3Xw9y7WaYsCSQQ0bx1UTe jbl9awxf5oIwManmf7TYnUcVbEDmJJqYDIZ2lzFdTp6SMQSJu66gLEAENulbaEEiTfm/ BXCB2BVBWxb/5K/kN/pj2Z9sA0tXqgc1zLXFeuKBXrEYdf/P3bw3+A0AY4THPRFj/VJq T08xnPRYX5LYjGQaE3ykbzy4wfHzm1decSQNtCXjtY2D7AWH9GSjr1iMa/HF8OHSWw6v CpkQ== X-Forwarded-Encrypted: i=1; AJvYcCV+jEncGaVRz8WAx63aeYwOgLhNdQ0RZXfrcRth8OJYNP1RjLHHY/m0ku+4c80mVlEhAY7XKp9LRuPtXR/rTZZxQZtymIGTpJCJDCBM X-Gm-Message-State: AOJu0YzOweFi3Ghz9AJPU/sXFPH7GsPcSLFFt0ZzV35/T/+8VPjurein hWAgEM1ov1lbL1Kc2XGLgNdfjDHnwk+Ox4lNUcX2Njprng8n6jX5 X-Received: by 2002:a05:6808:13c9:b0:3c3:d65e:f6d with SMTP id d9-20020a05680813c900b003c3d65e0f6dmr3760249oiw.57.1711754668015; Fri, 29 Mar 2024 16:24:28 -0700 (PDT) Received: from fauth2-smtp.messagingengine.com (fauth2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id 6-20020ad45ba6000000b0069694dab3f8sm2093422qvq.39.2024.03.29.16.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 16:24:27 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfauth.nyi.internal (Postfix) with ESMTP id 650DC1200032; Fri, 29 Mar 2024 19:24:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 29 Mar 2024 19:24:26 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddvfedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtrodttddtvdenucfhrhhomhepuehoqhhu nhcuhfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrg htthgvrhhnpefgieegkeelgfekheetudeiiedvlefghfeffefffefgudejvefgtdfhhfet hfegjeenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhh phgvrhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunh drfhgvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 29 Mar 2024 19:24:25 -0400 (EDT) Date: Fri, 29 Mar 2024 16:23:42 -0700 From: Boqun Feng To: Wedson Almeida Filho Cc: rust-for-linux@vger.kernel.org, Miguel Ojeda , Alex Gaynor , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , linux-kernel@vger.kernel.org, Wedson Almeida Filho Subject: Re: [PATCH v3 00/10] Allocation APIs Message-ID: References: <20240328013603.206764-1-wedsonaf@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Mar 29, 2024 at 11:25:00AM -0700, Boqun Feng wrote: > On Wed, Mar 27, 2024 at 10:35:53PM -0300, Wedson Almeida Filho wrote: > > From: Wedson Almeida Filho > > > > Revamp how we use the `alloc` crate. > > > > We currently have a fork of the crate with changes to `Vec`; other > > changes have been upstreamed (to the Rust project). This series removes > > the fork and exposes all the functionality as extension traits. > > > > Additionally, it also introduces allocation flag parameters to all > > functions that may result in allocations (e.g., `Box::new`, `Arc::new`, > > `Vec::push`, etc.) without the `try_` prefix -- the names are available > > because we build `alloc` with `no_global_oom_handling`. > > > > Lastly, the series also removes our reliance on the `allocator_api` > > unstable feature. > > > > Long term, we still want to make such functionality available in > > upstream Rust, but this allows us to make progress now and reduces our > > maintainance burden. > > > > In summary: > > 1. Removes `alloc` fork > > 2. Removes use of `allocator_api` unstable feature > > 3. Introduces flags (e.g., GFP_KERNEL, GFP_ATOMIC) when allocating > > > > --- > > > > FWIW, I've put this into rust-dev: > > https://github.com/Rust-for-Linux/linux rust-dev > > a few adjustments are needed to work with other commits that have been > queued in rust-dev, so I add an commit on the top for everyone's > reference. (Besides this commit, I also removed all updates to our own > alloc in Miguel's 1.77.0 compiler version bump patch) > > Regards, > Boqun As Miguel pointed out offline, the following is also needed: diff --git a/rust/kernel/file.rs b/rust/kernel/file.rs index a5930f0f2bc5..bf68a0ce9f14 100644 --- a/rust/kernel/file.rs +++ b/rust/kernel/file.rs @@ -350,7 +350,7 @@ impl DeferredFdCloser { pub fn new() -> Result { Ok(Self { // INVARIANT: The `file` pointer is null, so the type invariant does not apply. - inner: Box::new( + inner: as BoxExt<_>>::new( DeferredFdCloserInner { twork: mem::MaybeUninit::uninit(), file: core::ptr::null_mut(),