mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shivam Kalra <shivamkalra98@gmail.com>
To: Danilo Krummrich <dakr@kernel.org>, Alice Ryhl <aliceryhl@google.com>
Cc: "Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	"Uladzislau Rezki" <urezki@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Christian Brauner" <brauner@kernel.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/4] rust: alloc: add Vec shrinking methods
Date: Tue, 10 Feb 2026 23:12:30 +0530	[thread overview]
Message-ID: <d5c34a1f-8538-47ab-80e4-6d54b96d5b2e@gmail.com> (raw)
In-Reply-To: <DGBDHMI9Z4JK.3QHCOS1O8WGLB@kernel.org>

On 10/02/26 20:35, Danilo Krummrich wrote:
> On Tue Feb 10, 2026 at 2:57 PM CET, Alice Ryhl wrote:
>> On Tue, Feb 10, 2026 at 07:08:09PM +0530, Shivam Kalra wrote:
>>> This is a follow-up to my v3 series:
>>> https://lore.kernel.org/rust-for-linux/20260207-binder-shrink-vec-v3-v3-0-8ff388563427@cock.li/
>>>
>>> Hi all,
>>>
>>> Thanks for the feedback on v3. Before I respin, I want to confirm
>>> the direction for v4 to avoid unnecessary iterations.
>>>
>>> Proposed changes for v4:
>>>
>>> 1. Drop the Shrinkable trait entirely. Make shrink_to() a normal
>>>    method on Vec<T, A> that calls A::realloc(). (Danilo)
>>>
>>> 2. Add a temporary ShrinkQuirk trait to handle the vmalloc workaround
>>>    (page-boundary check + manual alloc+copy+free) until vrealloc
>>>    gains in-place shrinking support. (Danilo)
>>
>> I don't think you want any new traits at all. What types would even
>> implement the trait? The special code can go in the realloc() method of
>> Vmalloc struct in rust/kernel/alloc/allocator.rs.
> 
> I did not propose to move this into the realloc() functions of the corresponding
> allocators intentionally, as there is a difference between calling realloc() and
> shrink_to().
> 
> I don't want that some user of e.g. Vmalloc::realloc() experiences page wise
> shrinking by copy. This is acceptable for Vec::shrink_to(), but not for
> realloc() in general.
I think this aligns with the reasoning behind the Shrinkable trait
in v3- keeping the shrink workaround separate from realloc() so
that other users of realloc() (like IntoIter) don't unexpectedly
get alloc+copy+free behavior.
Happy to implement whichever approach you both agree on.


  reply	other threads:[~2026-02-10 17:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-07 11:32 Shivam Kalra via B4 Relay
2026-02-07 11:32 ` [PATCH v3 1/4] rust: alloc: introduce Shrinkable trait Shivam Kalra via B4 Relay
2026-02-07 11:32 ` [PATCH v3 2/4] rust: kvec: implement shrink_to and shrink_to_fit for Vec Shivam Kalra via B4 Relay
2026-02-07 17:23   ` Danilo Krummrich
2026-02-08 16:11     ` Shivam Kalra
2026-02-07 11:32 ` [PATCH v3 3/4] rust: alloc: add KUnit tests for Vec shrink operations Shivam Kalra via B4 Relay
2026-02-07 11:32 ` [PATCH v3 4/4] rust: binder: shrink all_procs when deregistering processes Shivam Kalra via B4 Relay
2026-02-09 13:54   ` Alice Ryhl
2026-02-10 11:47     ` Shivam Kalra
2026-02-10 13:38 ` [PATCH v3 0/4] rust: alloc: add Vec shrinking methods Shivam Kalra
2026-02-10 13:57   ` Alice Ryhl
2026-02-10 15:05     ` Danilo Krummrich
2026-02-10 17:42       ` Shivam Kalra [this message]
2026-02-10 20:05       ` Alice Ryhl
2026-02-10 20:43         ` Danilo Krummrich
2026-02-10 20:53           ` Danilo Krummrich
2026-02-10 20:56             ` Danilo Krummrich
2026-02-10 20:58             ` Alice Ryhl
2026-02-10 21:11               ` Danilo Krummrich
2026-02-11  1:08                 ` Shivam Kalra
2026-02-11  6:51                   ` Alice Ryhl
2026-02-11  8:41                     ` Shivam Kalra
2026-02-11  8:57                       ` Danilo Krummrich
2026-02-11  9:35                         ` Shivam Kalra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5c34a1f-8538-47ab-80e4-6d54b96d5b2e@gmail.com \
    --to=shivamkalra98@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=arve@android.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=brauner@kernel.org \
    --cc=cmllamas@google.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tkjos@android.com \
    --cc=tmgross@umich.edu \
    --cc=urezki@gmail.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®