Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5217294rwb; Wed, 21 Sep 2022 05:02:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YXZWCGBX3b8djfjxOAQVDn4g0Rs8JFCoOoj6CP16ikG1Clk8tmp5cdcx/VRR1TYrjl4xO X-Received: by 2002:a65:60cd:0:b0:43c:403:9863 with SMTP id r13-20020a6560cd000000b0043c04039863mr64242pgv.106.1663761754577; Wed, 21 Sep 2022 05:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663761754; cv=none; d=google.com; s=arc-20160816; b=PsrjcoHcMewhUk0fq0bjnNb01aZtN9SQmQ6jK330dZwb5WNZgROfUihsMDcAk8308t 634SbrbJfW0ikIgKoOB3r2btWZOVQPtIroF3TVrz2xnqhdNvynQavotVm4YrLnkZ3vhw HF7qCl6JEHTSF+H2291UrKUzGF7XpnBLlP7JUQzwVdhyImjOBOlx6MnPmw+n2OYOqLTX eEdFTToyCrkAYk1LVmrPdNLMwBS6p7uJyMpPjXhUusLJ48zciR4iZN+tdA10T9XfNjLQ /FFlqFAdMF1bFEJAmKOZt/jqtjFikEodXX+SOBABFpfWJV17jQgAFKky5Gl6zqhtV4Pn v7/g== 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=h9g1qqWp18SpY2qPYaqriqcLZw1VnMPngvvDVbBm944=; b=XbKWJXkxtJnIQj6iu8Q3k2kWENtKH8Bx1sWoDs2BMjobiCCvCYy5KkuQv6ZUs3RoMN zlZ/ALzrIJutvGB83c+GXX9ZLc/V5EYX2kBY1i49h38hy26jCfVkaBbSkgBmLGcYxo6J xvRboF6oPdj2gMQu8pkN1KcSNaS+waPc3PpYNBTdvzRP6sflXzTDOBrhJZadzwB9qD8y Sy11T9CV3tC5mdisd2jA9wmDI/aUu4F5iFxyI7UmuAkZ8SGLoQ701eBbUvKNgScKE+eH fhMEx6U9UZihULRpKhMVD3CbBe43No41ANlIvTsTbk0jvskli9JzBi0VU3cxvajcvb+j 0jqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2K3Okgx7; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l5-20020a170902f68500b00176939b5cd9si2991717plg.578.2022.09.21.05.02.19; Wed, 21 Sep 2022 05:02:34 -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=@linuxfoundation.org header.s=korg header.b=2K3Okgx7; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230171AbiIULrl (ORCPT + 99 others); Wed, 21 Sep 2022 07:47:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbiIULrL (ORCPT ); Wed, 21 Sep 2022 07:47:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADF3695AFE; Wed, 21 Sep 2022 04:46:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6703562A54; Wed, 21 Sep 2022 11:46:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C663C433D6; Wed, 21 Sep 2022 11:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663760806; bh=zzApFJtlF2vVGaeOdclIO2YCUDHgmUL8bWPaMWu56O8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2K3Okgx70QTOprd6gQeOss5QT1quuEbtX7VidECZdD0VmJqvKxMor3DtgIK/1Rbz5 xVKcbZD0kv1BPss4TYCh189zpn0KD5n/XQ2HKU/DIEzHEsrtK0C1BqU3PLHJEEYLz7 Ydmu1yCwhkwGRoG/wukDUslGSMuHJyk34dFxVyvQ= Date: Wed, 21 Sep 2022 13:46:44 +0200 From: Greg KH To: Konstantin Shelekhin Cc: Miguel Ojeda , ojeda@kernel.org, alex.gaynor@gmail.com, ark.email@gmail.com, bjorn3_gh@protonmail.com, bobo1239@web.de, bonifaido@gmail.com, boqun.feng@gmail.com, davidgow@google.com, dev@niklasmohrin.de, dsosnowski@dsosnowski.pl, foxhlchen@gmail.com, gary@garyguo.net, geofft@ldpreload.com, jarkko@kernel.org, john.m.baublitz@gmail.com, leseulartichaut@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, m.falkowski@samsung.com, me@kloenk.de, milan@mdaverde.com, mjmouse9999@gmail.com, patches@lists.linux.dev, rust-for-linux@vger.kernel.org, thesven73@gmail.com, torvalds@linux-foundation.org, viktor@v-gar.de, wedsonaf@google.com, 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-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Wed, Sep 21, 2022 at 02:23:42PM +0300, Konstantin Shelekhin wrote: > 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? Please, yes. This fits the current kernel memory allocation pattern and allows for proper propagation of the allocation flags as needed through the system. This is going to be required in any non-trivial kernel code anyway, might as well do it correct from the beginning. It also allows for flags to change over time, which also happens. thanks, greg k-h