Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp80481lqi; Wed, 6 Mar 2024 10:33:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXbLm8weS5ep9ExtokydCMAt8kDogN/aUgdVjwmMcHIwe2xYOUru9uuy55zCssTuBc/6sMUgDxLb353tyHdEE3EqLPcLOHLIdc5V4odtQ== X-Google-Smtp-Source: AGHT+IH/MAp+8jkOkv5XR849Ex95BlB6DJLQMhXRgwK+A/eh2Jo7ry9B2boOm7hZB0Tdp91hLcwT X-Received: by 2002:ac2:5305:0:b0:513:315e:284d with SMTP id c5-20020ac25305000000b00513315e284dmr4439440lfh.26.1709749987753; Wed, 06 Mar 2024 10:33:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709749987; cv=pass; d=google.com; s=arc-20160816; b=ApncbxbgT8jsrdMHhP8AhF4r0uin6ApTyAzyIY29MbI+8Lj1iFVQunPM+hUCD1kpDs VFP/OEZH4/gM8R51p5DomQAJTyrn8Rg4EjmotIEHcdydf2yFaxbhZx9r3t3wa231dSCQ NbLxdbY0Kyu/Nt3Be0oZhr07yqe1A1t0NyxhS0mT4OkvJW4MIThXFCV3lSAgrYJ5O8oI L0dsqwT4JdWMpI5b0qEcDg+J6lA4R2KbLrm5CnsKozHh7Zsl8m3wPNv9ckEsLtyyC6Va o+W7OcAWa3J57x1iWIt/kbZSP+oBXVeFbfsqmWz0DlMeVH+joT2jZai5CmSRDxIgKWhK 1IfA== 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=K6AcyGgSKYmz5a5MAIaPTUUBsabHZwFmfRjLl2PG8hA=; fh=auuuFkZoL3HwUf1SqgZuSArw3yf3eTWVDRRJRN5uEqU=; b=t5TEShdFrux23RH/T8y4Z2W/C+dwkRpkREI6N4S+PtaJE8plktfBPyhq7KERpzAIgi YzeHdH8zAIBZHOwUNOvJ+QWMpGGKpBAZHJfpqF3rdfa4Urrx3sYEk6cgKbDRiTzgdXPY 84Uuh0Tr+D3ylWGLRnATtIBY3n6loO+Nyeh0Xw/owKTB29nMO0bctXVatUca83l0fbD/ 37TKJgI0R7xuY8HB/xf5kK/Jxk9+Wo0bgQvIOlSqPrEfs6t7OohOeZVdmVtDRajyH0mn saW8VrC4huhjJpIb/RDdZug/iGK+05nLwL9/GMVfd9ljR0BoLDuSvg3zmhD+fEwzL/hw MuRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bEYq0sVx; 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-94416-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94416-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p10-20020a170906228a00b00a38a0206c0esi6114385eja.633.2024.03.06.10.33.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 10:33:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94416-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bEYq0sVx; 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-94416-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94416-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 0FBAE1F23703 for ; Wed, 6 Mar 2024 18:33:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8919B14DFD0; Wed, 6 Mar 2024 18:25:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bEYq0sVx" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 99F1214CABA for ; Wed, 6 Mar 2024 18:25:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709749539; cv=none; b=o1oHsi8uVQ7uWIWnmixJvhcbP4zilKLhkLxnL8A4VTn1iw/Y2B9U64TUP1LlQDU4eWdQMLOCJ8I93qZIQf5HLQRBELpY/RdIRWJI6vyJu9i9MaT1LHuBrtGrrLw1mfI3Mr1sJhBwgXMT5gLyJGsknCWeLMUBV8QsVaZ50yA7wT4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709749539; c=relaxed/simple; bh=NrtbL/EY4V8lv5W/NYv3/0shGeJ2rjAV+ZTsI9ELgcc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=X9XwJbW3+5kSZsM2egWJK2lTlKBpnHxe5zYEpjOQDvhH4vyDipme/zDyUjYltCzWf8+m8RZavbiuDnVOHcZxfUh8NgVR7uy/zO2RckIhDKNsoX/jBsG0mZg6TqmUTuVE8WzzvRk3MixcaFIvtnLZmOEKsTcdOjDB1GbRqTQ6eSY= 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=bEYq0sVx; arc=none smtp.client-ip=209.85.219.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-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc743cc50a6so9645866276.2 for ; Wed, 06 Mar 2024 10:25:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709749537; x=1710354337; 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=K6AcyGgSKYmz5a5MAIaPTUUBsabHZwFmfRjLl2PG8hA=; b=bEYq0sVxHrMuTds06WHbN7Ei0K64EGQ9+W4kMa+0VtpmMjOtDB9a3LqV25pMa2LY4W se0Solh0/mr4sF+09LmbHO1jLF6CwgtNWTKU9Gb2H/IfwY7pZZm0VjJvw+V5EIq4D2BL AqZbCKVforZjCKxwUh8n5A0PCKOisG8lWpGfhIqml6j9VnKrHSVBGIikyCDU5jIqEVSi AlAHJ7GZXIAJmdnE6Tp4HzTBayaiVSnfoWMUMqdsa+a8g9nm+ANYZpOWNTashKR8fH+1 un0/FKZCi2HhxUX192UvYNVxAuYEnINLoxTuckoPcAkqfncgH1YGnzQInGjyNtj2t2CD qpEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709749537; x=1710354337; 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=K6AcyGgSKYmz5a5MAIaPTUUBsabHZwFmfRjLl2PG8hA=; b=KHy9LvmVmvctgMbvHKQN/vtsLi3N411QAzG/yJesmLdcl6Esc2Z2IzNZwSeKv6SShS CgsXz15ppLzbw5FCs+OML30LM7nEE7nznP6V9s/vRkvfwBDyUaWto5zL1BvjCbblCe47 w/JmLCXh+0dTsnAbXtCQ1QxtcfhSbyFeGUs94oyF3C9Xp6qsytyoh7MdAHiQNQCxO8AV d5s0jR92pBEy0SYpqG2Il1O/hQtoRmqya5xh+kzxJyIZ3jB0Aq7fa9g8gMgAKb1A7wSi NDPf1+DByRUeP0jk5VjOA8j53yY6sVQzTyDZjJq4tEoMVTa7nYr9kIjc5wEGKT22APRZ 5geA== X-Forwarded-Encrypted: i=1; AJvYcCW7hPLh29aAxyDf7w1qbyn1+Uhts/hzEqg8yeUbFMJCtIVdr8MquXY0SO3YuMQdJh5YQ+PkdNXqU2hCHZb1C0m5UYTP/lZ6Dc+HGDcr X-Gm-Message-State: AOJu0Yy6Egi7WRORFi9Sg+zkdKrgHUWok2dP9uI1LvsiyULTQHtQ02Db qEQJMjlLSOMk9lieNlibnEqwmMe+TfJnNoLMeLJ1wmb0WNpdMPHWYImDw7RY2+myh0ymr4wDLkh ZBg== X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:85f0:e3db:db05:85e2]) (user=surenb job=sendgmr) by 2002:a05:6902:18d3:b0:dc7:865b:22c6 with SMTP id ck19-20020a05690218d300b00dc7865b22c6mr633022ybb.8.1709749536658; Wed, 06 Mar 2024 10:25:36 -0800 (PST) Date: Wed, 6 Mar 2024 10:24:22 -0800 In-Reply-To: <20240306182440.2003814-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: <20240306182440.2003814-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240306182440.2003814-25-surenb@google.com> Subject: [PATCH v5 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, shakeelb@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 --- 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.278.ge034bb2e1d-goog