Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1054830rwb; Tue, 27 Sep 2022 07:54:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cXWQ0HdUw5ucxIbSDK67hAtZu+yq6I9PP75F1K3N4ybtGaycYN0fsXV5NT3ldrGNOlCYG X-Received: by 2002:a05:6402:440c:b0:43a:1124:e56a with SMTP id y12-20020a056402440c00b0043a1124e56amr28683792eda.134.1664290471258; Tue, 27 Sep 2022 07:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664290471; cv=none; d=google.com; s=arc-20160816; b=dHTcADS3r7fmIYlb0CJ4E5/ziX41eX8Jsb0Pzk2vEtKpwliFsk09al10Kv+PLxwY8c amyNLtvMRxBi8sc4PFp1ah1JFmp56rG2TsgrGGvIhRPvu479mFHxqVnE6H1AOwuCckFT J5YwEHMtTZLlj9RT9BGJ+psWsfkic75vWiZqvAOybrSDsj9XCBxUYDLYIz4Zqx1CeIg6 6aOCWTXMJABFvJ+H3jqYwziq2DeivBOOnGMKA2+4cG2JjJsmhl3idOlvbp/4FNT0xxfm EL3hweMkSWd980Myp9ISHXlmxCzwmGeQL7H5mxfdcE7DEcyO+WyejFrcrtet4NGBp/GZ eLUw== 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=ejgbKLa4QXKCt8hhAhOhLMHL6x38W+xbj1qB8G1OZsE=; b=tzuXwkkKzSGEb90LXnyRC1uiAcbkGae3TFyWmt0bewyITujLxh/AzIURazWF3AhJGK uTu51BwCdSi8jsBgAM1j/vaee1H5Tuev0OD0uTl7A9hn/KmqTFfXCzSwCD7PI2ewtdBZ zC87QewtcRvAANdfLZp8xyoTd0IC7/0dlpQMGlL+C6HFS4P3p8ZSH4cPaj9Mc90BNgWj KUh//obdQwetFIpy2dl/uvNUGWqmFZVzpj5Z5a81OycsUaxcbo5e7O4F7PTVHtfY3wAy Sve8eKwblaXYqbS9YXFze0gVHEEYKv+oEndOan1tgY7+MbOTjtIRLnQbmAbkXE5Rl850 nwRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yadro.com header.s=mta-01 header.b=iMmU13Tm; 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 go19-20020a1709070d9300b0073dd7598686si1836727ejc.270.2022.09.27.07.54.05; Tue, 27 Sep 2022 07:54:31 -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=iMmU13Tm; 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 S231379AbiI0Nv7 (ORCPT + 99 others); Tue, 27 Sep 2022 09:51:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbiI0Nv5 (ORCPT ); Tue, 27 Sep 2022 09:51:57 -0400 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BEEF125DAB; Tue, 27 Sep 2022 06:51:56 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 3B4CC41203; Tue, 27 Sep 2022 13:51:55 +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= 1664286714; x=1666101115; bh=djkTMrw3NuDNUlcbgKWdUAMdOE33vBB/qXd 2X5QY5YE=; b=iMmU13TmtIETymKDE54w7K8dAQmy2j5wKzhW8LlTZCXsKIT0c+p 5yvIgsyLroZOUqfZEqEI1yaxHw8Bd3gIAiGssPBeZ54agqJvg4sBBrItDOdGOLmL +9Z8AISJyaqRsyMLv2uWyDd5+z7ve944JY2yce7ksuElvPdY0hn3K0KY= 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 KZtp7uwSd8tN; Tue, 27 Sep 2022 16:51:54 +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 A558C40355; Tue, 27 Sep 2022 16:51:53 +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; Tue, 27 Sep 2022 16:51:53 +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; Tue, 27 Sep 2022 16:51:52 +0300 Date: Tue, 27 Sep 2022 16:51:50 +0300 From: Konstantin Shelekhin To: Miguel Ojeda CC: Linus Torvalds , Greg Kroah-Hartman , , , , , Jarkko Sakkinen , Alex Gaynor , Wedson Almeida Filho , Gary Guo , Matthew Bakhtiari , Boqun Feng , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron Subject: Re: [PATCH v10 08/27] rust: adapt `alloc` crate to the kernel Message-ID: References: <20220927131518.30000-1-ojeda@kernel.org> <20220927131518.30000-9-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20220927131518.30000-9-ojeda@kernel.org> 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 Tue, Sep 27, 2022 at 03:14:39PM +0200, Miguel Ojeda wrote: [...] > + /// Tries to append an element to the back of a collection. > + /// > + /// # Examples > + /// > + /// ``` > + /// let mut vec = vec![1, 2]; > + /// vec.try_push(3).unwrap(); > + /// assert_eq!(vec, [1, 2, 3]); > + /// ``` > + #[inline] > + #[stable(feature = "kernel", since = "1.0.0")] > + pub fn try_push(&mut self, value: T) -> Result<(), TryReserveError> { > + if self.len == self.buf.capacity() { > + self.buf.try_reserve_for_push(self.len)?; > + } > + unsafe { > + let end = self.as_mut_ptr().add(self.len); > + ptr::write(end, value); > + self.len += 1; > + } > + Ok(()) > + } [...] Not being able to pass GFP flags here kinda limits the scope of Rust in kernel. I think that it must be supported in the final version that gets in.