[PATCH RFC 1/3] lib: add talloc for overlaying a tree onto allocations
Sascha Hauer
s.hauer at pengutronix.de
Fri Nov 7 05:55:06 PST 2025
On Tue, Oct 28, 2025 at 11:26:02AM +0100, Ahmad Fatoum wrote:
> Hi,
>
> On 10/28/25 10:42 AM, Sascha Hauer wrote:
> > On Mon, Oct 27, 2025 at 08:54:32AM +0100, Ahmad Fatoum wrote:
> >> +#ifndef __TALLOC_H__
> >> +#define __TALLOC_H__
> >> +
> >> +#include <linux/types.h>
> >> +
> >> +struct talloc {
> >> + struct talloc *child;
> >> + struct talloc *next;
> >> + union {
> >> + struct talloc *prev;
> >> + struct talloc *parent; /* Valid only when is_first(mem) */
> >> + };
> >> +};
> >
> > Currently tlsf allocations are 8 byte aligned. On 32bit architectures
> > struct talloc will be 12 bytes, so talloc allocations will only have 4
> > byte alignment.
>
> Good catch. On 32-bit, there is 4 bytes of unused padding inside TLSF
> and feels bad sacrificing 4 more bytes here. :/
I find the memory leak checker extremly useful and it becomes even more
useful with the memory leaks in hush fixed.
I suggest we add an __aligned(8) here and be done with it for now.
We can still think about it when widening the talloc use for
dev_kmalloc(), but as long as it's only used by hush we shouldn't hold
this series up.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list