Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5181393rwb; Wed, 21 Sep 2022 04:28:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ilc7ygZzGY2sgozNhOiusICTfdaPs0qHDyw4l25aNBhpTEC7uRIW3HXFtY4VNcyI2Pps1 X-Received: by 2002:a17:907:2cd8:b0:776:64a8:1adf with SMTP id hg24-20020a1709072cd800b0077664a81adfmr20901362ejc.151.1663759727469; Wed, 21 Sep 2022 04:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663759727; cv=none; d=google.com; s=arc-20160816; b=0RyhiwunBIAjSScpoK1JERKtXKa1OtBFIOLa53vNRzc/4GH8iZ7N+2sQY91S9K5pRt wyixLclyfNtg0NHMyf1JDC87l0vDB9+zdQS7oSpqVH8YRWAB7vs0x4g3J8zWjvlwS/ri rCwSau81A8JeCY4KjFuXwP20l0wP+nnAPVU3LMy0e9Ak4rMiJVd5HtsmeH0aXD5ZsbBd t65qkIdCtagKFBEwr5v4uTM0lT62Ig8c7Pn6zzM9ahD/cwWOFmDyjUk8HG7cYDR4H91j yLsLvfAd4bBWBn0T3TBlzHt1jK1tHkMVtTv9cuPSTHfPWLo0yQTVORC9U45vVDKVgbcV hoNA== 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=eZTau1p1vQb/fvlfvYPOHp2RrMrOdQskexqrU+d14z8=; b=EvUBIc+4uqs42b82fQuIN/vq8X/GOJ8i3fYpJemLCybBiGT8HPr5eV+4nHBfhY+zFV rI1vbzi5SBBslUXA1jXHoYnFuMSp4cwNYNpda+ng4dWpTqKEIH+maRFoU+ew/iWpwk3r AlOzDW0EBHoQyweIfxJZU0L6E1etSFAVw2h7QoWR/pb2dHsxt7AsJgP2mO8puAtwMT2I uK9t+HK7sX8AaYE7lvRCWXT1YjvFvClKm94XXxLyADRmbi+YLSJY2CY+vwbLSXxYt9hB pdC/XKAVo4EumR0OW1GcbjfvR12YerwCdUCYJw5/ukr9rAycam/S7CCqH5mXCz0Wn30C 3VAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yadro.com header.s=mta-01 header.b=CMJA3sbk; 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 gb31-20020a170907961f00b0077f7dd4ee9dsi25238ejc.334.2022.09.21.04.28.21; Wed, 21 Sep 2022 04:28:47 -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=CMJA3sbk; 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 S229832AbiIULXy (ORCPT + 99 others); Wed, 21 Sep 2022 07:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbiIULXw (ORCPT ); Wed, 21 Sep 2022 07:23:52 -0400 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B457971719; Wed, 21 Sep 2022 04:23:51 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 340BC404AD; Wed, 21 Sep 2022 11:23:50 +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= 1663759428; x=1665573829; bh=/ca90bYJbAUSLeDn7WlM+Z6xGiYMcY7eT0U VuGEulUw=; b=CMJA3sbkU91jjir4K3cS4PstFDEZO7LZvIUAe37XcnH5ShbHkZj 3veg/dOkkxtYHsWegxFwib4nhlUra47XlWA0n8PM7M/SFExvpgeZTW5DRjdOQwR/ W/W2jHo13s8jkZVRSDxyBtBWExR9fNyqGytlc1TO584M5URDP58baGpU= 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 jt2JIju1GUOH; Wed, 21 Sep 2022 14:23:48 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (T-EXCH-02.corp.yadro.com [172.17.10.102]) (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 20176400F6; Wed, 21 Sep 2022 14:23:44 +0300 (MSK) Received: from T-EXCH-09.corp.yadro.com (172.17.11.59) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Wed, 21 Sep 2022 14:23:44 +0300 Received: from yadro.com (10.199.23.254) 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; Wed, 21 Sep 2022 14:23:43 +0300 Date: Wed, 21 Sep 2022 14:23:42 +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.199.23.254] 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 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: > On Sat, Aug 6, 2022 at 12:25 PM Konstantin Shelekhin > 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)?; In my opinion, the rest of the thread clearly shows that the conservative approach is currently the only solid option. I suggest the following explicit API: let a = Box::try_new(size, flags)?; Vec::try_push(item, flags)?; etc. Whadda you think?