Message ID | 20240306182440.2003814-25-surenb@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0908C54E41 for <linux-mm@archiver.kernel.org>; Wed, 6 Mar 2024 18:25:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D97696B00B2; Wed, 6 Mar 2024 13:25:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D4AAF6B00B3; Wed, 6 Mar 2024 13:25:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFEEC6B00B4; Wed, 6 Mar 2024 13:25:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 93EC66B00B2 for <linux-mm@kvack.org>; Wed, 6 Mar 2024 13:25:39 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 73BF0A15C0 for <linux-mm@kvack.org>; Wed, 6 Mar 2024 18:25:39 +0000 (UTC) X-FDA: 81867442398.11.2FEDDF8 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf05.hostedemail.com (Postfix) with ESMTP id C34BD10000B for <linux-mm@kvack.org>; Wed, 6 Mar 2024 18:25:37 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=YdgrK0Pv; spf=pass (imf05.hostedemail.com: domain of 3ILXoZQYKCGMTVSFOCHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3ILXoZQYKCGMTVSFOCHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709749537; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=K6AcyGgSKYmz5a5MAIaPTUUBsabHZwFmfRjLl2PG8hA=; b=utHmcz/yoabW/jsuCC/9Ih04kuof7iE0JgWI65qCnqLIGOIzlaOoBgParDZd9ThGTPfx7L Vj8wSMXEqsx7A7DxjhNyBdLDON6LyltzFvcb9k8+naYCRr3HRH8L8AK+405XxzwKrkE9O7 KzWEoFdHbc7DuZ08TDXMwQ8zIF/Udf4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709749537; a=rsa-sha256; cv=none; b=YuXReRPpI2usybldqkuN3JSiqnho+Ed0e/Pqm9GsiGCw9xWVdKWW7ItsZGLEqDHe/zpf3I pGmmK/c8X74mcZ9qBzi5jQzr8/0kK6o47ii2lwwjrB63lFXSAPXYTnyCRbOIfzGiVBjLDb vsVGH2UZ0vGTiM7GX9UYpD1q8LoNGWY= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=YdgrK0Pv; spf=pass (imf05.hostedemail.com: domain of 3ILXoZQYKCGMTVSFOCHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3ILXoZQYKCGMTVSFOCHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-607e8e8c2f1so115507b3.3 for <linux-mm@kvack.org>; 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=kvack.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=YdgrK0PvSreSID6ZJrCDSCbcyGXbetgrq7u3dN+2tUb8mC+zBsPjiY37cijFdy7/SJ WMYVCp/AkczSvHG7AJlwpCGsNSzA98M3E3j17HJMGWafb4hUp82IfEsVNs61QkgChedN o+7pZCt6dMWVZxptVQJ3p65KiNyB5Jhdc6AHTpfHGtvaR2ViV45wLWfGnBG5nX5ek8/E ABj3rRjO2H4cgJ0oS8EdL6rimAITAg+Yx/LFhqOQ7wU4Gfn9Ct/MphALxgq2x0F86SK8 EPAx9aSyKsp0niH0hu+9GEDrI38cwtarDFanB4p3AY2LH8EDNmORjHizpMAHoUn6IejP iK6g== 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=gBmf4dNltammWRululDaMn6yU4s793qt5uKnsW9n7c1hWCEp1WU2H0wTF41WClUEgP h/CgthWrjSTc+MLN/o/4VGcU6iOFlNBnZn5zPtJ5nONOAGdKYskhULFjjU6BdXa9T0c0 J9ya1ACdEPUGr8FK9J6NPP6aVUvPsiZ5oRgCBEn6O99EyXmFXEWwj4msUuh6FEc5kVra FjZI+WbBhBAHtjd7hGwUYEAwUtpRL8xh9iCmhVnLvac8iMV5r2EPBisCcCphijdYVHIv DRo4/LVA5oWJNgaZC1jOnBmG1GxEhx5SZA2aFPjhxfTizT1+ttap9B4tyLGkSNX1ILaa JYtA== X-Forwarded-Encrypted: i=1; AJvYcCWoO7/ku0ls3ve3+w4fvduENWSb5vMZovtdFEo5Bh2CmBF8JSThXNkwvxgPJC4qlbWf+FnpKMIiSFaIqn9nsQ24k0w= X-Gm-Message-State: AOJu0YxzbIrUNOlUKn3XEaqfUy+7mVQcNOa4ck2UkqRz2kNQVZjOSB7Q Qk4Uwte5lfCT4nwltQiuMfp+g11fDjlc2ED+f5Y/0zdlLe5ujHT1ZfryHtkCvCgDbQaH4dx7/RV JvA== X-Google-Smtp-Source: AGHT+IHr70OmG1R1IO1Fluk0v1eGaHNwt9Z96sNJit+XMVYfO4W641pUVkuKWr/RRoRl/U2gSXjA5z2Bwhw= 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> 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 <surenb@google.com> 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 <ojeda@kernel.org>, Alex Gaynor <alex.gaynor@gmail.com>, Wedson Almeida Filho <wedsonaf@gmail.com>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " <bjorn3_gh@protonmail.com>, Benno Lossin <benno.lossin@proton.me>, Andreas Hindborg <a.hindborg@samsung.com>, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: 5odamp7rteakgw7iwx3rnea63ad7r7zg X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: C34BD10000B X-Rspam-User: X-HE-Tag: 1709749537-764873 X-HE-Meta: U2FsdGVkX1/mvd4B3oXf0AAJyarVOM+PNN46jofkR3WaOW/ykWuQzvDko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ghkaBIkNtczoalv9+BldCLoFvBnjUhscux6J1GXsJdDA2RWI6BPocqrnlx/hZG1ewu9Px5n+l9lOMLppBkAAzGIs2tyf3No6XVgG3UTWaJxH9Fj6Xd87iyvAKf7lrYEA8K8Usx0kbO2GdTE/ZqOxzL+4KlE9D38eZCxYLVgJ81IbGIBaOSb1fVdFMPipVF4d7ln/EeXnxV71LfjkXesehcvV+enDDg+7p1HIVKEbEtAUa8wdx7+6t7daiurGmhUIye/wJZCjD X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Memory allocation profiling
|
expand
|
On Wed, Mar 6, 2024 at 7:26 PM Suren Baghdasaryan <surenb@google.com> wrote: > > +void * __must_check rust_helper_krealloc(const void *objp, size_t new_size, > + gfp_t flags) __realloc_size(2) The `__realloc_size(2)` should be placed earlier, i.e. this triggers: rust/helpers.c:162:20: error: GCC does not allow '__alloc_size__' attribute in this position on a function definition [-Wgcc-compat] With that fixed: Acked-by: Miguel Ojeda <ojeda@kernel.org> Cheers, Miguel
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 <linux/mutex.h> #include <linux/refcount.h> #include <linux/sched/signal.h> +#include <linux/slab.h> #include <linux/spinlock.h> #include <linux/wait.h> #include <linux/workqueue.h> @@ -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); +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) indices.