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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2B8BC19F2D for ; Sat, 6 Aug 2022 12:15:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230440AbiHFMPd (ORCPT ); Sat, 6 Aug 2022 08:15:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231694AbiHFMP0 (ORCPT ); Sat, 6 Aug 2022 08:15:26 -0400 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14B32B877; Sat, 6 Aug 2022 05:15:21 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 20C3141273; Sat, 6 Aug 2022 12:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= in-reply-to:content-disposition:content-type:content-type :mime-version:references:message-id:subject:subject:from:from :date:date:received:received:received:received; s=mta-01; t= 1659788118; x=1661602519; bh=19EybQC+1gn5CR7Z0N2mdrVXzygyocg/h0i 6NwEVs8A=; b=CAdNJIFsxV9D3u+0W7WT+pmyZb1P3mUNea56rbZ+zN37JS14K1p TUF6XFY7zY/aSp3hmQzRcHZU2Te1PbeEabbapFEORYNF5zF6f+csiUlsA3nd24fA KpdPr0mJAFosVf5tVK47+RUigUOtOFlBu0S56kmtVToXaZ9IPvp/eHLs= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cJHOOhsCYjML; Sat, 6 Aug 2022 15:15:18 +0300 (MSK) Received: from T-EXCH-01.corp.yadro.com (t-exch-01.corp.yadro.com [172.17.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id A558841252; Sat, 6 Aug 2022 15:15:14 +0300 (MSK) Received: from T-EXCH-09.corp.yadro.com (172.17.11.59) by T-EXCH-01.corp.yadro.com (172.17.10.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Sat, 6 Aug 2022 15:15:14 +0300 Received: from yadro.com (10.178.119.167) by T-EXCH-09.corp.yadro.com (172.17.11.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Sat, 6 Aug 2022 15:15:13 +0300 Date: Sat, 6 Aug 2022 15:15:12 +0300 From: Konstantin Shelekhin To: Miguel Ojeda CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Andreas Hindborg Subject: Re: [PATCH v9 12/27] rust: add `kernel` crate Message-ID: References: <20220805154231.31257-13-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.178.119.167] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-09.corp.yadro.com (172.17.11.59) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 06, 2022 at 01:22:52PM +0200, Miguel Ojeda wrote: > > I sense possible problems here. It's common for a kernel code to pass > > flags during memory allocations. > > Yes, of course. We will support this, but how exactly it will look > like, to what extent upstream Rust's `alloc` could support our use > cases, etc. has been on discussion for a long time. > > For instance, see https://github.com/Rust-for-Linux/linux/pull/815 for > a potential extension trait approach with no allocator carried on the > type that Andreas wrote after a discussion in the last informal call: > > let a = Box::try_new_atomic(101)?; IMO it's just easier to always pass flags like this: let a = Box::try_new(GFP_KERNEL | GFP_DMA, 101)?; But if allocate_with_flags() will be somehow present in the API that's just what we need. P.S. Thanks for a quick reply!