Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp596660lqp; Thu, 21 Mar 2024 09:48:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXs+iieefwFK8ZuYuRMF4ZYNO3xapfp8Ff2gPO6RaQoJKjKrOTsO3twnp+PtnNEJYNQhpOP8e3D682k8PKjaTF2iwPV6r1VRkJthJ9bSw== X-Google-Smtp-Source: AGHT+IEUxRT77oR4FrFsPIipAaXZ56vaVZXMh36uG//XLF+y6JuKKBUPl6R2o/xAO26j9AQ6BKs4 X-Received: by 2002:a05:6a20:258f:b0:1a3:8e26:4ba1 with SMTP id k15-20020a056a20258f00b001a38e264ba1mr61583pzd.18.1711039691331; Thu, 21 Mar 2024 09:48:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711039691; cv=pass; d=google.com; s=arc-20160816; b=rz4O+3D1y8aF1n2wGz1N35cllPMc174mujHuunfpHX9UoaNI7O2OpFLxAoWQtecC1W TBBN+uoAns8r7nqJ2VNlYtRFiaQYpVLZsR9vOfxQXCR5SjsJtEkqGFaR2ts1zp196d80 Faj5IwQh/YgzRMVv7tgEUkmntldhG/3LIwqEMhf/2P8o2ihZG082MEHh52uBG6fIyMpE 1Pi2t5jbIbXq9PtJYKhrO1sSH7aHVRDxHf2KDV+fpJrJM54TcjMh1bBVua534/QrVQVK pKcd0j7LbclEcT+giiwGea+SH38V6Pu6vbTT25AyLWw+83K1YFMclL2n1KWT64IpyVm1 vBkQ== 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=s40WFNE8AOKkW3fMlFNAMtyrdkqCS9mljSRdY//hl9w=; fh=4p3pkw76Z87b+CxkH9dFZN5D87e1u6aDJTzTd830McU=; b=DrWVEjrXUpsL9+rDqBMiQhG1YtA5F/RTX0wUC6U0+ZbsEA8sQbduqVM1u5ydPJQFyK T+d0solPLPRkbKwPafASsDfmupntFcajJX8tWC6ASGaFgf91i9IQNyW5Oz7+rLL758Nf PXT5+X+jOaxKG4ne1kqkwA1Zr37N2eGeUC1PY+wsx6h2ew2WfPN+h/iWAB2ctHf/JRlb uKtdpJ6h8rV9Cc7IN9Xez0PkWs9X8f5hNqJ3aX9tGZhUUWOM8/lN++yhPrCoTItXifAG +ohbfGMooYlxeXC4ySXyUiGWbWvnfVlZhpjBsAtYooSoCLA65p1LrjXbO+7DEnPXUFwG 31YA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CQ6t8u0m; 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-110382-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110382-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q7-20020a635047000000b005cd77a0fd8dsi102582pgl.484.2024.03.21.09.48.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:48:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110382-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CQ6t8u0m; 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-110382-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110382-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 236A9283A07 for ; Thu, 21 Mar 2024 16:47:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E19D313A27C; Thu, 21 Mar 2024 16:38:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CQ6t8u0m" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 B2A3213B285 for ; Thu, 21 Mar 2024 16:38:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711039086; cv=none; b=jaktJ2cgorbjDE2L9S+ykYeyxDMHLD3xn0rt+VfQaFxwlW00A37Md70kCgdz8jdIuzEGW0ZcbaCmxjG4qGkexY+gu+HP/nJTCnJCGhT8/rMzKNyPWPRR3riS0xWJmsbGLsF8vv7dwOrt/VDZBAQfwqogTVUy2JWNl5gjexUozlg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711039086; c=relaxed/simple; bh=jXsURVn8SIEDSxm3ybi646KeGxqom+Lp+iDA2OWR8bA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Uqo8BO0bafGY0hCdmNXDCBkveLFfmh+Iiq5RtbLj3nJgJM5LbsyUqIKnlSAgVjok1yBz/kOYEn6g6OezyroZuNxghGU40zIzxLolpcHEraHQU9VIue1xSZBEwUJJDbYdnWuY0qVY1tyrW2a3EJRVOUyQ0P348jCTez2GwPXGLlA= 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=CQ6t8u0m; arc=none smtp.client-ip=209.85.128.202 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-f202.google.com with SMTP id 00721157ae682-60cd073522cso21754337b3.1 for ; Thu, 21 Mar 2024 09:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1711039082; x=1711643882; 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=s40WFNE8AOKkW3fMlFNAMtyrdkqCS9mljSRdY//hl9w=; b=CQ6t8u0msbijO81264wqXFw8BKrxYLrJuEZuSSTwkWEAqjDy/Q856UuJhkY5p+lnvz 6TC7Ca0uS/TphDMECYCmS2UeoRk+YO8XQEW/0+SwfexB8JfPBfisXkLBgF4/HC8+k27R j993HXFtLbTxTfGtrYGDhlG0r7kpf6NZ55u+tGs9q2uDCRiKunTuM91MCuxr0OfsU1oz POegw9ggM0eo/7L0VU4f7EN1hrXC9JKao7nunpo+ol0iFfgiCWTrdViub0KDPvQe2u2R wxtUJuRgZR4EJRtONFiiIOiFx2W2w/M+dgfy93A9T3GXXU2pEZG8XYIO0sgM/U6S2dEF XUjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039082; x=1711643882; 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=s40WFNE8AOKkW3fMlFNAMtyrdkqCS9mljSRdY//hl9w=; b=IbWGSxrVSUG0XLis9O0sEQ3WqprkdrBq/8YeZ5hzPo5lIoYht1Peh9IZN5Fq65Gqfv q1LD+NC9Z5JeCJAa+dDDAbO07Sp6AepxyFlP6OZnEWy2lHDzog6PR0s8l5bVLQXV7372 wWIoMYMQliNVildlcCjFOsJxqjKp6uqEhIef+KcUa3V5TG0NbHXS2vOjzbN3zclNpfGx KIjrVJPXBVpy+6WZuv7m+vThEHIi8BUt7IMfIYrCqoJRsyw0qG2HDNbqU8OhwmZ0Bxio OlNJYvhIfbTDQWheIU353A5aUR090qqYt4fC/KG7QsUgGFUAIjMoCy2EuVBFJRHlURd3 hayg== X-Forwarded-Encrypted: i=1; AJvYcCUPEBLARIkpnT82nKDOQk26+TLYf8Rjh/+JQnt4jEFvvn1J/KHj1RJgSoczZ/n22Qdq/akikOjmkvrRPf9lIbPymhM37mPJPXZ5eg7J X-Gm-Message-State: AOJu0YzR2B5PzS7Oh+6d/aGsYA/sr+h7HvaSdgp8ommTpwy7KOEiHrg2 COGEZ2WBwzaHPRcT737Ex37q7JQ+bpJKvC4uhAjab51wgfT6VafYgB3Tv3drBeA7cU+5jkI3cXt w5g== X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:a489:6433:be5d:e639]) (user=surenb job=sendgmr) by 2002:a0d:ca91:0:b0:610:fc58:5b83 with SMTP id m139-20020a0dca91000000b00610fc585b83mr1061193ywd.8.1711039081806; Thu, 21 Mar 2024 09:38:01 -0700 (PDT) Date: Thu, 21 Mar 2024 09:36:46 -0700 In-Reply-To: <20240321163705.3067592-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: <20240321163705.3067592-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.291.gc1ea87d7ee-goog Message-ID: <20240321163705.3067592-25-surenb@google.com> Subject: [PATCH v6 24/37] 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, jhubbard@nvidia.com, 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, songmuchun@bytedance.com, jbaron@akamai.com, aliceryhl@google.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 , 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 Reviewed-by: Alice Ryhl Acked-by: Miguel Ojeda --- rust/helpers.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rust/helpers.c b/rust/helpers.c index 70e59efd92bc..858d802abd11 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 __realloc_size(2) +rust_helper_krealloc(const void *objp, size_t new_size, gfp_t flags) +{ + 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.291.gc1ea87d7ee-goog