Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2572477rdb; Wed, 21 Feb 2024 11:52:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXC+RYAgOODoEoBpVWi+p73zONC8qcqER2SwC3Flk2syzekIzMVEXpqmiWu3h/zq+tBtQo1ffKMps/j70DZxjj6QDvavRY+WZneeeTWaQ== X-Google-Smtp-Source: AGHT+IFiL9pjSvlGYqiJI+JwwdGSrrFMk0CFY72uMYStGfef1BkzRHRsINgTUOn60v3aGxzK3m3L X-Received: by 2002:a05:6512:3e6:b0:512:ba41:51f with SMTP id n6-20020a05651203e600b00512ba41051fmr5102852lfq.50.1708545130711; Wed, 21 Feb 2024 11:52:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708545130; cv=pass; d=google.com; s=arc-20160816; b=VIjQXLG4hr+EELhAKwSyKNcufVL/nVX6URWp/5XBCBaX8KleRD25kqld2zsukMZ5Iu Nbd4qJAtXLVEIWUOs84hB7EpwDKsHZ30ihSCIWGAzot56DhOxax7VSS3rB5InrB5FSKQ 9yNerpRpNhwNBZHpNHTNRAyDstMFV5YmDMwtYCtGpxAIEYJQlEWrI1cyX8UaFs+Ztzeo tdiM3BI6kRK3QpGatTj9yrvWuUiSu+MZgLHMoGUPLa4yTmDZ9gRHZVxs1dx5naFJ+vol TZ6LvnnpWIiu6dVgp0runowojoEMaJ0RS9dnZ63Ve920/XelWyi1tskNYvA61MkvnHQh a+cA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:date:dkim-signature; bh=X6Mc1467Tr+n3B+nCTUL6nWniTp2NFe2UCsWnkAH0JA=; fh=m/VWReA/Lr+Dy6RHFQRvt/OPSJRBdpqTlNeneoc/VYM=; b=roYE0nbrmcXEAZJQcP05cHNhK0s4HWtxm6a76whreCAK7emhdXgk4kCaSZogI9dXet CNdcCp9rRTNWpNNt4f0GdrQhv8+Pb8VoEwP/QXHKfLarMkXIhJJswq4em78H8/QMsVMG jYcozD0dr6Dg95VvPqC7LTWIG7El2Ds7MEe3X+S981nGKk0VSBJ4GPI4gRIhb2Hnf85u iT1UjGtGF2AIjLV9xSY3H400HBJCZpnSrMH3jxCoSB+3XhV0ZZSdsQikMiV3r9eTTO1I hmL94P7Gwtc9bjp7LcRrykMeQladlNQHB8M/ElWw1YVUY7O1anYIXIpIW6BEYfsWt54v k+cg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=b0LNcUEU; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o21-20020a17090611d500b00a3f43f69948si717672eja.299.2024.02.21.11.52.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 11:52:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=b0LNcUEU; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 150F51F23979 for ; Wed, 21 Feb 2024 19:51:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 827D115442A; Wed, 21 Feb 2024 19:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="b0LNcUEU" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FAB61534F2 for ; Wed, 21 Feb 2024 19:41:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708544513; cv=none; b=PR4FuYpGzT6m20JSogjOY+vquuGRbolRkDl/Lx+MtqgypQXqlFcqjccQwRom7og71kZ8zc9VlZkszs3FaMkdZIioOOa+7awOjFUA8ZicI+JOZuyUtoF+8s3EHIbo1wvuNU2TPkAGfxMeN1jRjKH+ipC2XDH/mtuMrLZKDCo4pbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708544513; c=relaxed/simple; bh=qkZhp+ePz3dtXVk7UutjwpWx2QtP2MvgIxyFZrcOXXs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HIMgLozxb/q9K2nHUqK6RBgtNXFkIxsvWN3UEKYQI1FQk9AJ0w67AzXO9QaidCr1pjo+vbgerK97sO40djTmXavJUhDUYX9gbI3fWj84AOzsr4jTg3ZE4RPAEjB2btnEFL2cnBt3tuESFGMFUXPoI83olShGpiSvoJs0m3Mbvf0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=b0LNcUEU; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6085e433063so44747637b3.1 for ; Wed, 21 Feb 2024 11:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708544510; x=1709149310; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=X6Mc1467Tr+n3B+nCTUL6nWniTp2NFe2UCsWnkAH0JA=; b=b0LNcUEUh2ruduEaLgcg3nQ9U5rhyUIb+7Qrs0mgzU4z+my3zwxazrgoseHW7b8yFO VNFgNMA3Oqu/AogWa+GjJrkcHUBWQBX/uyRM68yZ41UtQyrqaDmq1dJuN3J9PZtsy8Hk xVaJodmxmmTJLiJKd6x3wqHB5Jy+FOKCza02PStCK1uGD4dLE2dgIRbPlG7tI0zPI4qe Os5+nTV8bHblWubOdyD3EofzxQmX3EftO+oh/tZpBNMwc4P0E43oCyHd39v6njiUxdkB 4hRqTjjxNmTQzeLnmpmkuY7rY5PCdHAZA3xqP06e3KASsOwvHHTO5KdhnhyYrApo7fLX 2mlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708544510; x=1709149310; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=X6Mc1467Tr+n3B+nCTUL6nWniTp2NFe2UCsWnkAH0JA=; b=Sl29rRwtxi5y0ve+kfEgcTcCSps8L/kuG4RBOIjSeIi4ubfiCz6nuVz8cNnoeFj+81 WYUT7j7As03ynTWr9C/kt83bqWmHaP0+oTjk/wOUJmdXLW35BWLZfwpfn+pD8xxPsT+X KdG8ade57BYOrivXUwEtPYxGSC1ff9V4pdjq/2hrz2pLvYVI3pQEYRiIDLCv+vSu04+Q Eikv7CF52ngxeImo/upKxB4+9OWmMdYDA5wcWAh5cpXE45l4T2CQE/VoK0//HRlWWqfl 3PCUvZfkkks9dfyipMooRR8skR84dukCBJA5Zu/lS1xDCaLfqw+GfXEMQ0Z0Efw25DBI rT5Q== X-Forwarded-Encrypted: i=1; AJvYcCWpBq2B2XU0nogDCxLpP9zcOwtKmBlAF+zwdiDkXvMMHmTomhNJBDUVBsat7ZnlbDxxJFPtB/cnlllniacUlJtLDAxNXXmRce9G9KwC X-Gm-Message-State: AOJu0Yx3AKcCcgoXtr1NqLcjcZPUBuLFPQnGKnnrfEwuM16r1GOr34TG IoR6BVq9RT6Ga6o02Y6oKKJcNGewq90sAz4TavG5/N6UH/+RCn9X3lADQgxshzZBjoWbjimiuId PJg== X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:953b:9a4e:1e10:3f07]) (user=surenb job=sendgmr) by 2002:a05:690c:368a:b0:608:55be:5e3d with SMTP id fu10-20020a05690c368a00b0060855be5e3dmr1661247ywb.0.1708544509616; Wed, 21 Feb 2024 11:41:49 -0800 (PST) Date: Wed, 21 Feb 2024 11:40:37 -0800 In-Reply-To: <20240221194052.927623-1-surenb@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240221194052.927623-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221194052.927623-25-surenb@google.com> Subject: [PATCH v4 24/36] rust: Add a rust helper for krealloc() From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, penguin-kernel@i-love.sakura.ne.jp, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, surenb@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , "=?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?=" , Benno Lossin , Andreas Hindborg , Alice Ryhl , rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: Kent Overstreet Memory allocation profiling is turning krealloc() into a nontrivial macro - so for now, we need a helper for it. Until we have proper support on the rust side for memory allocation profiling this does mean that all Rust allocations will be accounted to the helper. Signed-off-by: Kent Overstreet Cc: Miguel Ojeda Cc: Alex Gaynor Cc: Wedson Almeida Filho Cc: Boqun Feng Cc: Gary Guo Cc: "Bj=C3=B6rn Roy Baron" Cc: Benno Lossin Cc: Andreas Hindborg Cc: Alice Ryhl Cc: rust-for-linux@vger.kernel.org Signed-off-by: Suren Baghdasaryan --- rust/helpers.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rust/helpers.c b/rust/helpers.c index 70e59efd92bc..ad62eaf604b3 100644 --- a/rust/helpers.c +++ b/rust/helpers.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -157,6 +158,13 @@ void rust_helper_init_work_with_key(struct work_struct= *work, work_func_t func, } EXPORT_SYMBOL_GPL(rust_helper_init_work_with_key); =20 +void * __must_check rust_helper_krealloc(const void *objp, size_t new_size= , + gfp_t flags) __realloc_size(2) +{ + return krealloc(objp, new_size, flags); +} +EXPORT_SYMBOL_GPL(rust_helper_krealloc); + /* * `bindgen` binds the C `size_t` type as the Rust `usize` type, so we can * use it in contexts where Rust expects a `usize` like slice (array) indi= ces. --=20 2.44.0.rc0.258.g7320e95886-goog