mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: Ahmad Fatoum <a.fatoum@barebox.org>, barebox@lists.infradead.org
Subject: Re: [PATCH RFC 1/3] lib: add talloc for overlaying a tree onto allocations
Date: Fri, 7 Nov 2025 14:55:06 +0100	[thread overview]
Message-ID: <aQ36OuSKNw7m45LD@pengutronix.de> (raw)
In-Reply-To: <94867b83-cde8-449f-8ed4-d97855831d09@pengutronix.de>

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 |



  reply	other threads:[~2025-11-07 13:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27  7:54 Ahmad Fatoum
2025-10-27  7:54 ` [PATCH RFC 2/3] test: self: add talloc selftest Ahmad Fatoum
2025-10-27  7:54 ` [PATCH RFC 3/3] hush: fix memory leaks Ahmad Fatoum
2025-10-28  9:42 ` [PATCH RFC 1/3] lib: add talloc for overlaying a tree onto allocations Sascha Hauer
2025-10-28 10:26   ` Ahmad Fatoum
2025-11-07 13:55     ` Sascha Hauer [this message]
2025-11-07 13:56       ` Ahmad Fatoum
2025-11-10  8:12 ` Sascha Hauer

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=aQ36OuSKNw7m45LD@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@barebox.org \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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