[LEDE-DEV] [PATCH] kmodloader: don't store aliases info in struct module

Felix Fietkau nbd at nbd.name
Thu Feb 23 05:58:07 PST 2017

On 2017-02-23 04:25, Yousong Zhou wrote:
> This also fixes FS#544 as the allocation causing possible address alignment
> issue should now disappear
> Size comparison on x86_64 system
> 	function                                             old     new   delta
> 	alloc_module                                         398     245    -153
> 	------------------------------------------------------------------------------
> 	(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-153)           Total: -153 bytes
> Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
> ---
> Ted, please test it on your board to see if it can fix your issue.
> The patch was only run-tested on armvirt cortex-a15 machine.
> I actually thought about patching calloc_a to make sizeof_long-aligned
> allocation as the comment in libubox/utils.h says the func should "allocate a
> block of memory big enough to hold multiple aligned objects."
> But that's too corase a solution for a fundamental lib and can waste runtime
> memory.  Maybe we should reword that comment and provide a few helper macros
I think aligning to 4 bytes by default in calloc_a might be a good idea.
For cases where it's important to not waste any bytes, we could have an
unaligned variant of it.

- Felix

More information about the Lede-dev mailing list