lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLgiarbw82R34Ct=GP3-6ophJOuhuRoerr427gHsEPy+Rcg@mail.gmail.com>
Date: Wed, 4 Dec 2024 10:39:58 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Carlos Llamas <cmllamas@...gle.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Arve Hjønnevåg <arve@...roid.com>, 
	Todd Kjos <tkjos@...roid.com>, Martijn Coenen <maco@...roid.com>, 
	Joel Fernandes <joel@...lfernandes.org>, Christian Brauner <brauner@...nel.org>, 
	Suren Baghdasaryan <surenb@...gle.com>, linux-kernel@...r.kernel.org, kernel-team@...roid.com, 
	Matthew Wilcox <willy@...radead.org>, "Liam R. Howlett" <Liam.Howlett@...cle.com>
Subject: Re: [PATCH v6 4/9] binder: store shrinker metadata under page->private

On Tue, Dec 3, 2024 at 10:56 PM Carlos Llamas <cmllamas@...gle.com> wrote:
>
> Instead of pre-allocating an entire array of struct binder_lru_page in
> alloc->pages, install the shrinker metadata under page->private. This
> ensures the memory is allocated and released as needed alongside pages.
>
> By converting the alloc->pages[] into an array of struct page pointers,
> we can access these pages directly and only reference the shrinker
> metadata where it's being used (e.g. inside the shrinker's callback).

Using many allocations instead of a single array will increase the
number of allocations a lot. Is it worth it?

> Rename struct binder_lru_page to struct binder_shrinker_mdata to better
> reflect its purpose. Add convenience functions that wrap the allocation
> and freeing of pages along with their shrinker metadata.
>
> Note I've reworked this patch to avoid using page->lru and page->index
> directly, as Matthew pointed out that these are being removed [1].
>
> Link: https://lore.kernel.org/all/ZzziucEm3np6e7a0@casper.infradead.org/ [1]
> Cc: Matthew Wilcox <willy@...radead.org>
> Cc: Liam R. Howlett <Liam.Howlett@...cle.com>
> Reviewed-by: Suren Baghdasaryan <surenb@...gle.com>
> Signed-off-by: Carlos Llamas <cmllamas@...gle.com>

[...]

> +static void binder_free_page(struct page *page)
> +{
> +       kfree((void *)page_private(page));
> +       __free_page(page);

I would cast the page_private to a pointer of the right type here.
There may be tools or future improvements to kfree that use the type
information.

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ