* [PATCH v4 24/36] rust: Add a rust helper for krealloc() [not found] <20240221194052.927623-1-surenb@google.com> @ 2024-02-21 19:40 ` Suren Baghdasaryan 2024-02-22 9:59 ` Alice Ryhl 0 siblings, 1 reply; 3+ messages in thread From: Suren Baghdasaryan @ 2024-02-21 19:40 UTC (permalink / raw) To: akpm Cc: kent.overstreet, mhocko, vbabka, hannes, roman.gushchin, mgorman, dave, willy, liam.howlett, penguin-kernel, corbet, void, peterz, juri.lelli, catalin.marinas, will, arnd, tglx, mingo, dave.hansen, x86, peterx, david, axboe, mcgrof, masahiroy, nathan, dennis, tj, muchun.song, rppt, paulmck, pasha.tatashin, yosryahmed, yuzhao, dhowells, hughd, andreyknvl, keescook, ndesaulniers, vvvvvv, gregkh, ebiggers, ytcoode, vincent.guittot, dietmar.eggemann, rostedt, bsegall, bristot, vschneid, cl, penberg, iamjoonsoo.kim, 42.hyeyoo, glider, elver, dvyukov, shakeelb, songmuchun, jbaron, rientjes, minchan, kaleshsingh, surenb, kernel-team, linux-doc, linux-kernel, iommu, linux-arch, linux-fsdevel, linux-mm, linux-modules, kasan-dev, cgroups, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, rust-for-linux From: Kent Overstreet <kent.overstreet@linux.dev> 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 <kent.overstreet@linux.dev> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Alex Gaynor <alex.gaynor@gmail.com> Cc: Wedson Almeida Filho <wedsonaf@gmail.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Gary Guo <gary@garyguo.net> Cc: "Björn Roy Baron" <bjorn3_gh@protonmail.com> Cc: Benno Lossin <benno.lossin@proton.me> Cc: Andreas Hindborg <a.hindborg@samsung.com> Cc: Alice Ryhl <aliceryhl@google.com> Cc: rust-for-linux@vger.kernel.org Signed-off-by: Suren Baghdasaryan <surenb@google.com> --- 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 <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. -- 2.44.0.rc0.258.g7320e95886-goog ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4 24/36] rust: Add a rust helper for krealloc() 2024-02-21 19:40 ` [PATCH v4 24/36] rust: Add a rust helper for krealloc() Suren Baghdasaryan @ 2024-02-22 9:59 ` Alice Ryhl 2024-02-23 22:17 ` Suren Baghdasaryan 0 siblings, 1 reply; 3+ messages in thread From: Alice Ryhl @ 2024-02-22 9:59 UTC (permalink / raw) To: Suren Baghdasaryan Cc: akpm, kent.overstreet, mhocko, vbabka, hannes, roman.gushchin, mgorman, dave, willy, liam.howlett, penguin-kernel, corbet, void, peterz, juri.lelli, catalin.marinas, will, arnd, tglx, mingo, dave.hansen, x86, peterx, david, axboe, mcgrof, masahiroy, nathan, dennis, tj, muchun.song, rppt, paulmck, pasha.tatashin, yosryahmed, yuzhao, dhowells, hughd, andreyknvl, keescook, ndesaulniers, vvvvvv, gregkh, ebiggers, ytcoode, vincent.guittot, dietmar.eggemann, rostedt, bsegall, bristot, vschneid, cl, penberg, iamjoonsoo.kim, 42.hyeyoo, glider, elver, dvyukov, shakeelb, songmuchun, jbaron, rientjes, minchan, kaleshsingh, kernel-team, linux-doc, linux-kernel, iommu, linux-arch, linux-fsdevel, linux-mm, linux-modules, kasan-dev, cgroups, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, rust-for-linux On Wed, Feb 21, 2024 at 8:41 PM Suren Baghdasaryan <surenb@google.com> wrote: > > From: Kent Overstreet <kent.overstreet@linux.dev> > > 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 <kent.overstreet@linux.dev> > Cc: Miguel Ojeda <ojeda@kernel.org> > Cc: Alex Gaynor <alex.gaynor@gmail.com> > Cc: Wedson Almeida Filho <wedsonaf@gmail.com> > Cc: Boqun Feng <boqun.feng@gmail.com> > Cc: Gary Guo <gary@garyguo.net> > Cc: "Björn Roy Baron" <bjorn3_gh@protonmail.com> > Cc: Benno Lossin <benno.lossin@proton.me> > Cc: Andreas Hindborg <a.hindborg@samsung.com> > Cc: Alice Ryhl <aliceryhl@google.com> > Cc: rust-for-linux@vger.kernel.org > Signed-off-by: Suren Baghdasaryan <surenb@google.com> Currently, the Rust build doesn't work throughout the entire series since there are some commits where krealloc is missing before you introduce the helper. If you introduce the helper first before krealloc stops being an exported function, then the Rust build should work throughout the entire series. (Having both the helper and the exported function at the same time is not a problem.) With the patch reordered: Reviewed-by: Alice Ryhl <aliceryhl@google.com> Alice ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4 24/36] rust: Add a rust helper for krealloc() 2024-02-22 9:59 ` Alice Ryhl @ 2024-02-23 22:17 ` Suren Baghdasaryan 0 siblings, 0 replies; 3+ messages in thread From: Suren Baghdasaryan @ 2024-02-23 22:17 UTC (permalink / raw) To: Alice Ryhl Cc: akpm, kent.overstreet, mhocko, vbabka, hannes, roman.gushchin, mgorman, dave, willy, liam.howlett, penguin-kernel, corbet, void, peterz, juri.lelli, catalin.marinas, will, arnd, tglx, mingo, dave.hansen, x86, peterx, david, axboe, mcgrof, masahiroy, nathan, dennis, tj, muchun.song, rppt, paulmck, pasha.tatashin, yosryahmed, yuzhao, dhowells, hughd, andreyknvl, keescook, ndesaulniers, vvvvvv, gregkh, ebiggers, ytcoode, vincent.guittot, dietmar.eggemann, rostedt, bsegall, bristot, vschneid, cl, penberg, iamjoonsoo.kim, 42.hyeyoo, glider, elver, dvyukov, shakeelb, songmuchun, jbaron, rientjes, minchan, kaleshsingh, kernel-team, linux-doc, linux-kernel, iommu, linux-arch, linux-fsdevel, linux-mm, linux-modules, kasan-dev, cgroups, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, rust-for-linux On Thu, Feb 22, 2024 at 2:00 AM Alice Ryhl <aliceryhl@google.com> wrote: > > On Wed, Feb 21, 2024 at 8:41 PM Suren Baghdasaryan <surenb@google.com> wrote: > > > > From: Kent Overstreet <kent.overstreet@linux.dev> > > > > 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 <kent.overstreet@linux.dev> > > Cc: Miguel Ojeda <ojeda@kernel.org> > > Cc: Alex Gaynor <alex.gaynor@gmail.com> > > Cc: Wedson Almeida Filho <wedsonaf@gmail.com> > > Cc: Boqun Feng <boqun.feng@gmail.com> > > Cc: Gary Guo <gary@garyguo.net> > > Cc: "Björn Roy Baron" <bjorn3_gh@protonmail.com> > > Cc: Benno Lossin <benno.lossin@proton.me> > > Cc: Andreas Hindborg <a.hindborg@samsung.com> > > Cc: Alice Ryhl <aliceryhl@google.com> > > Cc: rust-for-linux@vger.kernel.org > > Signed-off-by: Suren Baghdasaryan <surenb@google.com> > > Currently, the Rust build doesn't work throughout the entire series > since there are some commits where krealloc is missing before you > introduce the helper. If you introduce the helper first before > krealloc stops being an exported function, then the Rust build should > work throughout the entire series. (Having both the helper and the > exported function at the same time is not a problem.) Ack. I'll move it up in the series. > > With the patch reordered: > > Reviewed-by: Alice Ryhl <aliceryhl@google.com> Thanks Alice! > > Alice ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-23 22:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240221194052.927623-1-surenb@google.com>
2024-02-21 19:40 ` [PATCH v4 24/36] rust: Add a rust helper for krealloc() Suren Baghdasaryan
2024-02-22 9:59 ` Alice Ryhl
2024-02-23 22:17 ` Suren Baghdasaryan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).