Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp2905188rwb; Sat, 6 Aug 2022 08:22:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR4zNk/m4sZOXYGO8Xr3QYr2FjWoZVJzhGUNkQ/ioVkdxVosheX1GxiWIV9aBt86ESWOR4Mh X-Received: by 2002:a17:90b:4f8e:b0:1f4:ed30:d286 with SMTP id qe14-20020a17090b4f8e00b001f4ed30d286mr13135282pjb.66.1659799343866; Sat, 06 Aug 2022 08:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659799343; cv=none; d=google.com; s=arc-20160816; b=P5oBz64yrigO0cfbU545S/6WUi0WqAwTpPDdaVQMpIadMHVzEh8vOWql/5JbEj3EuW 1hsypE72z+iYcYo7nnsBaefcctQShuVk4nY79HLZJUGkds7RA8r2AC9oR6pfFP8gU2LT /XBJrz+HU6lBUVOVai7q0NdAektHXq+ExVuMyX+jiycThiH9nJlD2V/ibx0F3Krj+FcT +177iTTO6EnHT5986iSCMAEwK9cjL6azjapKQfXhlAMFd45VVw5pSLBHbN4pes47zGDx LQHdGuZweU/jkwrz2DAB39WpT7rxgHWdEnlrEUYhzTi9TObciPJxNIZox5n5QXhMvYCq bI/Q== 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=+C2JGsO6va2bAMADh5JeyUWmHXKyyjTMWItjMMImrbg=; b=HPgRoFYaX0QxiCroP+bdrw5ETENvYaXPksvnlYP5Yo5VmA2sOCKfX9pdT6TGLQ8yMf a7pBThX070XhwyyVrU8IG7R5Gs/mdeWae9/jvGpibzaoXSAIeoQYvfK6dQP7gvKKj1Rq HxbjoGZAhPXUNfkdRpAv0hTj5TNj528RmtI47xYl3i7xqn+9R/na3zIeuwnWVY3NqTcj 0z48Gvjn/bjjgmevRKnHsVHX0Hok8EHWePLMknqHJQ9VB7jp+R6XJ1/Snww+dSv9FF4k Io0A6xs0grk49kP1/c693u5Yx5BnrhGijw/1wuMEocWjslIGeecSMCC+Mat3W6hKLBqM SpWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="WdpKBQw/"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a170902eb8f00b0016ef1d4c4fbsi6420620plg.320.2022.08.06.08.22.09; Sat, 06 Aug 2022 08:22:23 -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=@infradead.org header.s=casper.20170209 header.b="WdpKBQw/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232240AbiHFO6T (ORCPT + 99 others); Sat, 6 Aug 2022 10:58:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbiHFO6O (ORCPT ); Sat, 6 Aug 2022 10:58:14 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919C6DFA1; Sat, 6 Aug 2022 07:58:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+C2JGsO6va2bAMADh5JeyUWmHXKyyjTMWItjMMImrbg=; b=WdpKBQw/h4Z6oKiLfUMLRUHbhr 16GLQX8j2fEzsJqERsJugasQvW5MYH+A+/EQ5cdR5MOOvfVvegwK2YFUlWaAcnb8zjj01dqJ4kzqr j7sgHCoSDRkPUZPl4ehuP1bq8l3p0Js/AemsYZprDGgKYMM5gQFmTRQNGKRn6A8Dch1F2YLVfr29Y dvVWwaAS1dbeHb34kuGgjMZgfFVPhb0zs04jPIsuoYhJeEusJ/AijPnZxkwSShJYbpnpc4cqn17XE q6J3eTiZ0nAZRfMw9iDS3f7FV4Hmi3uv9ndKcYE2dTExXND/TxdxO/Ea5wIQ8xPjHvxhBDZ9/Gxuw 9trYO3cA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oKLF9-00CE0u-CC; Sat, 06 Aug 2022 14:57:35 +0000 Date: Sat, 6 Aug 2022 15:57:35 +0100 From: Matthew Wilcox To: Miguel Ojeda Cc: Konstantin Shelekhin , 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, gregkh@linuxfoundation.org, 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=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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: > 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)?; Something I've been wondering about for a while is ... struct task_struct { ... + gfp_t gfp_flags; ... }; We've already done some work towards this with the scoped allocation API for NOIO and NOFS, but having spin_lock() turn current->gfp_flags into GFP_ATOMIC might not be the worst idea in the world.