Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp2736022rwb; Sat, 6 Aug 2022 05:17:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR7+9izs72osgjjJQAUCbBI+FvKMNN5fNLfE8wXoQyTQPoZL81apKILwlYvoWLDrj02QNgor X-Received: by 2002:a17:906:11d:b0:712:abf:3210 with SMTP id 29-20020a170906011d00b007120abf3210mr8221019eje.292.1659788272634; Sat, 06 Aug 2022 05:17:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659788272; cv=none; d=google.com; s=arc-20160816; b=P76jvoCfRbAiYHCce8LFUt0RKzWcRnPWXXm+XC8rpZ2F5JZbbYKmxRfDHjWe7/J56X 1uwxSepP++oPQEWTxv75o+WkSTK9uHlxWlNO2igjejF1bimGiUfqT21o/B52c4x1Zr7q CjLMhPVVHT0P2k0T5GfRAXF0Vr4ypnMZoAbmq3o65+kPys5xMrd7ndyrYZygav52Ee0s JawPjL1EzMllZwWbWa2e3V6Pg1rLIJ/flt8cgJqa9nWF6ZGKdDVWzpVBcDCaThqLoVOT X/hTpqxfU+z06HB5HeL4cb82iZ+bZbOhK/JrHvzQWYR0HfF4n9L68gS/JFzMliYnNlpe Ofkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yiPq2xCY40jssMEgaaoL8PcgnOga/wrnpOLbyp6j9TQ=; b=c3jvm+qTsRlNktX5Fj8i1cBTEm/sd/D4S0Wl8bNXx9sTKfrziF+1F7yDSb4pAz6IMp Ms/8R2zpizG76WVUjF+wqqBB71hjPzF+h0bw80ymHAo9wqZEsUyD3gzbTyp4CSIfMQlj +y2QCo6Xjva1xCoXmVBuyfM+Mld22UpA1HUG966KmBOQ5Twjuh9ECgPmAtxmEMuivy7h neZCsKPmqf3ww1jLf+HRUv3XYYU383b+RXNWlQOlEZB6w0Tmnr8Yc6JrsWT7h5Uclug5 stLcaqbLvxkpL0vL9y9H2sTqb074T0EaQFdzucZJ0EAYumx3LxrcuuXf6k16HUbdcEz9 7QWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yadro.com header.s=mta-01 header.b=CAdNJIFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yadro.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj4-20020a1709069c8400b0072af12ec70asi984087ejc.121.2022.08.06.05.17.26; Sat, 06 Aug 2022 05:17:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@yadro.com header.s=mta-01 header.b=CAdNJIFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yadro.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229846AbiHFMPc (ORCPT + 99 others); Sat, 6 Aug 2022 08:15:32 -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) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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!